You are on page 1of 11

TOC Lecture-15

Pumping Lemma for


Context Free Languages
Pumping Lemma for CFLs
• Pumping Lemma (for CFL) is used to prove that a language is
NOT Context Free.

• Theorem:

If L is a context free language, then L has a pumping length ‘P’


such that any string ‘S’ where |S| ≥ P may be divided into 5 parts
S = uvwxy such that the following conditions must be true:

1) | vx | ≥ 1
2) | vwx | ≤ P
3) uviwxiy ∈ L for every i ≥ 0
Steps to prove that a language is not Context
Free using Pumping Lemma
We prove using Contradiction
• Assume that L is regular
• It has to have a Pumping Length (say P)
• All strings longer than P can be pumped |S| ≥ P
• Now find a string ‘S’ ∈ L such that |S| ≥ P
• Divide S into uvwxy
• Show that uviwxiy ∉ L for some i
• Then consider all ways that S can be divided into uvwxy
• Show that none of these can satisfy all the 3 pumping lemma conditions at
the same time

• S cannot be pumped ⇒ Contradiction


Example-1
• Show that the language L = {an bn cn | n ≥ 0} is not context free.
Example-1 (contd.)
Example-1 (contd.)
Example-2
• Show that the language L = {ai bj ck | 0 ≤ i ≤ j ≤ k} is not context free.
Example-2 (contd.)
Example-3
• Show that the language L = {ww | w ∈ {0, 1}*} is not context free.
Example-3 (contd.)
Example-3 (contd.)

You might also like