“The pumping lemma, that monstrosity, is equivalent to the statement ‘every sufficiently-long walk over a finite graph contains a cycle.’ Not only is that intuitive, it’s obvious, unlike the pumping lemma.”
Hillel Wayne
We now consider a different method for proving a language is not regular. It starts with a definition that may seem odd, but turns out to be useful.
Given a language and a “pumping length” ,
we say a string (with ) can be
pumped if
If and ,
then can be pumped.
There are many ways to show this, including
In all cases for every .
If
and
then can be pumped.
There is exactly one way to do so, namely
Then for every .
If is the set of strings of balanced parentheses, and
then can be pumped.
There are two ways to do so
In both caes, for every .
The utility of this definition comes from the following fact:
If is a regular language, then there exists such that every string with can be pumped.
More importantly the contrapositive holds; if for every there is a string with that cannot be pumped, then is not regular.
That is, in a regular language, every string in that language (larger than some fixed size) can be pumped.
Equivalently, if a language contains arbitrarily long unpumpable strings (i.e., unpumpable strings with more than characters for any choice of ), then that language cannot be regular. We can use this fact to prove that many nonregular languages are nonregular.
(Warning: The Pumping Lemma does not say “if and only if.” The presence of long unpumpable strings proves a language is not regular, but the absence of such strings tells us nothing. There are regular and nonregular languages where all long strings are pumpable.)
The language is not regular.
Proof.
Let be given.
Put . Note that and .
To show: is not pumpable.
Let be any partition of into three parts with
and .
Then must consist of one or more a‘s.
So will have more a ’s than b’s, and
.
Thus no partition works to pump .
By the Pumping Lemma, is not regular.
The language is not regular.
Alternate Proof (with a less clever choice of ).
Let be given.
Put
. Note that
and .
To show: is not pumpable.
Let be any partition of into three parts with
and .
There are three cases to consider.
a’s, then will have more
a ’s than b’s, and b’s, then will have more
b’s than a’s, and a’s and b’s, then will not
have all its a’s before all its b’s, and
Thus no partition works to pump .
By the Pumping Lemma, is not regular.
The language is not regular.
Proof.
Let be given.
Put . Note that and .
To show: is not pumpable.
Let be any partition of into three parts with
and .
Then must consist of one or more a‘s.
So will have more a ’s than b’s, and
.
Thus no partition works to pump .
By the Pumping Lemma, is not regular.
The language is not regular.
Proof.
Let be given.
Put . Note that and .
To show: is not pumpable.
Let be any partition of into three parts with
and .
Then must consist of one or more 0‘s.
So will have more 0 ’s than 1’s, and
.
Thus no partition works to pump .
By the Pumping Lemma, is not regular.
The language is not regular.
Proof.
Let be given.
Put . Note that and .
To show: is not pumpable.
Let be any partition of into three parts with
and .
Then must consist of one or more 0‘s.
So will have fewer 0 ’s than 1’s, and .
Thus no partition works to pump .
By the Pumping Lemma, is not regular.
The language is not regular.
Proof.
Let be given.
Put . Note that and .
To show: is not pumpable.
Let be any partition of into three parts with
and .
Then must consist of one or more a‘s.
So will have more a ’s than b’s or c’s, and
.
Thus no partition works to pump .
By the Pumping Lemma, is not regular.
The language is not regular.
Proof.
Let be given.
Put . Note that and .
To show: is not pumpable.
Let be any partition of into three parts with
and .
Then must consist of one or more a‘s.
So will have more a ’s before the b than after, and
.
Thus no partition works to pump .
By the Pumping Lemma, is not regular.
We don’t need to know the proof of the Pumping Lemma in order to use it effectively. But it is not hard to see why it is true, once you know the trick
If is a regular language, then there exists such that every string with can be pumped.
Proof.
Suppose is a regular language.
Then there is a DFA whose language is .
Let be the number of states in that DFA.
Let be an arbitrary string in such that .
Obviously the DFA must accept .
But running through the DFA visits at least states, which
means that some state was visited at least twice (and at least one such
repetition happened within the first characters of the input).
That is, the string went through a loop on the way from the start
state to an accepting state.
Call the part of before the first loop , the part of that
takes us around the first loop , and call the rest of .
Then the strings take us through the DFA from the start state to
the same accepting state for every , because these strings take
the same path as except they avoid the loop entirely, or take the
loop multiple times.
Since all these strings are accepted, they must all belong to .
Thus, we have shown that is pumpable.
Since was an arbitrary string in with length ,
all such strings are pumpable.