Pumping lemma for CFG
The pumping lemma for
Formal theorem
The pumping lemma states:
For any context-free language L, there exists an integer n, such that for all
for all
The given rules mean that if two substrings from a string of a CFL are pumped i.e., parts w and y are repeated i number of times, it will still remain a part of the CFL.
The lemma gives a result in the form of a contradiction. We suppose that a given instance (string) of a language is context-free, and we contradict our supposition, as the pumped string will not be a part of the language.
Note: This lemma does not show if a language is context-free.
Steps of the lemma
The following steps are involved in applying lemma:
Given a context-free language, extract a string (instance) from it.
Divide the string into substrings such that
and . Find a suitable i where the pumped string does not remain a part of the language.
Examples
Let
and suppose L is context-free language.
Take
We divide u in such a way that
Taking i = 0:
As the string is not a part of the language, so we can say that our initial supposition is wrong and that the language L is non-context-free.
Let's take another example:
Take
We divide x in such a way that
Taking i = 0:
As the string is not a part of the language, so we can say that our initial supposition is wrong and that the language L is non-context-free.
Free Resources