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 z∈L and |z|≥p then z can be decomposed into 5 parts: z=uvwxy. so that:
- |vwx|≤p
- vx≠ε
- ∀i,uviwxiy∈L
An non-CFL to prove that cannot be pumped
L={0n1n2n|n≥0}
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,l≥0}
L is not CFL
Suppose L is context free. We know that ab∗c∗d∗ is a regular language R. Then the intersection L∩R should also be context-free. However, L∩R={abjcjdj|j≥0}, which is not context-free. Contradiction.
L can be pumped
L=L1∪L2∪L3
L1={bjckdl|i,j,k≥0}
L2={abicidi|i≥0}
L3={aibjckdl|i,j,k,l≥0}
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.