200 likes | 316 Views
This lecture covers the concept of Minimum Deterministic Finite Automata (DFA) for regular languages. It details the uniqueness of the minimum DFA for each regular language and explores methods to construct it. The discussion includes the use of equivalence relations to identify states and equivalence classes, emphasizing that for any given language, infinite DFAs can accept the language. Key examples illustrate how to construct minimum DFAs and identify non-regular languages through equivalence class analysis.
E N D
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 • Is there one with minimum number of states? • Answer: yes!
Equivalent Relation • xRx • xRy => yRx • xRy, yRz => xRz • Equivalence class [x]R = {y | xRy}
Example 1 • For each DFA M, define x RMy if and only if x y [x] ↔ a state RM
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
Minimum DFA • Q = {[x] | x in Σ*} • δ([x] , a) = [xa] • s = [ε] • F = {[x] | x in L} RL RL RL RL RL
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
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
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.
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
Example 1 0 0 1 0 1 0 1 0 0 0 1 0 1 1 1 0 1 0 1 1
Example 1 0 0 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 0 1 1 1
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
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
irregularity • # of [x] = infinity => L is not regular. • xw RL yw => x RL y RL
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
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
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
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