EECS/MATH 343: CFL Pumping Lemma Proof Example

[Created by MSB]

Below, "e" denotes the empty string.

Show that L={ww | w is a binary string} is not CFL

Assume, for sake of contradiciton, that L is context-free. Let p be its pumping constant. Consider the string s= 0p1p0p1p. This string is 0p1p repeated, so it is in L.

Now assume that the string is split s=uvwxy, such that |vwx|<=p and |vx|>1. We shall now show that uwy is not in L, and thus show L not to be a context-free language, by contradiction.

There are several cases to consider (two of which are quite similar--thank you, cut-and-paste!):

  1. vwx is within the first half of the string. In particular, vx thus contains j 0's and k 1's, where 0<=j<=p and 0<=k<=p (but p>=j+k>=1). Then uwy begins with 0p-j1p-k. Since |uwy|=4p-j-k, we know that if uwy=tt, then |t|=2p-(j+k)/2 (note that if j+k is not even, then it can't be of this form). Thus, t ends within the second block of 0's, namely, t ends in 0. But uwy ends in 1, and so it cannot equal tt.
  2. vwx is within the second half of the string. In particular, vx thus contains j 0's and k 1's, where 0<=j<=p and 0<=k<=p (but p>=j+k>=1). Then uwy ends with 0p-j1p-k. Since |uwy|=4p-j-k, we know that if uwy=tt, then |t|=2p-(j+k)/2 (note that if j+k is not even, then it can't be of this form). Thus, the second copy of t begins within the first block of 1's, namely, t begins with 1. But uwy begins with 0, and so it cannot equal tt.
  3. vwx straddles the first block of 1's and the second block of 0's. If vx contains no 0's (because x=e), then the argument is as in case 1 above. If vx contains at least one 0, then uwy starts with a block of p 0's, and so does t if uwy=tt. However, there is no other block of p 0's in uwy for a second copy of t. We conclude uwy is not in L.


Created: 2004-03-10. Modified: 2004-03-10.