1 / 20

Lecture 9 Minimum DFA

Lecture 9 Minimum DFA. For each regular language, there is a unique minimum DFA. How do we find it? Applications. For each language L, how many DFA accepts L? Answer: infinity If we don’t allow any useless state (i.e., a state not be visited), how many DFA accepts L? Answer: still infinity

brinda
Download Presentation

Lecture 9 Minimum DFA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 9 Minimum DFA

  2. For each regular language, there is a unique minimum DFA. • How do we find it? • Applications.

  3. For each language L, how many DFA accepts L? • Answer: infinity • If we don’t allow any useless state (i.e., a state not be visited), how many DFA accepts L? • Answer: still infinity • Is there one with minimum number of states? • Answer: yes!

  4. Equivalent Relation • xRx • xRy => yRx • xRy, yRz => xRz • Equivalence class [x]R = {y | xRy}

  5. Example 1 • For each DFA M, define x RMy if and only if x y [x] ↔ a state RM

  6. Example 2 • For a language L, define x RL y if and only if for any w in Σ*, xw in L ↔ yw in L. [x] contains [x] if L=L(M) fot DFA M. RL RM x w y

  7. Minimum DFA • Q = {[x] | x in Σ*} • δ([x] , a) = [xa] • s = [ε] • F = {[x] | x in L} RL RL RL RL RL

  8. Why, well-defined? • x RL y => xa RL ya • # of [x] < infinity => For any w in Σ*, xw in L ↔ yw in L For any w in Σ*, xaw in L ↔ yaw in L RL

  9. Example • L=(0+1)*00 • [ε] = (0*1)* = ε + (0+1)*1 • [0] = (0*1)*0 = 0 + (0+1)*10 • [00] = L RL RL RL 0 1 0 0 [ε] [0] [00] 1 1

  10. General Way Given a regular language L, how to construct a minimum DFA for L? • Construct a DFA M for L=L(M). • Convert DFA to minimum DFA.

  11. Convert DFA to minimum DFA • Consider a DFA M = (Q, Σ, δ, s, F). • RL induces an equivalent relation in Q. [x] RL [y] x RL y • Find all equivalence classes of RL in Q by using: x RL y xa RL ya for a in Σ xa RL ya x RL y RM RM

  12. Example 1 0 0 1 0 1 0 1 0 0 0 1 0 1 1 1 0 1 0 1 1

  13. Example 1 0 0 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 0 1 1 1

  14. Example 1 0 0 0 0 1 0 1 1 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 1 1

  15. Let L = {x in (0+1)* | #0(x) ≡ 0 (mod 10), #1(x) ≡ 0 (mod 12)} . A DFA accepting L needs at least how many states: (a) 10 (b) 12 (c) 120 #0(x) ≡ 0 (mod 5), #1(x) ≡ 0 (mod 4) 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 1 1 1 1 0 0 0 0

  16. irregularity • # of [x] = infinity => L is not regular. • xw RL yw => x RL y RL

  17. Example 1 n n • L={0 1 | n > 0} is not regular. • [0], [0 ], [0 ], … are different classes. Proof. For i≠ j, 0 1 in L, 0 1 not in L. 2 3 i i j i

  18. Example 2 R • L={xx | x in (0+1)* } is not regular. • Proof. Consider 0 1, n > 0. They all in different equivalence classes because for i ≠ j, 0 110 in L and 0 110 not in L. n i i j i

  19. Example 3 + R • L = { wxx | w in (0+1)*, x in (0+1) } is not regular. • Proof. Consider (01) , n > 0. For i>j, (01) (10) in L, but (01) (10) not in L. n i i i j

  20. Questions? R • Is {wxx | w, x in (0+1)*} regular? • Is {xx w | w in (0+1)*, x in (0+1) } regular? • Is {xwx | w in (0+1)*, x in (0+1) } regular? R + + R

More Related