Download presentation
Presentation is loading. Please wait.
Published byRudolph Sullivan Modified over 8 years ago
1
1 Find as many examples as you can of w, x, y, z so that w is accepted by this DFA, w = x y z, y ≠ ε, | x y | ≤ 7, and x y n z is in L for all n ≥ 0.
2
2 CSC 320 midterm: Friday October 22 Midterm tutorial possible dates: Mon. Oct. 18 Tues. Oct. 19 Thurs. Oct. 21
3
3 Proof of the Pumping Lemma The pumping lemma is a statement about regular languages used to show using a proof by contradiction that languages are not regular. The goal today is to prove it and show further illustrations of how it can be used.
4
4 The Pumping Lemma for Regular Languages: If L is a language accepted by a DFA with k states, and w L, |w| ≥ k, then there exists x, y, z such that 1. w = x y z, 2. y ≠ ε, 3. | x y | ≤ k, and 4. x y n z is in L for all n ≥ 0.
5
5 Proof. Consider w· L, |w| ≥ k. Isolate the first k symbols in w: w= σ 1 σ 2 σ 3 … σ k-1 σ k w’. Consider the computation of M on w: (q 0, σ 1 σ 2 σ 3 … σ k-1 σ k w’) ├ (q 1, σ 2 σ 3 … σ k-1 σ k w’) ├ (q 2, σ 3 … σ k-1 σ k w’) ├ * (q k-1, σ k w’) ├ * (q k, w’) ├ * (f, e) for some final state f.
6
6 After reading σ 1 σ 2 σ 3 … σ k-1 σ k k+1 states have been visited: q 0, q 1, q 2, … q k. The computation: (q 0, σ 1 σ 2 σ 3 … σ k-1 σ k w’) ├ (q 1, σ 2 σ 3 … σ k-1 σ k w’) ├ (q 2, σ 3 … σ k-1 σ k w’) ├ * (q k-1, σ k w’) ├ * (q k, w’) ├ * (f, e) for some final state f. By the pigeonhole principle, some state has been repeated.
7
7 By the pigeonhole principle, some state has been repeated. Suppose q i is the first time we see the repeated state and q j is the second time. Rewriting the computation: (q 0, σ 1 σ 2 σ 3 … σ i σ i+1 … σ j σ j+1 … σ k-1 σ k w’) ├ * (q i, σ i+1 … σ j σ j+1 … σ k-1 σ k w’ ) ├ * (q j, σ j+1 … σ k-1 σ k w’ ) ├ * (f, e) for some final state f.
8
8 Digression from Proof: (q 0, σ 1 σ 2 σ 3 … σ i σ i+1 … σ j σ j+1 … σ k-1 σ k w’ ) ├ * (q i, σ i+1 … σ j σ j+1 … σ k-1 σ k w’ ) ├ * (q j, σ j+1 … σ k-1 σ k w’ ) ├ * (f, e) We can pump 0 times because: (q 0, σ 1 σ 2 σ 3 … σ i σ j+1 … σ k-1 σ k w’ ) ├ * ( q i = q j, σ j+1 … σ k-1 σ k w’ ) ├ * (f, e)
9
9 Digression from Proof: We can pump 2 times because: (q 0, σ 1 σ 2 σ 3 … σ i (σ i+1 … σ j ) 2 σ j+1 … σ k w’ ) ├ * (q i, (σ i+1 … σ j ) 2 σ j+1 … σ k w’ ) ├ * (q j = q i, (σ i+1 … σ j ) σ j+1 … σ k w’ ) ├ * (q j, σ j+1 … σ k w’ ) ├ * (f, e)
10
10 Let x= σ 1 σ 2 σ 3 … σ i, y = σ i+1 … σ j, and z= σ j+1 … σ k w’. The string x y n z is in L for all values of n ≥ 0 since (q 0, σ 1 σ 2 σ 3 … σ i (σ i+1 … σ j ) n σ j+1 … σ k w’ ) ├ * (q j = q i, (σ i+1 … σ j ) n σ j+1 … σ k w’ ) ├ * (q j = q i, (σ i+1 … σ j ) n-1 σ j+1 … σ k w’ ) ├ * … (q j = q i, (σ i+1 … σ j ) σ j+1 … σ k w’ ) ├ * (q j, σ j+1 … σ k w’ ) ├ * (f, e). End of Proof.
11
11 The Pumping Lemma for Regular Languages: If L is a language accepted by a DFA with k states, and w L, |w| ≥ k, then there exists x, y, z such that 1. w = x y z, 2. y ≠ ε, 3. | x y | ≤ k, and 4. x y n z is in L for all n ≥ 0.
12
12 L= { a n b n : n ≥ 0 } is not a regular language. Proof (by contradiction) Assume L is regular. Then L is accepted by a DFA M with k states for some integer k. Since L is accepted by a DFA M with k states, the pumping lemma holds. Let w = a r b r where r = ⌈ k/2⌉.
13
13 Consider all possibilities for y: Case 1: a i (a j ) a r-i-j b r j ≥ 1. Pump zero times: a r-j b r ∉ L since r-j < r. Case 2: a r b i (b j ) b r-i-j j ≥ 1. Pump zero times: a r b r-j ∉ since r-j < r. Case 3: a r-i ( a i b j ) b r-j i, j ≥ 1. Pump 2 times: a r-i a i b j a i b j b r-j ∉ L because it is not of the form a * b * Therefore, L is not regular.
14
14 Using closure properties: L= {w {a, b} * : w has the same number of a’s as b’s} is not regular. Proof (by contradiction) Assume L is regular. The language a* b* is regular since it has a regular expression. Because regular languages are closed under intersection, L ⋂ a* b* is regular. But L ⋂ a* b* = { a n b n : n ≥ 0} which is not regular. Therefore, L is not regular.
15
15 Problem of the Day (next class): Factor (ab) k as xyz in all ways such that y ≠ ε.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.