Professional Documents
Culture Documents
Finite Automata With Output
Finite Automata With Output
Finite Automata With Output
Output
Background
• Computers not only process data but also
present the results of processing
• Models of FAs with output
– Moore Machines
– Mealy Machines
q1
a/0 b/1
q0 a/1
q2
b/0
a/0
b/1 b/1
q3
a/1
Moore vs. Mealy
Moore To Mealy
• If Mo is a Moore machine, then there is a
Mealy machine Me that is equivalent to it.
• Constructive algorithm
a/t
a
b/t
b q
q/t
c c/t
Mo Me
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
Practice
Convert Moore to Mealy Machine
Mealy to Moore
• For every Mealy machine Me, there is a
Moore machine Mo, that is equivalent to
it
• Constructive Proof
• 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/0
q2/0
a
b b
a
q0c/1 q2c/1
b
a
b q3/0
Practice
Convert Mealy to Moore Machine