Download presentation
Presentation is loading. Please wait.
Published byRudy Jolly Modified over 10 years ago
1
Reducing DFA’s Section 2.4
2
Reduction of DFA For any language, there are many DFA’s that accept the language Why would we want to find the smallest? Algorithm: Finds smallest equivalent DFA
3
Distinguishable States A state p is indistinguishable from another q if, for all walks w, δ*(p,w) F implies δ*(q,w) F and δ*(p,w) F implies δ*(q,w) F Otherwise, they are distinguishable
4
Two Step Algorithm First, mark all pairs of states as distinguishable or indistinguishable Then, merge indistinguishable states into one state for the smaller graph
5
Mark Algorithm 1.Remove inaccessible states 2.Mark all states in F as distinguishable from those not in F. 3.Repeat until all pairs are marked: For all pairs (p,q) and all symbols (a), if δ(p,a) is distinguishable from δ(q,a), then p is distinguishable from q.
6
Reduce Algorithm Create a state for each set of indistinguishable states from the Mark algorithm. Rewrite transitions between states. If δ(p,a) = q, then make a transition from the node containing the original p to the node containing the original q and label it a.
7
Example q0 q1 q2 q3 q4 0 0 0 0 0,1 1 1 1 1 01 q0q1q3 q1q2q4 q2q1q4 q3q2q4
8
Example 01 q0q1q3 q1q2q4 q2q1q4 q3q2q4 Distinguishable Pairs Final –Nonfinal states (q0,q4) (q1,q4) (q2,q4) (q3,q4)
9
Example 01 q0q1q3 q1q2q4 q2q1q4 q3q2q4 Distinguishable Pairs: Chart Compare (q0,q4) (q1,q4) (q2,q4) (q3,q4) (q0,q1) (q0,q2) (q0,q3)
10
Example Distinguishable Pairs: (q0,q4) (q1,q4) (q2,q4) (q3,q4) (q0,q1) (q0,q2) (q0,q3) Indistinguishable Pairs: {q0} {q1, q2,q3} {q4}
11
Example q0 q1 q2 q3 q4 0 0 0 0 0,1 1 1 1 1 01,2,34 0,11 0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.