Pumping Lemma
Pumping Lemma
Pumping Lemma
Regular Languages
Nonregular languages
.
Nonregular languages
.
Nonregular languages
.
Nonregular languages
.
Example:
has an equal number of 0s and 1s
Example:
has an equal number of 0s and 1s not regular
Example:
has equal no of 01 and 10 substrings
Example:
has equal no of 01 and 10 substrings regular
Language nonregularity
The technique for proving nonregularity of some
language is provided by a theorem about regular
languages called pumping lemma
Language nonregularity
The technique for proving nonregularity of some
language is provided by a theorem about regular
languages called pumping lemma
Pumping lemma states that all regular languages have
a special property
Language nonregularity
The technique for proving nonregularity of some
language is provided by a theorem about regular
languages called pumping lemma
Pumping lemma 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 is not regular.
Observation
Pumping lemma states that all regular languages have a
special property.
Observation
Pumping lemma states that all regular languages have a
special property.
Pumping lemma does not state that only regular languages
have this property. Hence, the property used to prove that
a language is not regular does not ensure that language
is regular.
Observation
Pumping lemma states that all regular languages have a
special property.
Pumping lemma does not state that only regular languages
have this property. Hence, the property used to prove that
a language is not regular does not ensure that language
is regular.
Consequence: A language may not be regular and still have
strings that have all the properties of regular languages.
Pumping property
All strings in the language can be pumped" if they are at
least as long as a certain value, called the pumping length
Pumping property
All strings in the language can be pumped" if they are at
least as long as a certain value, called the pumping length
Meaning: each such string in the language contains a section that can be repeated any number of times with the resulting string remaining in the language.
Theorem 1.70
Theorem 1.70
of length at least ,
If
Theorem 1.70
is any string in
If
Theorem 1.70
of length at least ,
1. for each
If
Theorem 1.70
of length at least ,
2.
1. for each
If
Theorem 1.70
of length at least ,
3.
2.
1. for each
If
Recall that
means that
Interpretation
may be , but
or
, either
When
Recall that
means that
Interpretation
may be , but
Without condition
or
, either
When
Recall that
means that
Interpretation
Let
Proof idea
be a DFA that recognizes
Let
Proof idea
to be the number of states of
Let
Proof idea
More ideas
and
, consider a sequence of states that
goes through to accept , example:
If
More ideas
and
, consider a sequence of states that
goes through to accept , example:
then the
must be final;if
is
Since
accepts ,
length of
If
More ideas
and
, consider a sequence of states that
goes through to accept , example:
If
it result that
and
then the
must be final;if
is
Because
Since
accepts ,
length of
More ideas
and
, consider a sequence of states that
goes through to accept , example:
If
it result that
and
then the
must be final;if
is
Because
Since
accepts ,
length of
By pigeonhole principle:
More ideas
and
, consider a sequence of states that
goes through to accept , example:
If
it result that
and
then the
must be final;if
is
Because
Since
accepts ,
length of
By pigeonhole principle:
- If p pigeons are placed into fewer than p holes, some holes must
hold more than one pigeon
More ideas
and
, consider a sequence of states that
goes through to accept , example:
If
then the
it result that
and
must be final;if
is
Because
Since
accepts ,
length of
By pigeonhole principle:
the sequence
state, see Figure 1
- If p pigeons are placed into fewer than p holes, some holes must
hold more than one pigeon
repeats when
reads
Figure 1: State
Recognition sequence
Divide
is the part of
appearing before
Piece
Divide
is the part of
appearing before
is the part of
Piece
Piece
Divide
Piece
appearing before
is the part of
is the part of
Piece
is the part of
Piece
Divide
Piece
appearing before
is the part of
is the part of
Piece
is the part of
Piece
Divide
In other words:
Piece
appearing before
is the part of
is the part of
Piece
is the part of
Piece
Divide
from
to
takes
In other words:
,
Piece
appearing before
is the part of
is the part of
Piece
is the part of
Piece
Divide
from
to
takes
to
from
takes
In other words:
,
,
Piece
appearing before
is the part of
is the part of
Piece
is the part of
Piece
Divide
to
from
takes
to
,
,
from
to
takes
from
takes
In other words:
Note
The division specified above satisfies the 3 conditions
on
Observations
, and in
which is also
on
Observations
, and in
which is also
on
Observations
is
Condition 2: Since
, state is repeated. Then because
.
the part between two successive occurrences of ,
, and in
which is also
on
Observations
is
Condition 2: Since
, state is repeated. Then because
.
the part between two successive occurrences of ,
Let
be a DFA that has states and
recognizes . Let
be a string over of
length
. Let
be the sequence of states
,
while processing , i.e.,
elements in
.
Let
be a DFA that has states and
recognizes . Let
be a string over of
length
. Let
be the sequence of states
,
while processing , i.e.,
elements in
.
Let
be a DFA that has states and
recognizes . Let
be a string over of
length
. Let
be the sequence of states
,
while processing , i.e.,
Now let
elements in
.
Let
be a DFA that has states and
recognizes . Let
be a string over of
length
. Let
be the sequence of states
,
while processing , i.e.,
Note
for
to , and takes
must accept
,
takes
from to , takes
from
from to
, which is an accept state,
As
Note
, so
We know that
for
to , and takes
must accept
,
takes
from to , takes
from
from to
, which is an accept state,
As
Note
, so
;
, so
We know that
for
to , and takes
must accept
,
takes
from to , takes
from
from to
, which is an accept state,
As
Note
, so
;
, so
We know that
for
to , and takes
must accept
,
takes
from to , takes
from
from to
, which is an accept state,
As
is regular.
3. Find
,
, that cannot be pumped: demonstrate that
cannot be pumped by considering all ways of dividing into , , ,
showing that for each division one of the pumping lemma
, (2)
, (3)
, fails.
conditions, (1)
Observations
The existence of contradicts pumping lemma, hence
cannot be regular
Observations
The existence of contradicts pumping lemma, hence
cannot be regular
Finding sometimes takes a bit of creative thinking.
Experimentation is suggested
Applications
is not regular
; obviously
lemma
. Choose
is not regular
Assume that
Applications
Example, continuation
Consider the cases:
Example, continuation
Consider the cases:
1.
Example, continuation
Consider the cases:
1.
2.
Example, continuation
Consider the cases:
1.
3.
2.
Example, continuation
Consider the cases:
1.
3.
2.
is regular so
is not regular
Prove that
is not regular
Example 2
has an equal number of 0s and 1s
is regular and
for any
, where
with
that
Let
Prove that
is not regular
Example 2
Note
Note
and
Note
and
If
then must consists of only s, so
there are more 1-s than 0-s.
because
Note
and
If
then must consists of only s, so
there are more 1-s than 0-s.
because
for any
Then
Selecting
Other selections
An alternative method
Use the fact that
is nonregular.
An alternative method
Use the fact that
If
is nonregular.
An alternative method
Use the fact that
But
If
is nonregular.
An alternative method
Use the fact that
Hence,
But
If
is nonregular.
is nonregular using
Show that
pumping lemma
Example 3
is nonregular using
Show that
pumping lemma
Example 3
. Since
Consider
Note
Note
The string
nonregularity of
Note
The string
nonregularity of
If we chose, say
can be pumped
Show that
Example 4
is nonregular.
Show that
Example 4
is nonregular.
can be split,
If
If
By pumping lemma
and
are both perfect
we can see that they
squares. But letting
,
cannot be both perfect square if
because they would be too close together.
. Then
Let
Example 5
Sometimes pumping down" is useful when we apply
pumping lemma.
Example 5
Sometimes pumping down" is useful when we apply
pumping lemma.
Example 5
Sometimes pumping down" is useful when we apply
pumping lemma.
; From decomposition
, from
it results that consists only of 0s.
Let
condition 3,
; From decomposition
, from
it results that consists only of 0s.
Let
condition 3,
Let us examine
to see if it is in . Adding an
extra-copy of increases the number of zeros. Since
contains all strings
that have more 0s than 1s, it
will still give a string in
; From decomposition
, from
it results that consists only of 0s.
Let
condition 3,
Let us examine
to see if it is in . Adding an
extra-copy of increases the number of zeros. Since
contains all strings
that have more 0s than 1s, it
will still give a string in
, consider
even when
and
Since
, consider
even when
and
Since
, consider
even when
and
Since
cannot have
cannot be in
and
, consider
even when
and
Since
cannot have
cannot be in
and
is the smallest
Consider
Example
. The minimum pumping length for
is 2.
is 2.
where
and
string
Consider
Example
is 2.
Problem 1
.
is 4.
but
Reason:
Problem 1
and
. If
the division
can be pumped by
Problem 2
.
Problem 2
.
is 1.
is 1.
of
and
cannot be 0 because is
Problem 2
first character
the rest of .
Problem 3
Problem 3
Problem 3
and
we can write is as
we can write it as
is generated by
If
is generated by
of length at least 3. If
is in the
is 3.
is the remainder of .