Automata Moore MealyMachine
Automata Moore MealyMachine
As we already covered the topics of DFA and NFA. Both DFA and NFA are the
automata machines which take the input and do not give the output. Both DFA and
NFA just check the acceptance of the given string. But the Automata Moore
Machine and Mealy take the input and give the output also. There is no final
state in Moore Machine.
Condition: For Moore machine, there must be a dedicated path for each input from
each state like DFA.
Important: Output of Moore machine is always one greater than input. If the input
length is three (i.e. 011) then output length will be four (i.e. aabb). Because initial
state always gives an output without an input.
Example 1
Design a Moore machine to generate 1’s complement of a given binary
number.
Solution
According to first complement, if the given input is “1” then the output will be “0” and
if the input is “0” then the output will be “1”.
For First complement there should be at least three states.
One state is start state.
The 2nd state is to accept “1’s” as input and produces output as “0”.
The 3rd state will accept “0’s” as input and producing output as “1”.
Hence the final Moore machine of given example 1 will be,
Thus we get 0000110 as 1’s complement of 111001, we can neglect the initial 0 and
the output which we get is 000110 which is 1’s complement of 111001.
Important :The output for a Moore machine is greater than input in length by 1.
Because start state always gives an output without consuming an input.
Transition table
The Transition table of above constructed Moore Machine is given below
Thus Moore machine 6 tuples {Q, q0, ∑, O, δ, λ} are explained below where
Q = {q0, q1, q2},
q0 is the initial state
∑ = {0, 1},
O = {0, 1}. the transition table shows the
Remaining two tuples ( δ and λ functions) are shown in the transition table
Example 02
Construct a Automata Moore Machine that prints “a” whenever the sequence
“01” is encountered in any input binary string.
Solution
Automata Moore Machine for given example is given below
Automata Mealy Machine
Automata Mealy Machine is just similar to Automata Moore Machine except the
following,
In the Automata Mealy Machine for each state, the output symbol is
represented along with input symbol. Both input and output symbols are
separated by /.
And in Mealy Machine length of input is always equal to output. Because In
Mealy Machine first output comes by consuming first input symbol.
Before to reach the next state, Output receive immediately as the input
consumed.
Example 1
Design a Mealy machine to generate 1’s complement of a any given binary
input.
Solution
According to first complement, if the given input is “1” then the output will be “0” and
vice versa.
Hence, the Mealy Machine of given question is given below
For instance, take one binary number 11100 then look at the following table
Example 2
Design a Mealy Machine that prints “a” whenever the sequence “01” is encountered
in any input binary string.
Solution
The requirement is that, whenever the “01” appear in the string the output must be
end with “a”
Desired Mealy Machine is given below
For instance, take one binary number 10111001 then look at the following table
As shown in the above table, whenever the “01” occurs in input string then the output
will be “a”