- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Explain Pumping lemma for context free language

Pumping lemma for context free language (CFL) is used to prove that a language is not a Context free language

Assume L is context free language

Then there is a pumping length n such that any string w εL of length>=n can be written as follows −

|w|>=n

We can break w into 5 strings, w=uvxyz, such as the ones given below

- |vxy| >=n
- |vy| # ε
- For all k>=0, the string uv
^{k}xy^{y}z∈L

The steps to prove that the language is not a context free by using pumping lemma are explained below −

- Assume that L is context free.
- The pumping length is n.
- All strings longer than n can be pumped |w|>=n.
- Now find a string 'w' in L such that |w|>=n.
- Divide w into uvxyz
- Show that uv
^{k}xy^{k}z ∉L for some k - Then, consider the ways that w can be divided into uvxyz.
- Show that none of these can satisfy all the 3 pumping conditions at same time.
- w cannot be pumped (contradiction).

## Example

Find out whether L={x^{n}yn^{z}n|n>=1} is context free or not

## Solution

- Let L be context free.
- L must satisfy pumping length, say n.
- Now we can take a string such that s=x
^{n}y^{n}z^{n} - We divide s into 5 strings uvxyz.

Let n=4 so, s=x^{4}y^{4}z^{4}

## Case 1:

v and y each contain only one type of symbol.

{we are considering only v and y because v and y has power uv^{2}xy^{2}z}

X xx x yyyyz z zz

=uv^{k}xy^{k}z when k=2

=uv^{2}xy^{2}z

=xxxxxxyyyyzzzzz

=x^{6}y^{4}z^{5}

(Number of x # number of y #number of z)

Therefore,The resultant string is not satisfying the condition

x^{6}y^{4}z^{5} ∉ L

If one case fails then no need to check another condition.

## Case 2:

Either v or y has more than one kind of symbols

Xx xx yy y y zzzz

=uv^{k}xy^{k}z (k=2)

=uv^{2}xy^{2}z

=xxxxyyxxyyyyyzzzz

=x^{4}y^{2}x^{2}y^{5}z^{2}

This string is not following the pattern of our string x^{n}y^{n}z^{n}

- Related Questions & Answers
- Explain about pumping lemma for context free language?
- What is pumping lemma for regular language?
- What is the pumping lemma for regular language?
- Explain the context free language closure under concatenation?
- Explain the context free language closure under union operation?
- Explain about CYK Algorithm for Context Free Grammar
- How to generate the language for context free grammar?
- What are the closure properties for context free language?
- What is context free grammar? Explain with examples
- Explain removing unit productions in context free grammar
- Generate a Context-free grammar for the language L = {anbm| m≠n}?
- Explain the simplification of context free grammar in TOC
- Generate a CNF for a given context free grammar
- What is Context-Free Grammar?
- Give the examples of a context free language that are not regular?