DFA Minimization
DFA Minimization
DFA Minimization
Example
• Construct a DFA over alphabet {0, 1} that
accepts those strings that end in 111 0
0 q
0 q 1
1
q q
1
0 q …
…
q
1 q
0 q
1
q …
…
1
q 1
q 1
0
1 1 1
q q q q 1
0
0
M
inputs:
, 1, 11, 111
“ends in 111”
• Then after reading one more 1
– The state of x1 = 11 should be rejecting
– The state of y1 = 111 should be accepting
… but they are both the same state!
A smaller DFA
• Suppose M ends up in the same state after
reading inputs x = and y = 1
M , 1
inputs:
“ends in 111”
• Then after reading 11
– The state of x1 = 11 should be rejecting
– The state of y1 = 111 should be accepting
… but they are both the same state!
No smaller DFA!
• After looking at all possible pairs for x, y, x ≠ y
(, 1) (, 11) (, 111) (1, 11) (1, 111) (11, 111)
we conclude that
There is no DFA with 3 states for L
0
DFA minimization 0
q 1
0 q
1 1
…
q
q … q
1
1
…
0 1
q … q
1 q
1
q q 1
0 q
0 q 0
1
1 0
0 0
q
q 1 q
c t
w1 w2 wk-1 wk j e
… re
q’
1 0 1
q q q q
0
0
0, 1
0, 1
q0 1
1
q 1
q 0, 1 q
0, 1
0, 1
q1 x q1 ’
0
1 1
minimized DFA: q q qC 1
0
0
Food for thought
• Why does method find all distinguishable pairs?
w1 w2 wk-1 wk
…
q
x x x x
w1 w2 wk-1 wk
…
q’
A q2
q3
q1
q7
a C
w
q6
M smaller DFA M’
v q
q’’
v, v’
v’ q’
Food for thought
• Why is there no smaller DFA?
But then
M smaller DFA M’
v q w
q’’ w
v, v’
?
v’ q’ w