DFA Minimization cs 466Prasad L 13 DFAMin 1

  • Slides: 11
Download presentation
DFA Minimization cs 466(Prasad) L 13 DFAMin 1

DFA Minimization cs 466(Prasad) L 13 DFAMin 1

Strings over {a, b} with even number of a’s S* Ea Eb [Ea, Eb]

Strings over {a, b} with even number of a’s S* Ea Eb [Ea, Eb] a a [Oa, Eb] cs 466(Prasad) Oa Eb Ob Ob b b L 13 DFAMin [Ea, Ob] a a [Oa, Ob] 2

Strings over {a, b} with even number of a’s S* Ea Oa a [Ea]

Strings over {a, b} with even number of a’s S* Ea Oa a [Ea] a b b cs 466(Prasad) [Oa] L 13 DFAMin 3

Observation • The states among the state sets {[Ea, Eb], [Ea, Ob]} and {[Oa,

Observation • The states among the state sets {[Ea, Eb], [Ea, Ob]} and {[Oa, Eb], [Oa, Ob]} differ on aspect immaterial for the problem at hand. • Why not collapse these state sets into one state each, to get a smaller DFA? cs 466(Prasad) L 13 DFAMin 4

Equivalent or Indistinguishable States • Recall that a DFA state summarizes the substring consumed

Equivalent or Indistinguishable States • Recall that a DFA state summarizes the substring consumed so far (that is, the past history). • Two states qi and qj are equivalent or indistinguishable (for the future), if, when started in these states, every string causes the machine to either end up in an accepting state for both or end up in a non-accepting state for both. • In other words, there is no string that can tell the equivalent states apart for the given language. cs 466(Prasad) L 13 DFAMin 5

Main Idea qi qm a qj qn a If qm and qn are distinguishable,

Main Idea qi qm a qj qn a If qm and qn are distinguishable, then so are qi and qj cs 466(Prasad) L 13 DFAMin 6

Example DFA a q 0 b a q 1 q 2 a q 4

Example DFA a q 0 b a q 1 q 2 a q 4 (a u b)(a u b*) cs 466(Prasad) q 3 a a, b b b a, b q 5 q 7 a q 6 b a, b b L 13 DFAMin 7

Refinement of State Partitions • { {q 0, q 7} , {q 1, q

Refinement of State Partitions • { {q 0, q 7} , {q 1, q 2, q 3, q 4, q 5, q 6} } • { {q 0}, {q 7}, {q 1, q 2, q 3, q 4, q 5, q 6} } • On any transition • { {q 0}, {q 7}, {q 1, q 2, q 3, q 4, q 5, q 6} } • { {q 0}, {q 7}, {q 1, q 4}, {q 2, q 3, q 5, q 6} } • On “a” transition • { {q 0}, {q 7}, {q 1, q 4}, {q 2, q 5}, {q 3, q 6} } • On “b” transition cs 466(Prasad) L 13 DFAMin 8

Example DFA showing equivalent states b a q 0 a q 1 q 2

Example DFA showing equivalent states b a q 0 a q 1 q 2 a q 4 (a u b)(a u b*) cs 466(Prasad) q 3 a a, b b b a, b q 5 q 7 a q 6 b a, b b L 13 DFAMin 9

Example Minimum DFA q 0 a, b a q 1, q 4 (a u

Example Minimum DFA q 0 a, b a q 1, q 4 (a u b)(a u b*) cs 466(Prasad) b a, b q 2, q 5 q 7 a q 3, q 6 a, b b L 13 DFAMin 10

 • For an efficient way of determining minimal DFA, see the details in

• For an efficient way of determining minimal DFA, see the details in Algorithm 5. 7. 2 cs 466(Prasad) L 13 DFAMin 11