next up previous contents
Next: The Pumping Lemma for Up: CONTEXT-FREE LANGUAGES Previous: Non-Deterministic CFLs   Contents

Proving that a Language is not Context-Free

Since context-free languages are so important, it is desirable to have some way of proving when a language isn't context-free. We did this for regular languages by choosing those which were ``big enough'' (ie. infinite) to cause a particular type of repetition (or periodicity) in their derivation. The nature of the ``pump'' (for regular expressions it was Kleene Closure) could then be used to characterise these languages.

So we consider some questions about context-free grammars:

Let us suppose that u, x and z are strings such that:

\begin{displaymath}\begin{array}{rcl}
S & \rightarrow^* & uAz \\
& and & \\
A & \rightarrow^* & x
\end{array}\end{displaymath}

and if, as assumed above, we have also that:

\begin{displaymath}\begin{array}{rcl}
A & \rightarrow^* & vAy
\end{array}\end{displaymath}

The it should be clear that for any $i \geq 0$:

\begin{displaymath}\begin{array}{ccccccccccc}
S & \rightarrow^* & uAz & \rightar...
...\rightarrow^* uv^iAy^iz & \rightarrow^* & uv^ixy^iz
\end{array}\end{displaymath}

Then we can generate the set $\{uxz, uvxyz, uv^2xy^2z, \ldots, uv^ixy^iz, \ldots\}$

Tying all this together we get:



Subsections
next up previous contents
Next: The Pumping Lemma for Up: CONTEXT-FREE LANGUAGES Previous: Non-Deterministic CFLs   Contents
James Power 2002-11-29