Minimizing DFAs Lecture 11 Exercise 7 40 Fri

  • Slides: 10
Download presentation
Minimizing DFAs Lecture 11 Exercise 7. 40 Fri, Sep 14, 2007

Minimizing DFAs Lecture 11 Exercise 7. 40 Fri, Sep 14, 2007

Equivalent States • To minimize a DFA, we must identify states that are “equivalent,

Equivalent States • To minimize a DFA, we must identify states that are “equivalent, ” meaning that the outcome will be the same regardless of which of them we are in.

Equivalent States • Clearly, the states 1 and 2 are equivalent. 1 a b

Equivalent States • Clearly, the states 1 and 2 are equivalent. 1 a b b a b 2 a a

0 -Equivalence of States • Two states q and q are 0 equivalent if

0 -Equivalence of States • Two states q and q are 0 equivalent if • Both are accepting states, or • Both are rejecting states.

n-Equivalence of States • Let n be a positive integer. • Two states q

n-Equivalence of States • Let n be a positive integer. • Two states q and q are nequivalent if • (q, a) and (q , a) are (n – 1)equivalent for all a in .

Equivalence of States • Two states q and q are equivalent if • q

Equivalence of States • Two states q and q are equivalent if • q and q are n-equivalent for all n 0.

Determining Equivalent States • To determine which states are equivalent, • First, eliminate all

Determining Equivalent States • To determine which states are equivalent, • First, eliminate all states from which accepting states are unreachable. • Determine the 0 -equivalence classes: F, Q – F.

Determining Equivalent States • From the 0 -equivalence classes, determine the 1 -equivalence classes.

Determining Equivalent States • From the 0 -equivalence classes, determine the 1 -equivalence classes. • And so on, until. . . • For some n, the n-equivalence classes and the (n – 1)-equivalence classes are the same.

Determining Equivalent States • At that point, the equivalence classes are the n-equivalence classes.

Determining Equivalent States • At that point, the equivalence classes are the n-equivalence classes. • Redraw the DFA, lumping all states of an equivalence class together as a single state.

Minimizing a DFA • Minimize the following DFA: a a 1 b 2 b

Minimizing a DFA • Minimize the following DFA: a a 1 b 2 b b 3 b a a 7 b b a 8 4 a 5 b a 9 b b a 6 a 10 a, b