pumping-lemma - THE PUMPING LEMMA THE PUMPING LEMMA Theorem...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: THE PUMPING LEMMA THE PUMPING LEMMA Theorem. For any regular language L there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exist u, v, w ∈ Σ∗ , such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) for all i ≥ 0: uv i w ∈ L. x x L THE PUMPING LEMMA Theorem. For any regular language L there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exist u, v, w ∈ Σ∗ , such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) for all i ≥ 0: uv i w ∈ L. n x x L THE PUMPING LEMMA Theorem. For any regular language L there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exist u, v, w ∈ Σ∗ , such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) for all i ≥ 0: uv i w ∈ L. n x L x THE PUMPING LEMMA Theorem. For any regular language L there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exist u, v, w ∈ Σ∗ , such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) for all i ≥ 0: uv i w ∈ L. n L x x THE PUMPING LEMMA Theorem. For any regular language L there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exist u, v, w ∈ Σ∗ , such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) for all i ≥ 0: uv i w ∈ L. n L x u vx w THE PUMPING LEMMA Theorem. For any regular language L there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exist u, v, w ∈ Σ∗ , such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) for all i ≥ 0: uv i w ∈ L. n L x u u w vx w THE PUMPING LEMMA Theorem. For any regular language L there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exist u, v, w ∈ Σ∗ , such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) for all i ≥ 0: uv i w ∈ L. n L w x u u u w vx w vv THE PUMPING LEMMA Theorem. For any regular language L there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exist u, v, w ∈ Σ∗ , such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) for all i ≥ 0: uv i w ∈ L. n L x u u u u w vx w vv w vvv w PROOF OF P.L. (SKETCH) PROOF OF P.L. (SKETCH) Let M be a DFA for L. Take n be the number of states of M plus 1. PROOF OF P.L. (SKETCH) Let M be a DFA for L. Take n be the number of states of M plus 1. Take any x ∈ L with |x| ≥ n. Consider the path (from start state to an accepting state) in M that corresponds to x. The length of this path is |x| ≥ n. PROOF OF P.L. (SKETCH) Let M be a DFA for L. Take n be the number of states of M plus 1. Take any x ∈ L with |x| ≥ n. Consider the path (from start state to an accepting state) in M that corresponds to x. The length of this path is |x| ≥ n. Since M has at most n − 1 states, some state must be visited twice or more in the first n steps of the path. PROOF OF P.L. (SKETCH) Let M be a DFA for L. Take n be the number of states of M plus 1. Take any x ∈ L with |x| ≥ n. Consider the path (from start state to an accepting state) in M that corresponds to x. The length of this path is |x| ≥ n. Since M has at most n − 1 states, some state must be visited twice or more in the first n steps of the path. u w v PROOF OF P.L. (SKETCH) Let M be a DFA for L. Take n be the number of states of M plus 1. Take any x ∈ L with |x| ≥ n. Consider the path (from start state to an accepting state) in M that corresponds to x. The length of this path is |x| ≥ n. Since M has at most n − 1 states, some state must be visited twice or more in the first n steps of the path. u w v uw ∈ L x = uvw ∈ L uvvw ∈ L uvvvw ∈ L ... USING PUMPING LEMMA TO PROVE NON-REGULARITY L regular =⇒ L satisfies P.L. L non-regular =⇒ ? L non-regular ⇐= L doesn’t satisfy P.L. Negation: ∃ n ∈ N ∀ x ∈ L with |x| ≥ n ∃ u, v, w ∈ Σ∗ all of these hold: (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) ∀ i ≥ 0: uv i w ∈ L. USING PUMPING LEMMA TO PROVE NON-REGULARITY L regular =⇒ L satisfies P.L. L non-regular =⇒ ? L non-regular ⇐= L doesn’t satisfy P.L. Negation: ∃ n ∈ N ∀ x ∈ L with |x| ≥ n ∃ u, v, w ∈ Σ∗ all of these hold: (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) ∀ i ≥ 0: uv i w ∈ L. USING PUMPING LEMMA TO PROVE NON-REGULARITY L regular =⇒ L satisfies P.L. L non-regular =⇒ ? L non-regular ⇐= L doesn’t satisfy P.L. Negation: ∃ n ∈ N ∀ x ∈ L with |x| ≥ n ∃ u, v, w ∈ Σ∗ all of these hold: (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) ∀ i ≥ 0: uv i w ∈ L. ∀ n ∈ N ∃ x ∈ L with |x| ≥ n ∀ u, v, w ∈ Σ∗ not all of these hold: (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) ∀ i ≥ 0: uv i w ∈ L. USING PUMPING LEMMA TO PROVE NON-REGULARITY L regular =⇒ L satisfies P.L. L non-regular =⇒ ? L non-regular ⇐= L doesn’t satisfy P.L. Negation: ∃ n ∈ N ∀ x ∈ L with |x| ≥ n ∃ u, v, w ∈ Σ∗ all of these hold: (1) x = uvw Equivalently: (2) |uv(1) ∧ (2) ∧ (3) ⇒ not(4) |≤n where not(4) is: (3) |v | ≥ 1 i ∃ i : uv w ￿∈ L (4) ∀ i ≥ 0: uv i w ∈ L. ∀ n ∈ N ∃ x ∈ L with |x| ≥ n ∀ u, v, w ∈ Σ∗ not all of these hold: (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) ∀ i ≥ 0: uv i w ∈ L. EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. Proof. Show that P.L. doesn’t hold (note: showing P.L. holds doesn’t mean regularity ). EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. Proof. Show that P.L. doesn’t hold (note: showing P.L. holds doesn’t mean regularity ). If L is regular, then by P.L. ∃ n such that . . . EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. Proof. Show that P.L. doesn’t hold (note: showing P.L. holds doesn’t mean regularity ). If L is regular, then by P.L. ∃ n such that . . . Now let x = 0n 1n EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. Proof. Show that P.L. doesn’t hold (note: showing P.L. holds doesn’t mean regularity ). If L is regular, then by P.L. ∃ n such that . . . Now let x = 0n 1n x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. Proof. Show that P.L. doesn’t hold (note: showing P.L. holds doesn’t mean regularity ). If L is regular, then by P.L. ∃ n such that . . . Now let x = 0n 1n x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. We show that ∀ u, v, w (1)–(4) don’t all hold. EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. Proof. Show that P.L. doesn’t hold (note: showing P.L. holds doesn’t mean regularity ). If L is regular, then by P.L. ∃ n such that . . . Now let x = 0n 1n x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. We show that ∀ u, v, w (1)–(4) don’t all hold. If (1), (2), (3) hold then x = 0n 1n = uvw with |uv | ≤ n and |v | ≥ 1. EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. Proof. Show that P.L. doesn’t hold (note: showing P.L. holds doesn’t mean regularity ). If L is regular, then by P.L. ∃ n such that . . . Now let x = 0n 1n x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. If (1), (2), (3) hold then x = 0n 1n = uvw with |uv | ≤ n and |v | ≥ 1. So, u = 0s , v = 0t , w = 0p 1n with We show that ∀ u, v, w (1)–(4) don’t all hold. EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. Proof. Show that P.L. doesn’t hold (note: showing P.L. holds doesn’t mean regularity ). If L is regular, then by P.L. ∃ n such that . . . Now let x = 0n 1n x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. If (1), (2), (3) hold then x = 0n 1n = uvw with |uv | ≤ n and |v | ≥ 1. So, u = 0s , v = 0t , w = 0p 1n with s + t ≤ n, t ≥ 1, p ≥ 0, s + t + p = n. We show that ∀ u, v, w (1)–(4) don’t all hold. EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. Proof. Show that P.L. doesn’t hold (note: showing P.L. holds doesn’t mean regularity ). If L is regular, then by P.L. ∃ n such that . . . Now let x = 0n 1n x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. If (1), (2), (3) hold then x = 0n 1n = uvw with |uv | ≤ n and |v | ≥ 1. So, u = 0s , v = 0t , w = 0p 1n with We show that ∀ u, v, w (1)–(4) don’t all hold. But then (4) fails for i = 0: s + t ≤ n, t ≥ 1, p ≥ 0, s + t + p = n. EXAMPLE 1 Prove that L = {0i 1i : i ≥ 0} is NOT regular. Proof. Show that P.L. doesn’t hold (note: showing P.L. holds doesn’t mean regularity ). If L is regular, then by P.L. ∃ n such that . . . Now let x = 0n 1n x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. If (1), (2), (3) hold then x = 0n 1n = uvw with |uv | ≤ n and |v | ≥ 1. So, u = 0s , v = 0t , w = 0p 1n with We show that ∀ u, v, w (1)–(4) don’t all hold. But then (4) fails for i = 0: s + t ≤ n, t ≥ 1, p ≥ 0, s + t + p = n. uv 0 w = uw = 0s 0p 1n = 0s+p 1n ￿∈ L, since s + p ￿= n IN PICTURE ∃ u, v, w such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) ∀ i ∈ N : uv i w ∈ L. IN PICTURE ∃ u, v, w such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 (4) ∀ i ∈ N : uv i w ∈ L. ￿ ￿￿ ￿ ￿￿￿￿ ￿ ￿￿ ￿ 00000 0 . . . 01111 . . . 1 ∈ L u v w IN PICTURE ∃ u, v, w such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 non-empty (4) ∀ i ∈ N : uv i w ∈ L. ￿ ￿￿ ￿ ￿￿￿￿ ￿ ￿￿ ￿ 00000 0 . . . 01111 . . . 1 ∈ L u v w IN PICTURE ∃ u, v, w such that (1) x = uvw (2) |uv | ≤ n (3) |v | ≥ 1 non-empty (4) ∀ i ∈ N : uv i w ∈ L. ￿ ￿￿ ￿ ￿￿￿￿ ￿ ￿￿ ￿ 00000 0 . . . 01111 . . . 1 ∈ L u v w If (1), (2), (3) hold then (4) fails: it is not the case that for all i, uv i w is in L. In particular, let i = 0. uw ￿∈ L. EXAMPLE 2 Prove that L = {0i : i is a prime} is NOT regular. EXAMPLE 2 Prove that L = {0i : i is a prime} is NOT regular. Proof. We show that P.L. doesn’t hold. EXAMPLE 2 Prove that L = {0i : i is a prime} is NOT regular. Proof. We show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . EXAMPLE 2 Prove that L = {0i : i is a prime} is NOT regular. Proof. We show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Now let x = 0m where m ≥ n + 2 is prime. EXAMPLE 2 Prove that L = {0i : i is a prime} is NOT regular. Proof. We show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Now let x = 0m where m ≥ n + 2 is prime. x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. EXAMPLE 2 Prove that L = {0i : i is a prime} is NOT regular. Proof. We show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Now let x = 0m where m ≥ n + 2 is prime. x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. We show that ∀ u, v, w (1)–(4) don’t all hold. EXAMPLE 2 Prove that L = {0i : i is a prime} is NOT regular. Proof. We show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Now let x = 0m where m ≥ n + 2 is prime. x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. We show that ∀ u, v, w (1)–(4) don’t all hold. If 0m is written as 0m = uvw, then 0m = 0|u| 0|v| 0|w| . EXAMPLE 2 Prove that L = {0i : i is a prime} is NOT regular. Proof. We show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Now let x = 0m where m ≥ n + 2 is prime. x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. We show that ∀ u, v, w (1)–(4) don’t all hold. If 0m is written as 0m = uvw, then 0m = 0|u| 0|v| 0|w| . If |uv | ≤ n and |v | ≥ 1, then consider i = |v | + |w|: EXAMPLE 2 Prove that L = {0i : i is a prime} is NOT regular. Proof. We show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Now let x = 0m where m ≥ n + 2 is prime. x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. We show that ∀ u, v, w (1)–(4) don’t all hold. If 0m is written as 0m = uvw, then 0m = 0|u| 0|v| 0|w| . If |uv | ≤ n and |v | ≥ 1, then consider i = |v | + |w|: uv w i =00 =0 |v | |v |(|v |+|w|) |w| (|v |+1)(|v |+|w|) 0 ￿∈ L EXAMPLE 2 Prove that L = {0i : i is a prime} is NOT regular. Proof. We show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Now let x = 0m where m ≥ n + 2 is prime. x ∈ L and |x| ≥ n, so by P.L. ∃u, v, w such that (1)–(4) hold. We show that ∀ u, v, w (1)–(4) don’t all hold. If 0m is written as 0m = uvw, then 0m = 0|u| 0|v| 0|w| . If |uv | ≤ n and |v | ≥ 1, then consider i = |v | + |w|: uv w i =00 =0 |v | |v |(|v |+|w|) |w| (|v |+1)(|v |+|w|) Both factors ≥ 2 0 ￿∈ L EXAMPLE 3 Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. EXAMPLE 3 Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Again we try to show that P.L. doesn’t hold. EXAMPLE 3 Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Again we try to show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . EXAMPLE 3 Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Again we try to show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Let us consider x = 0n 0n ∈ L. Obviously |x| ≥ n. EXAMPLE 3 Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Again we try to show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Let us consider x = 0n 0n ∈ L. Obviously |x| ≥ n. Can 0n 0n be written as 0n 0n = uvw such that |uv | ≤ n |v | ≥ 1 and that for all i: uv i w ∈ L? EXAMPLE 3 Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Again we try to show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Let us consider x = 0n 0n ∈ L. Obviously |x| ≥ n. Can 0n 0n be written as 0n 0n = uvw such that |uv | ≤ n |v | ≥ 1 and that for all i: uv i w ∈ L? YES! Let u = ￿, v = 00, and w = 02n−2 . EXAMPLE 3 Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Again we try to show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Let us consider x = 0n 0n ∈ L. Obviously |x| ≥ n. Can 0n 0n be written as 0n 0n = uvw such that |uv | ≤ n |v | ≥ 1 and that for all i: uv i w ∈ L? YES! Let u = ￿, v = 00, and w = 02n−2 . Then ∀i , uv i w is of the form 02k = 0k 0k . EXAMPLE 3 Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Again we try to show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Let us consider x = 0n 0n ∈ L. Obviously |x| ≥ n. Can 0n 0n be written as 0n 0n = uvw such that |uv | ≤ n |v | ≥ 1 and that for all i: uv i w ∈ L? YES! Let u = ￿, v = 00, and w = 02n−2 . Then ∀i , uv i w is of the form 02k = 0k 0k . Does this mean that L is regular? EXAMPLE 3 Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Again we try to show that P.L. doesn’t hold. If L is regular, then by P.L. ∃ n such that . . . Let us consider x = 0n 0n ∈ L. Obviously |x| ≥ n. Can 0n 0n be written as 0n 0n = uvw such that |uv | ≤ n |v | ≥ 1 and that for all i: uv i w ∈ L? YES! Let u = ￿, v = 00, and w = 02n−2 . Then ∀i , uv i w is of the form 02k = 0k 0k . Does this mean that L is regular? P.L., we only need to exhibit some x that cannot be “pumped” (and |x| ≥ n). NO. We have chosen a bad string x. To show that L fails the EXAMPLE 3, 2ND ATTEMPT Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. EXAMPLE 3, 2ND ATTEMPT Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Given n from the P.L., let x = (01)n (01)n . Obviously x ∈ L and |x| ≥ n. EXAMPLE 3, 2ND ATTEMPT Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Given n from the P.L., let x = (01)n (01)n . Obviously x ∈ L and |x| ≥ n. Q: Can x be “pumped” for some choice of u, v, w with |uv | ≤ n and |v | ≥ 1? EXAMPLE 3, 2ND ATTEMPT Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Given n from the P.L., let x = (01)n (01)n . Obviously x ∈ L and |x| ≥ n. Q: Can x be “pumped” for some choice of u, v, w with |uv | ≤ n and |v | ≥ 1? A: Yes! Take u = ￿, v = 0101, w = (01)2n−2 . EXAMPLE 3, 2ND ATTEMPT Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. Given n from the P.L., let x = (01)n (01)n . Obviously x ∈ L and |x| ≥ n. Q: Can x be “pumped” for some choice of u, v, w with |uv | ≤ n and |v | ≥ 1? A: Yes! Take u = ￿, v = 0101, w = (01)2n−2 . Another bad choice of x! EXAMPLE 3, 3RD ATTEMPT Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. EXAMPLE 3, 3RD ATTEMPT Given n from the P.L., let x = 0n 10n 1. Again x ∈ L and |x| ≥ n. Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. EXAMPLE 3, 3RD ATTEMPT Given n from the P.L., let x = 0n 10n 1. Again x ∈ L and |x| ≥ n. Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. ∀u, v, w such that 0n 10n 1 = uvw and |uv | ≤ n and |v | ≥ 1: EXAMPLE 3, 3RD ATTEMPT Given n from the P.L., let x = 0n 10n 1. Again x ∈ L and |x| ≥ n. Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. ∀u, v, w such that 0n 10n 1 = uvw and |uv | ≤ n and |v | ≥ 1: must have uv contained in the first group of 0n . Thus consider EXAMPLE 3, 3RD ATTEMPT Given n from the P.L., let x = 0n 10n 1. Again x ∈ L and |x| ≥ n. Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. ∀u, v, w such that 0n 10n 1 = uvw and |uv | ≤ n and |v | ≥ 1: must have uv contained in the first group of 0n . Thus consider uv w = 0 0 n−|v | 10 1. n EXAMPLE 3, 3RD ATTEMPT Given n from the P.L., let x = 0n 10n 1. Again x ∈ L and |x| ≥ n. Prove that L = {yy : y ∈ {0, 1}∗ } is NOT regular. ∀u, v, w such that 0n 10n 1 = uvw and |uv | ≤ n and |v | ≥ 1: must have uv contained in the first group of 0n . Thus consider uv w = 0 0 n−|v | 10 1. n Since |v | is at least 1, this is clearly not of the form yy . ...
View Full Document

This note was uploaded on 04/11/2010 for the course CSC CSC236 taught by Professor Farzanazadeh during the Spring '10 term at University of Toronto.

Ask a homework question - tutors are online