Pumping Lemma for CFL If L is a context-free language, then there is a number p (the pumping length) where, if s is any string in L of length at least p, then s may be divided into five pieces s=uvxyz satisfying the conditions: 1. For each i ≥ 0, s=uvixyiz L, 2. |vy| > 0, and 3. |vxy| ≤ p.

Pumping Lemma as an “Adversary Game” 1. We pick a language L that we want to show is not a CFL. 2. Our “adversary” gets to pick p. 3. We get to pick s, and may use p as a parameter when we do so. 4. Our adversary gets to break s into uvxyz, subject only to the constraints that |vy| > 0, and |vxy| ≤ p. 5. We “win” the game, if we can, by picking i and showing that uvixyiz is not in L.

Example 1: L = { 1 n where n is prime} By intuition: Is L a context-free language? n=2: n=3: n=5: n=7: n=13: 11 11111111

Example 1: L = { 1 n where n is prime} n Adversary picks a pumping length of p. n Consider some prime n ≥ p+2. n Such an n must exist since there an infinite number of primes. n Let s= 1 n n Adversary picks uvxyz. n Let |vy| = m. n Then, |uxz| = n-m.

Example 1: L = { 1 n where n is prime} n By the pumping lemma, uvn-mxyn-mz L n |uvn-mxyn-mz| = |uxz| + (n-m) (|v| + |y|) = n-m + (n-m) m = (n-m) (m+1) n Thus, |uvn-mxyn-mz| is not prime unless one of the above factors is 1. n But, (m+1) > 1 since m=|vy|, and |vy| > 0. n (n-m) > 1 since: § n ≥ p+2 was chosen, and § m ≤ p since m=|vy| ≤ |vxy| ≤ p