Toa - Lecture Notes-17
Toa - Lecture Notes-17
CS09305
Lecture 17
Finite Automata With
Output
Chapter 8
Mealy Machine
• Another variation of FA
• Output associated with edges
• Edges from the same state may
have different output letters
associated with each of them
Mealy Machine
• Collection of four things
• A finite set of states q0,q1,q2,…qn where q0 is
designated as the start state.
• An alphabet of letters for forming the input string =
{a b c ...}
• An alphabet of possible output characters Г = {x y z}
or numbers {0 1 …}
• A pictorial representation with states represented by
small circles and directed edges indicating
transitions b/w states. Labels of the edges are
compound symbols of the form i/o where i
represents the input letter while o is the output
character associated with the edge
Mealy Machine
• Example, aaabb (01110, same output characters as
input letters)
q1
a/0 b/1
q0 a/1
q2
b/0
a/0
b/1 b/1
q3
a/1
Mealy Machine
• Applications: Increment Machine 00500
• 010011
1
------------
010100
0/0 1/1
No
carry
0/1
0/1
0/1,1/0 start
1/0
q0 Owe
1/0
carry
Mealy Machine
• Language Recognition
a/1
• Language recognition through
specialized patterns in output
a/0 strings
a/t
a
b/t
b q
q/t
c c/t
Moore to Mealy
• For any state q of the Mo that has the output character
t associated with it, relabel all the incoming edges as
x/t where x is the input character previously written on
the transition. Change the label of state as it is in
Mealy Machine
• Repeat the procedure for all the states in Moore
Machine
• The outgoing edges of the state will get replaced in the relabeling
process of other states
• The resultant Machine is a Mealy Machine that
produces output strings which when concatenated
with the start state symbol is exactly the one produced
by the original Mo for every input string.
Moore to Mealy
q1/1 q1
a a/1
a a/1
a,b a/1, b/1
b/0
q0/0 b q2/1 q0 q2
b/0
b/1
b b
q3/0 q3
a/0
a
Mealy to Moore
• For every Mealy machine Me, there is a
Moore machine Mo, that is equivalent to
it
• Constructive Proof
• Reverse of Previous proof is not
possible
• Different characters associated with
each edge
Mealy to Moore
b
a/1
a
b/0 q/0
a/1 b/1
a/0
q
b/1 a/1
b/1
b qc/1
b/1
Mealy to Moore
• Conversion of loops
a
q6 q3/0 a/0
a/0
a/0
b/1 b q6
q3
b a/0
q3c/1
Mealy to Moore
• Example
b/1
q1
a/0 a/1
b/0
q0 a/1 q2
b/0
a/0
b/1
q3
Mealy to Moore
b a
a q1/1 a
b
q0(1)/0
q2(1)/0
a
b b
a
q0(2)/1 q2(2)/1
b
a
b q3/0