Processing math: 100%
Skip to content

2.3 Pumping Lemma for CFL

Definition of Pumping Lemma

Let L be a context-free language. Then there is a constant p so that if zL and |z|p then z can be decomposed into 5 parts: z=uvwxy. so that:

  • |vwx|p
  • vxε
  • i,uviwxiyL

An non-CFL to prove that cannot be pumped

L={0n1n2n|n0}

Suppose it is context free. Let p be its pumping constant. Let z=0p1p2p be a string longer than p and in the language. Suppose we have a decomposition uvwxy, where |vwx|p, so uwx cannot include all three letters because it is too short.

then we pumped the string to uv2wx2y, which cannot be in the language. Because the letter that cannot be covered in uwx cannot get repeated then there is less numbers of it in the new string.

So uv2wx2y is not in the language, which contradicted to the pumping lemma.

An non-CFL that can be pumped

L={aibjckdl|if i=1 then j=k=l,i,j,k,l0}

L is not CFL

Suppose L is context free. We know that abcd is a regular language R. Then the intersection LR should also be context-free. However, LR={abjcjdj|j0}, which is not context-free. Contradiction.

L can be pumped

L=L1L2L3

L1={bjckdl|i,j,k0}

L2={abicidi|i0}

L3={aibjckdl|i,j,k,l0}

First of all, L1 and L3 are regular languages, so all strings in them can be pumped.

Let p be the pumping constant of L2, z=abpcpdp, no matter what the value of vwx is, the pumped string uv2wxwy can belong to L3, which is still in L. So L is pumpable.