You are on page 1of 63

CSE322

Mealy and Moore Machine

Lecture #4
Null Transition
• An NFA with null transition is allowed to make
transition not only on input from the alphabet
but also with null input, i.e. without any input
symbol. This transition without input is called
null transition.
Null Transition
Null Transition
Language accepted: L  {aa}

q1 a q2
a
q0
a
q3
Lambda Transitions

q0 a q1  q2 a q3
a a

q0 a q1  q2 a q3
a a

q0 a q1  q2 a q3
(read head does not move)

a a

q0 a q1  q2 a q3
a a

q0 a q1  q2 a q3
all input is consumed

a a

“accept”

q0 a q1  q2 a q3

aa
String is accepted
Rejection Example

a a a

q0 a q1  q2 a q3
a a a

q0 a q1  q2 a q3
(read head doesn’t move)

a a a

q0 a q1  q2 a q3
a a a

q0 a q1  q2 a q3
No transition:
the automaton hangs
Input cannot be consumed

a a a

“reject”

q0 a q1  q2 a q3

aaa
String is rejected
Language accepted: L  {aa}

q0 a q1  q2 a q3
Another NFA Example

q0 a q1 b q2  q3


How to accept a string
How to accept a string
a b

q0 a q1 b q2  q3


a b

q0 a q1 b q2  q3


a b

q0 a q1 b q2  q3


a b

“accept”

q0 a q1 b q2  q3


Another String

a b a b

q0 a q1 b q2  q3


a b a b

q0 a q1 b q2  q3


a b a b

q0 a q1 b q2  q3


a b a b

q0 a q1 b q2  q3


a b a b

q0 a q1 b q2  q3


a b a b

q0 a q1 b q2  q3


a b a b

q0 a q1 b q2  q3


a b a b

“accept”

q0 a q1 b q2  q3


Language accepted

L  ab, abab, ababab, ...



 ab

q0 a q1 b q2  q3


Another NFA Example

0
q0 q1 0, 1 q2
1

Language accepted

L(M ) = {λ, 10, 1010, 101010, ...}


= {10} *
0
q0 q1 0, 1 q2
1 (redundant
state)

Mealy and Moore Model

 In finite Automata acceptability was decided on the basis of reach


ability of the final state by initial state.
 This restriction are removed and new model is given in which
output can be chosen from some other alphabet.

 The value of the output function Z(t) is a function of present state


q(t) and the present input x(t)
 Z(t) = λ(q(t), x(t)) Mealy Machine

 The value of the output function Z(t) is a function of present state


q(t) only and is independent of the current input
 Z(t) = λ(q(t)) Moore Machine
Moore Machine
Moore Machine is six-tuple (Q,∑,∆,δ,λ,q0):

(i)Q is a finite set of states

(ii)∑ is the input alphabet

(iii)∆ is the output alphabet

(iv)δ is the transition function from ∑ X Q into Q

(v)λ is the output function mapping Q into ∆ and

(vi) q0 is the initial state


Mealy Machine
Mealy Machine is six-tuple (Q,∑,∆,δ,λ,q0):

(i)Q is a finite set of states

(ii)∑ is the input alphabet

(iii)∆ is the output alphabet

(iv)δ is the transition function from ∑ X Q into Q

(v)λ is the output function mapping ∑ X Q into ∆ and

(vi) q0 is the initial state


Example of Moore Machine
Moore Machine
Example of Mealy Machine
Transforming Mealy to Moore Machine
Solution
• For state q1, there is only one incident edge with output 0. So,
we don't need to split this state in Moore machine.
• For state q2, there is 2 incident edge with output 0 and 1. So,
we will split this state into two states q20( state with output 0)
and q21(with output 1).
• For state q3, there is 2 incident edge with output 0 and 1. So,
we will split this state into two states q30( state with output 0)
and q31( state with output 1).
• For state q4, there is only one incident edge with output 0. So,
we don't need to split this state in Moore machine.
Transforming Moore to Mealy Machine
Solution
Moore to Mealy conversion
Solution
Answer Justification

• Here there is no output associated with q1 so,


It will be ^.
• q2 is associated with 2 outputs z1 and z2 so 2
states will be considered q21,q22.
• q3 is associated with 2 outputs z1 and z2 so 2
states will be considered q31,q32
Answer
Solution
Convert it to Moore Machine
Convert it to mealy machine

You might also like