pumping lemma for regular languages
to understand the power of finite automata, we must also understand their limitations. the puming lemma is used to prove that certain languages cannot be recognized by any finite automaton.
let's take the language
. if we attempt to find a dfa that recognizes
, we discover that the machine seems to need to remember how many 0s have been seen so far as it reads the input. because the number of 0s isn't limited, the machine will have to keep track of an unlimited number of possibilities. but it cannot do so with any finite number of states.
a technique for proving nonregularity stems from a theorem about regular languages, traditionally called the pumping lemma. this theorem states that all regular languages have a special property. if we can show that a language does not have this property, we are guaranteed that it is not regular. the property states that all strings in the language can be "pumped" if they are at least as long as a certain special value, called the pumping length. that means each such string contains a section that can be repeated any number of times with the resulting string remaining in the language.
is divided into
, either
or
may be
, but condition 2 says that
. observe that without condition 2 the theorem would be trivially true.
condition 3 states that the pieces
and
together have length at most
. it is an extra technical condition that we occasionally find useful when proving certain languages to be nonregular.
let's take the language
a technique for proving nonregularity stems from a theorem about regular languages, traditionally called the pumping lemma. this theorem states that all regular languages have a special property. if we can show that a language does not have this property, we are guaranteed that it is not regular. the property states that all strings in the language can be "pumped" if they are at least as long as a certain special value, called the pumping length. that means each such string contains a section that can be repeated any number of times with the resulting string remaining in the language.
if
is a regular language, then there is a number
(the pumping length) where if
is any string in
of length at least
, then
may be divided into three pieces,
, satisfying the following conditions:
represents the length of string
,
means that
copies of
are concatenated together, and
equals
.
[cite:@sipser_comp_2012 theorem 1.70]
when - for each
,
,
-
,
-
.
[cite:@sipser_comp_2012 theorem 1.70]
condition 3 states that the pieces
let
be the language
. we use the pumping lemma to prove that
is not regular. the proof is by contradiction. assume to the contrary that
is regular. let
be the pumping length given by the pumping lemma. choose
to be the string
. because
is a member of
and
has length more than
, the pumping lemma guarantees that
can be split into three pieces,
, where for any
the string
is in
. we consider three cases to show that this result is impossible.
is regular, so
is not regular. note that we can simplify this argument by applying condition 3 of the pumping lemma to eliminate cases 2 and 3.
in this example, finding the string
was easy because any string in
of length
or more would work. but often it isnt this trivial.
[cite:@sipser_comp_2012 example 1.73]
- the string
consists only of 0s. in this case, the string
has more 0s than 1s and so is not a member of
, violating condition 1 of the pumping lemma. this case is a contradiction.
- the string
consists only of 1s. this case also gives a contradiction.
- the string
consists of both 0s and 1s. in this case, the string
may have the same number of 0s and 1s, but they will be out of order with some 1s before 0s. hence it is not a member of B, which is a contradiction.
in this example, finding the string
[cite:@sipser_comp_2012 example 1.73]
let
. we use the pumping lemma to prove that
is not regular. the proof is by contradiction.
assume to the contrary that
is regular. let
be the pumping length given by the pumping lemma. consider the string
, if
, then
must consist only of 0s, so
. therefore,
cannot be pumped. that gives us the desired contradiction.
[cite:@sipser_comp_2012 example 1.74]
assume to the contrary that
[cite:@sipser_comp_2012 example 1.74]
[cite:@sipser_comp_2012 example 1.75]
[cite:@sipser_comp_2012 chapter 1.4 nonregular languages]given
defined by
prove that
isnt regular.
assume in contradiction that
is regular, let
be the pumping length provided by the pumping lemma, for every string
, since
,
has to be all
's but if we consider the result
we see that pumping isnt possible, which gives us the necessary contradiction and so the language isnt regular.
prove that
is nonregular.
i was challenging my understanding when i wrote this solution, trying to get a better grasp of the method.
it seems that by picking a string like prove that
is nonregular.
as usual, a proof by contradiction, assume
is regular so that the pumping lemma holds, let
be the pumping length provided by the pumping lemma, consider the string of length
, this string cannot be pumped, because any string of length
where
isnt in
because the next longest string after that of length
is gonna be of length
, and
is smaller than
for
. so
must be nonregular because assuming it is causes a contradiction.
given the language
does it pertain the pumping lemma? is it regular?
is
regular?

given
where
is regular but
isnt. prove that
isnt regular.
given

given
:

pertains the pumping lemma for regular languages. try to find
equivalence classes.