Explain about pumping lemma for context free language?

Data Structure AlgorithmsComputer ScienceComputers


Explain the pumping lemma for context free language by showing that the language of strings in the form xnynzn is not a context free language.


Pumping lemma (Context free grammar)

  • We can prove that a particular language is not context free grammar using pumping lemma.

  • Let’s take the concept of proof by contradiction

  • Here we assume that language is CFG

Conditions of pumping lemma

First of all consider a string and split into 5 parts those are pqrst it must satisfy the following conditions −

  • |qs|>=1

  • |qrs|=n (“ n” is pumping length)

  • pqirsit € L for different values of i

Let the L be the CF language.

Now we can take a string such that S={xnynzn}

We divide S in five parts.

Case 1 − let n=4 so S=x4y4z4

q and s each contain only one type of symbols


p=x , q=xx, r=xyyyyz, s=z, t=zz

Let take i=2


  • xxxxxxyyyyzzzzz

  • x6y4z5 ≠L

Because, it is not in the form of xnynzn

Updated on 16-Jun-2021 13:41:23