0% found this document useful (0 votes)
98 views6 pages

Automata Moore MealyMachine

- Moore machines and Mealy machines are types of automata that produce an output in response to inputs, unlike DFAs and NFAs which only check for string acceptance. - A Moore machine's output depends only on its current state, while a Mealy machine's output depends on both its current state and the current input. - The key differences between Moore and Mealy machines are that Moore machines have an output length one greater than the input length due to the initial state producing an output, while Mealy machines have equal length input and output since the output is produced after consuming each input symbol.

Uploaded by

ratna.patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views6 pages

Automata Moore MealyMachine

- Moore machines and Mealy machines are types of automata that produce an output in response to inputs, unlike DFAs and NFAs which only check for string acceptance. - A Moore machine's output depends only on its current state, while a Mealy machine's output depends on both its current state and the current input. - The key differences between Moore and Mealy machines are that Moore machines have an output length one greater than the input length due to the initial state producing an output, while Mealy machines have equal length input and output since the output is produced after consuming each input symbol.

Uploaded by

ratna.patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Automata Moore Machine

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.

 Each state of Moore or mealy machine gives an output. Output is denoted by


Output symbol.
 Initial state always gives an output. Remaining outputs depends on transition
function.

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.

Formal Definition of Moore Machine


Moore and mealy machines accept all regular languages. The output depends only
on the current state of the machine. The output is represented by current state
separated by “/”.
Moore machine can be described by 6 tuples (Q, q0, ∑, O, δ, λ) where,
 Q: finite set of states
 q0: initial state of machine
 ∑: finite set of input symbols
 O: output alphabet
 δ: transition function where Q × ∑ → Q
 λ: output function where Q → O

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,

For instance, take one binary number 111001 then

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.

An example of Mealy Machine is given below

Tuples of Mealy Machine


Mealy Machine can be described by 6 tuples (Q, q0, ∑, O, δ, λ’). Let explain above
Mealy Machine where
 q0 and q1 are states (Q).
 q0 is the initial state.
 Input alphabets (∑) are “0” and “1”.
 Output alphabets (O) are “a” and “b”.
 Transition function (Q × ∑ →Q) and output function (Q × ∑ →O) are explained
in the following table
Transition Table in Mealy Machine
In Automata Mealy Machine, When the input is given then Mealy Machine first gives
an output and then goes to next state.
In the above given Mealy Machine, the transition table is given below

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

Thus we get 00011 which is 1’s complement of 11100,

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”

You might also like