1-Pumping Lemma (1)
-
Upload
zuhair-anwar -
Category
Documents
-
view
219 -
download
0
Transcript of 1-Pumping Lemma (1)
-
8/8/2019 1-Pumping Lemma (1)
1/126
The Pumping Lemma forRegular Languages
The Pumping Lemma forRegular Languages p.1/3
-
8/8/2019 1-Pumping Lemma (1)
2/126
Nonregular languages
Consider the language
.
The Pumping Lemma forRegular Languages p.2/3
-
8/8/2019 1-Pumping Lemma (1)
3/126
Nonregular languages
Consider the language
.
If we attempt to find a DFA that recognizes
we discover thatsuch a machine needs to remember how many
s have been
seen so far as it reads the input
The Pumping Lemma forRegular Languages p.2/3
-
8/8/2019 1-Pumping Lemma (1)
4/126
Nonregular languages
Consider the language
.
If we attempt to find a DFA that recognizes
we discover thatsuch a machine needs to remember how many
s have been
seen so far as it reads the input
Because the number of
s isnt limited, the machine needs tokeep track of an unlimited number of possibilities
The Pumping Lemma forRegular Languages p.2/3
-
8/8/2019 1-Pumping Lemma (1)
5/126
Nonregular languages
Consider the language
.
If we attempt to find a DFA that recognizes
we discover thatsuch a machine needs to remember how many
s have been
seen so far as it reads the input
Because the number of
s isnt limited, the machine needs tokeep track of an unlimited number of possibilities
This cannot be done with any finite number of states
The Pumping Lemma forRegular Languages p.2/3
-
8/8/2019 1-Pumping Lemma (1)
6/126
Intuition may fail us
Just because a language appears to require
unbounded memory to be recognized, it doesnt meanthat it is necessarily so
The Pumping Lemma forRegular Languages p.3/3
-
8/8/2019 1-Pumping Lemma (1)
7/126
Intuition may fail us
Just because a language appears to require
unbounded memory to be recognized, it doesnt meanthat it is necessarily so
Example:
The Pumping Lemma forRegular Languages p.3/3
-
8/8/2019 1-Pumping Lemma (1)
8/126
Intuition may fail us
Just because a language appears to require
unbounded memory to be recognized, it doesnt meanthat it is necessarily so
Example:
has an equal number of 0s and 1s
The Pumping Lemma forRegular Languages p.3/3
-
8/8/2019 1-Pumping Lemma (1)
9/126
Intuition may fail us
Just because a language appears to require
unbounded memory to be recognized, it doesnt meanthat it is necessarily so
Example:
has an equal number of 0s and 1s
not regular
The Pumping Lemma forRegular Languages p.3/3
-
8/8/2019 1-Pumping Lemma (1)
10/126
Intuition may fail us
Just because a language appears to require
unbounded memory to be recognized, it doesnt meanthat it is necessarily so
Example:
has an equal number of 0s and 1s
not regular
has equal no of 01 and 10 substrings
The Pumping Lemma forRegular Languages p.3/3
-
8/8/2019 1-Pumping Lemma (1)
11/126
Intuition may fail us
Just because a language appears to require
unbounded memory to be recognized, it doesnt meanthat it is necessarily so
Example:
has an equal number of 0s and 1s
not regular
has equal no of 01 and 10 substrings
regular
The Pumping Lemma forRegular Languages p.3/3
-
8/8/2019 1-Pumping Lemma (1)
12/126
Language nonregularity
The technique for proving nonregularity of some
language is provided by a theorem about regularlanguages called pumping lemma
The Pumping Lemma forRegular Languages p.4/3
-
8/8/2019 1-Pumping Lemma (1)
13/126
Language nonregularity
The technique for proving nonregularity of some
language is provided by a theorem about regularlanguages called pumping lemma
Pumping lemma states that all regular languages have
a special property
The Pumping Lemma forRegular Languages p.4/3
-
8/8/2019 1-Pumping Lemma (1)
14/126
Language nonregularity
The technique for proving nonregularity of some
language is provided by a theorem about regularlanguages 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.
The Pumping Lemma forRegular Languages p.4/3
-
8/8/2019 1-Pumping Lemma (1)
15/126
Observation
Pumping lemma states that all regular languages have a
special property.
The Pumping Lemma forRegular Languages p.5/3
-
8/8/2019 1-Pumping Lemma (1)
16/126
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.
The Pumping Lemma forRegular Languages p.5/3
-
8/8/2019 1-Pumping Lemma (1)
17/126
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.
The Pumping Lemma forRegular Languages p.5/3
-
8/8/2019 1-Pumping Lemma (1)
18/126
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
The Pumping Lemma forRegular Languages p.6/3
-
8/8/2019 1-Pumping Lemma (1)
19/126
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 sec-
tion that can be repeated any number of times with the re-sulting string remaining in the language.
The Pumping Lemma forRegular Languages p.6/3
-
8/8/2019 1-Pumping Lemma (1)
20/126
Theorem 1.70
Pumping Lemma: If
is a regular language, then there is
a pumping length
such that:
The Pumping Lemma forRegular Languages p.7/3
-
8/8/2019 1-Pumping Lemma (1)
21/126
Theorem 1.70
Pumping Lemma: If
is a regular language, then there is
a pumping length
such that:
If is any string in
of length at least ,
The Pumping Lemma forRegular Languages p.7/3
-
8/8/2019 1-Pumping Lemma (1)
22/126
Theorem 1.70
Pumping Lemma: If
is a regular language, then there is
a pumping length
such that:
If is any string in
of length at least ,
Then may be divided into three pieces, ,
satisfying the following conditions:
The Pumping Lemma forRegular Languages p.7/3
-
8/8/2019 1-Pumping Lemma (1)
23/126
Theorem 1.70
Pumping Lemma: If
is a regular language, then there is
a pumping length
such that:
If is any string in
of length at least ,
Then may be divided into three pieces, ,
satisfying the following conditions:
1. for each
,
The Pumping Lemma forRegular Languages p.7/3
-
8/8/2019 1-Pumping Lemma (1)
24/126
Theorem 1.70
Pumping Lemma: If
is a regular language, then there is
a pumping length
such that:
If is any string in
of length at least ,
Then may be divided into three pieces, ,
satisfying the following conditions:
1. for each
,
2.
The Pumping Lemma forRegular Languages p.7/3
-
8/8/2019 1-Pumping Lemma (1)
25/126
Theorem 1.70
Pumping Lemma: If
is a regular language, then there is
a pumping length
such that:
If is any string in
of length at least ,
Then may be divided into three pieces, ,
satisfying the following conditions:
1. for each
,
2.
3.
The Pumping Lemma forRegular Languages p.7/3
-
8/8/2019 1-Pumping Lemma (1)
26/126
Interpretation
Recall that
represents the length of string and
means that
may be concatenated
times, and
The Pumping Lemma forRegular Languages p.8/3
-
8/8/2019 1-Pumping Lemma (1)
27/126
Interpretation
Recall that
represents the length of string and
means that
may be concatenated
times, and
When , either or may be , but
The Pumping Lemma forRegular Languages p.8/3
-
8/8/2019 1-Pumping Lemma (1)
28/126
Interpretation
Recall that
represents the length of string and
means that
may be concatenated
times, and
When , either or may be , but
Without condition
theorem would be trivially true
The Pumping Lemma forRegular Languages p.8/3
-
8/8/2019 1-Pumping Lemma (1)
29/126
Proof idea
Let
be a DFA that recognizes
The Pumping Lemma forRegular Languages p.9/3
-
8/8/2019 1-Pumping Lemma (1)
30/126
Proof idea
Let
be a DFA that recognizes
Assign a pumping length
to be the number of states of
The Pumping Lemma forRegular Languages p.9/3
-
8/8/2019 1-Pumping Lemma (1)
31/126
Proof idea
Let
be a DFA that recognizes
Assign a pumping length
to be the number of states of
Show that any string
,
may be broken into three
pieces satisfying the pumping lemmas conditions
The Pumping Lemma forRegular Languages p.9/3
-
8/8/2019 1-Pumping Lemma (1)
32/126
More ideas
If
and
, consider a sequence of states that
goes through to accept
, example:
The Pumping Lemma forRegular Languages p.10/3
-
8/8/2019 1-Pumping Lemma (1)
33/126
More ideas
If
and
, consider a sequence of states that
goes through to accept
, example:
Since accepts , must be fi nal;if
then the
length of is
The Pumping Lemma forRegular Languages p.10/3
-
8/8/2019 1-Pumping Lemma (1)
34/126
More ideas
If
and
, consider a sequence of states that
goes through to accept
, example:
Since accepts , must be fi nal;if
then the
length of is
Because
and
it result that
.
The Pumping Lemma forRegular Languages p.10/3
-
8/8/2019 1-Pumping Lemma (1)
35/126
More ideas
If
and
, consider a sequence of states that
goes through to accept
, example:
Since accepts , must be fi nal;if
then the
length of is
Because
and
it result that
.
By pigeonhole principle:
The Pumping Lemma forRegular Languages p.10/3
-
8/8/2019 1-Pumping Lemma (1)
36/126
More ideas
If
and
, consider a sequence of states that
goes through to accept
, example:
Since accepts , must be fi nal;if
then the
length of is
Because
and
it result that
.
By pigeonhole principle:
- If p pigeons are placed into fewer than p holes, some holes musthold more than one pigeon
The Pumping Lemma forRegular Languages p.10/3
-
8/8/2019 1-Pumping Lemma (1)
37/126
More ideas
If
and
, consider a sequence of states that
goes through to accept
, example:
Since accepts , must be fi nal;if
then the
length of is
Because
and
it result that
.
By pigeonhole principle:
- If p pigeons are placed into fewer than p holes, some holes musthold more than one pigeon
the sequence must contain a repeated
state, see Figure 1
The Pumping Lemma forRegular Languages p.10/3
-
8/8/2019 1-Pumping Lemma (1)
38/126
Recognition sequence
Figure 1: State repeats when reads
The Pumping Lemma forRegular Languages p.11/3
-
8/8/2019 1-Pumping Lemma (1)
39/126
More ideas, continuation
Divide in to the three pieces: , , and
The Pumping Lemma forRegular Languages p.12/3
-
8/8/2019 1-Pumping Lemma (1)
40/126
More ideas, continuation
Divide in to the three pieces: , , and
Piece
is the part of
appearing before
The Pumping Lemma forRegular Languages p.12/3
-
8/8/2019 1-Pumping Lemma (1)
41/126
More ideas, continuation
Divide in to the three pieces: , , and
Piece is the part of appearing before
Piece is the part of between two appearances of
The Pumping Lemma forRegular Languages p.12/3
-
8/8/2019 1-Pumping Lemma (1)
42/126
More ideas, continuation
Divide in to the three pieces: , , and
Piece is the part of appearing before
Piece is the part of between two appearances of
Piece is the part of after the 2nd appearance of
The Pumping Lemma forRegular Languages p.12/3
-
8/8/2019 1-Pumping Lemma (1)
43/126
More ideas, continuation
Divide in to the three pieces: , , and
Piece is the part of appearing before
Piece is the part of between two appearances of
Piece is the part of after the 2nd appearance of
In other words:
The Pumping Lemma forRegular Languages p.12/3
M id i i
-
8/8/2019 1-Pumping Lemma (1)
44/126
More ideas, continuation
Divide in to the three pieces: , , and
Piece is the part of appearing before
Piece is the part of between two appearances of
Piece is the part of after the 2nd appearance of
In other words:
takes
from to ,
The Pumping Lemma forRegular Languages p.12/3
M id i i
-
8/8/2019 1-Pumping Lemma (1)
45/126
More ideas, continuation
Divide in to the three pieces: , , and
Piece is the part of appearing before
Piece is the part of between two appearances of
Piece is the part of after the 2nd appearance of
In other words:
takes
from to ,
takes
from to ,
The Pumping Lemma forRegular Languages p.12/3
M id ti ti
-
8/8/2019 1-Pumping Lemma (1)
46/126
More ideas, continuation
Divide in to the three pieces: , , and
Piece is the part of appearing before
Piece is the part of between two appearances of
Piece is the part of after the 2nd appearance of
In other words:
takes
from to ,
takes
from to ,
takes
from to
The Pumping Lemma forRegular Languages p.12/3
N t
-
8/8/2019 1-Pumping Lemma (1)
47/126
Note
The division specifi ed above satisfi es the 3 conditions
The Pumping Lemma forRegular Languages p.13/3
Ob ti
-
8/8/2019 1-Pumping Lemma (1)
48/126
Observations
Suppose that we run on
The Pumping Lemma forRegular Languages p.14/3
Ob ti
-
8/8/2019 1-Pumping Lemma (1)
49/126
Observations
Suppose that we run on
Condition 1: it is obvious that
accepts , , and in
general
for all
. For
,
which is also
accepted because takes
to
The Pumping Lemma forRegular Languages p.14/3
Observations
-
8/8/2019 1-Pumping Lemma (1)
50/126
Observations
Suppose that we run on
Condition 1: it is obvious that
accepts , , and in
general
for all
. For
,
which is also
accepted because takes
to
Condition 2: Since
, state is repeated. Then because is
the part between two successive occurrences of ,
.
The Pumping Lemma forRegular Languages p.14/3
Observations
-
8/8/2019 1-Pumping Lemma (1)
51/126
Observations
Suppose that we run on
Condition 1: it is obvious that
accepts , , and in
general
for all
. For
,
which is also
accepted because takes
to
Condition 2: Since
, state is repeated. Then because is
the part between two successive occurrences of ,
.
Condition 3: makes sure that is the first repetition in the
sequence. Then by pigeonhole principle, the first
states in
the sequence must contain a repetition. Therefore,
The Pumping Lemma forRegular Languages p.14/3
Pumping lemmas proof
-
8/8/2019 1-Pumping Lemma (1)
52/126
Pumping lemmas proof
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.,
,
The Pumping Lemma forRegular Languages p.15/3
Pumping lemmas proof
-
8/8/2019 1-Pumping Lemma (1)
53/126
Pumping lemma s proof
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.,
,
and among the first
elements in
two must be the same state, say .
The Pumping Lemma forRegular Languages p.15/3
Pumping lemmas proof
-
8/8/2019 1-Pumping Lemma (1)
54/126
Pumping lemma s proof
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.,
,
and among the first
elements in
two must be the same state, say .
Because occurs among the first
places in the sequence
starting at
, we have
The Pumping Lemma forRegular Languages p.15/3
Pumping lemmas proof
-
8/8/2019 1-Pumping Lemma (1)
55/126
Pumping lemma s proof
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.,
,
and among the first
elements in
two must be the same state, say .
Because occurs among the first
places in the sequence
starting at
, we have
Now let , , .
The Pumping Lemma forRegular Languages p.15/3
Note
-
8/8/2019 1-Pumping Lemma (1)
56/126
Note
As takes
from to , takes
from to , and takes
from to , which is an accept state,
must accept
,
for
The Pumping Lemma forRegular Languages p.16/3
Note
-
8/8/2019 1-Pumping Lemma (1)
57/126
Note
As takes
from to , takes
from to , and takes
from to , which is an accept state,
must accept
,
for
We know that
, so
;
The Pumping Lemma forRegular Languages p.16/3
-
8/8/2019 1-Pumping Lemma (1)
58/126
Note
-
8/8/2019 1-Pumping Lemma (1)
59/126
Note
As takes
from to , takes
from to , and takes
from to , which is an accept state,
must accept
,
for
We know that
, so
;
We also know that
, so
Thus, all conditions are satisfi ed and lemma is proven
The Pumping Lemma forRegular Languages p.16/3
Before using lemma
-
8/8/2019 1-Pumping Lemma (1)
60/126
Before using lemma
Note: To use this lemma we must also ensure that if the
property stated by the pumping lemma is true then the
language is regular.
The Pumping Lemma forRegular Languages p.17/3
Before using lemma
-
8/8/2019 1-Pumping Lemma (1)
61/126
Before using lemma
Note: To use this lemma we must also ensure that if the
property stated by the pumping lemma is true then the
language is regular.
Proof: assuming that each element of language
satisfi es
the three conditions stated in pumping lemma we caneasily construct a FA that recognizes
, that is,
is regular.
The Pumping Lemma forRegular Languages p.17/3
Before using lemma
-
8/8/2019 1-Pumping Lemma (1)
62/126
Before using lemma
Note: To use this lemma we must also ensure that if the
property stated by the pumping lemma is true then the
language is regular.
Proof: assuming that each element of language
satisfi es
the three conditions stated in pumping lemma we caneasily construct a FA that recognizes
, that is,
is regular.
Note: if only some elements of
satisfy the three conditions it does not
mean that
is regular.
The Pumping Lemma forRegular Languages p.17/3
Using pumping lemma (PL)
-
8/8/2019 1-Pumping Lemma (1)
63/126
Using pumping lemma (PL)
Proving that a language
is not regular using PL:
The Pumping Lemma forRegular Languages p.18/3
Using pumping lemma (PL)
-
8/8/2019 1-Pumping Lemma (1)
64/126
g p p g ( )
Proving that a language
is not regular using PL:
1. Assume that
is regular in order to obtain a contradiction
The Pumping Lemma forRegular Languages p.18/3
Using pumping lemma (PL)
-
8/8/2019 1-Pumping Lemma (1)
65/126
g p p g ( )
Proving that a language
is not regular using PL:
1. Assume that
is regular in order to obtain a contradiction
2. The pumping lemma guarantees the existence of a pumping
length s.t. all strings of length or greater in
can be pumped
The Pumping Lemma forRegular Languages p.18/3
Using pumping lemma (PL)
-
8/8/2019 1-Pumping Lemma (1)
66/126
g p p g ( )
Proving that a language
is not regular using PL:
1. Assume that
is regular in order to obtain a contradiction
2. The pumping lemma guarantees the existence of a pumping
length s.t. all strings of length or greater in
can be pumped
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
conditions, (1)
, (2)
, (3)
, fails.
The Pumping Lemma forRegular Languages p.18/3
Observations
-
8/8/2019 1-Pumping Lemma (1)
67/126
The existence of contradicts pumping lemma, hence
cannot be regular
The Pumping Lemma forRegular Languages p.19/3
Observations
-
8/8/2019 1-Pumping Lemma (1)
68/126
The existence of contradicts pumping lemma, hence
cannot be regular
Finding sometimes takes a bit of creative thinking.
Experimentation is suggested
The Pumping Lemma forRegular Languages p.19/3
Applications
-
8/8/2019 1-Pumping Lemma (1)
69/126
pp
Example 1: prove that
is not regular
The Pumping Lemma forRegular Languages p.20/3
Applications
-
8/8/2019 1-Pumping Lemma (1)
70/126
Example 1: prove that
is not regular
Assume that
is regular and let
be the pumping length of
. Choose
; obviously
. By pumping
lemma such that for any
,
The Pumping Lemma forRegular Languages p.20/3
Example, continuation
-
8/8/2019 1-Pumping Lemma (1)
71/126
Consider the cases:
The Pumping Lemma forRegular Languages p.21/3
Example, continuation
-
8/8/2019 1-Pumping Lemma (1)
72/126
Consider the cases:
1. consists of
s only. In this case has more
s than
s and
so it is not in
, violating condition 1
The Pumping Lemma forRegular Languages p.21/3
Example, continuation
-
8/8/2019 1-Pumping Lemma (1)
73/126
Consider the cases:
1. consists of
s only. In this case has more
s than
s and
so it is not in
, violating condition 1
2. consists of
s only. This leads to the same contradiction
The Pumping Lemma forRegular Languages p.21/3
Example, continuation
-
8/8/2019 1-Pumping Lemma (1)
74/126
Consider the cases:
1. consists of
s only. In this case has more
s than
s and
so it is not in
, violating condition 1
2. consists of
s only. This leads to the same contradiction
3. consists of
s and
s. In this case may have the same
number of
s and
s but they are out of order with some
s before
some
s hence it cannot be in
either
The Pumping Lemma forRegular Languages p.21/3
Example, continuation
-
8/8/2019 1-Pumping Lemma (1)
75/126
Consider the cases:
1. consists of
s only. In this case has more
s than
s and
so it is not in
, violating condition 1
2. consists of
s only. This leads to the same contradiction
3. consists of
s and
s. In this case may have the same
number of
s and
s but they are out of order with some
s before
some
s hence it cannot be in
either
The contradiction is unavoidable if we make the assumptionthat
is regular so
is not regular
The Pumping Lemma forRegular Languages p.21/3
Example 2
-
8/8/2019 1-Pumping Lemma (1)
76/126
Prove that
has an equal number of 0s and 1s
is not regular
The Pumping Lemma forRegular Languages p.22/3
Example 2
-
8/8/2019 1-Pumping Lemma (1)
77/126
Prove that
has an equal number of 0s and 1s
is not regular
Proof: assume that
is regular and is its pumping length.
Let
with
. Then pumping lemma guarantees
that , where
for any
.
The Pumping Lemma forRegular Languages p.22/3
Note
-
8/8/2019 1-Pumping Lemma (1)
78/126
If we take the division ,
it seems thatindeed, no contradiction occurs. However:
The Pumping Lemma forRegular Languages p.23/3
Note
-
8/8/2019 1-Pumping Lemma (1)
79/126
If we take the division ,
it seems thatindeed, no contradiction occurs. However:
Condition 3 states that
, and in our case
and
. Hence,
cannot be pumped
The Pumping Lemma forRegular Languages p.23/3
Note
-
8/8/2019 1-Pumping Lemma (1)
80/126
If we take the division ,
it seems thatindeed, no contradiction occurs. However:
Condition 3 states that
, and in our case
and
. Hence,
cannot be pumped
If
then must consists of only
s, so
because
there are more 1-s than 0-s.
The Pumping Lemma forRegular Languages p.23/3
Note
-
8/8/2019 1-Pumping Lemma (1)
81/126
If we take the division ,
it seems thatindeed, no contradiction occurs. However:
Condition 3 states that
, and in our case
and
. Hence,
cannot be pumped
If
then must consists of only
s, so
because
there are more 1-s than 0-s.
This gives us the desired contradiction
The Pumping Lemma forRegular Languages p.23/3
Other selections
-
8/8/2019 1-Pumping Lemma (1)
82/126
Selecting
leads us to trouble because this string
can be pumped by the division: ,
,
.
Then
for any
The Pumping Lemma forRegular Languages p.24/3
An alternative method
-
8/8/2019 1-Pumping Lemma (1)
83/126
Use the fact that
is nonregular.
The Pumping Lemma forRegular Languages p.25/3
An alternative method
-
8/8/2019 1-Pumping Lemma (1)
84/126
Use the fact that
is nonregular.
If
were regular then
would also be regular because
is regular and
of regular languages is a regular language.
The Pumping Lemma forRegular Languages p.25/3
An alternative method
-
8/8/2019 1-Pumping Lemma (1)
85/126
Use the fact that
is nonregular.
If
were regular then
would also be regular because
is regular and
of regular languages is a regular language.
But
which is not regular.
The Pumping Lemma forRegular Languages p.25/3
An alternative method
-
8/8/2019 1-Pumping Lemma (1)
86/126
Use the fact that
is nonregular.
If
were regular then
would also be regular because
is regular and
of regular languages is a regular language.
But
which is not regular.
Hence,
is not regular either.
The Pumping Lemma forRegular Languages p.25/3
Example 3
-
8/8/2019 1-Pumping Lemma (1)
87/126
Show that
is nonregular using
pumping lemma
The Pumping Lemma forRegular Languages p.26/3
Example 3
-
8/8/2019 1-Pumping Lemma (1)
88/126
Show that
is nonregular using
pumping lemma
Proof: Assume that
is regular and is its pumping length.
Consider
. Since
, and
satisfi esthe conditions of the pumping lemma.
The Pumping Lemma forRegular Languages p.26/3
Note
-
8/8/2019 1-Pumping Lemma (1)
89/126
Condition 3 is again crucial because without it we
could pump if we let , so
The Pumping Lemma forRegular Languages p.27/3
Note
-
8/8/2019 1-Pumping Lemma (1)
90/126
Condition 3 is again crucial because without it we
could pump if we let , so
The string
exhibits the essence of the
nonregularity of
.
The Pumping Lemma forRegular Languages p.27/3
Note
-
8/8/2019 1-Pumping Lemma (1)
91/126
Condition 3 is again crucial because without it we
could pump if we let , so
The string
exhibits the essence of the
nonregularity of
.
If we chose, say
we fail because this stringcan be pumped
The Pumping Lemma forRegular Languages p.27/3
Example 4
-
8/8/2019 1-Pumping Lemma (1)
92/126
Show that
is nonregular.
The Pumping Lemma forRegular Languages p.28/3
Example 4
-
8/8/2019 1-Pumping Lemma (1)
93/126
Show that
is nonregular.
Proof by contradiction: Assume that
is regular and let be its pumping length. Consider
,
.
Pumping lemma guarantees that can be split, ,
where for all
,
The Pumping Lemma forRegular Languages p.28/3
Searching for a contradiction
-
8/8/2019 1-Pumping Lemma (1)
94/126
The elements of
are strings whose lengths are perfectsquares. Looking at fi rst perfect squareswe observe that
they are: 0, 1, 4, 9, 25, 36, 49, 64, 81,
The Pumping Lemma forRegular Languages p.29/3
Searching for a contradiction
-
8/8/2019 1-Pumping Lemma (1)
95/126
The elements of
are strings whose lengths are perfectsquares. Looking at fi rst perfect squareswe observe that
they are: 0, 1, 4, 9, 25, 36, 49, 64, 81,
Note the growing gap between these numbers: large members
cannot be near each other
The Pumping Lemma forRegular Languages p.29/3
Searching for a contradiction
-
8/8/2019 1-Pumping Lemma (1)
96/126
The elements of
are strings whose lengths are perfectsquares. Looking at fi rst perfect squareswe observe that
they are: 0, 1, 4, 9, 25, 36, 49, 64, 81,
Note the growing gap between these numbers: large members
cannot be near each other
Consider two strings
and
which differ from each otherby a single repetition of .
The Pumping Lemma forRegular Languages p.29/3
Searching for a contradiction
-
8/8/2019 1-Pumping Lemma (1)
97/126
The elements of
are strings whose lengths are perfectsquares. Looking at fi rst perfect squareswe observe that
they are: 0, 1, 4, 9, 25, 36, 49, 64, 81,
Note the growing gap between these numbers: large members
cannot be near each other
Consider two strings
and
which differ from each otherby a single repetition of .
If we chose
very large the lengths of
and
cannot be
both perfect square because they are too close to each other.
The Pumping Lemma forRegular Languages p.29/3
Turning this idea into a proof
-
8/8/2019 1-Pumping Lemma (1)
98/126
Calculate the value of
that gives us the contradiction.
The Pumping Lemma forRegular Languages p.30/3
Turning this idea into a proof
-
8/8/2019 1-Pumping Lemma (1)
99/126
Calculate the value of
that gives us the contradiction.
If
, calculating the difference we obtain
The Pumping Lemma forRegular Languages p.30/3
Turning this idea into a proof
-
8/8/2019 1-Pumping Lemma (1)
100/126
Calculate the value of
that gives us the contradiction.
If
, calculating the difference we obtain
By pumping lemma
and
are both perfect
squares. But letting
we can see that theycannot be both perfect square if
,
because they would be too close together.
The Pumping Lemma forRegular Languages p.30/3
Value of
for contradiction
-
8/8/2019 1-Pumping Lemma (1)
101/126
To calculate the value for
that leads to contradiction we
observe that:
The Pumping Lemma forRegular Languages p.31/3
Value of
for contradiction
-
8/8/2019 1-Pumping Lemma (1)
102/126
To calculate the value for
that leads to contradiction we
observe that:
The Pumping Lemma forRegular Languages p.31/3
Value of
for contradiction
-
8/8/2019 1-Pumping Lemma (1)
103/126
To calculate the value for
that leads to contradiction we
observe that:
Let
. Then
The Pumping Lemma forRegular Languages p.31/3
Example 5
-
8/8/2019 1-Pumping Lemma (1)
104/126
Sometimes pumping down" is useful when we applypumping lemma.
The Pumping Lemma forRegular Languages p.32/3
Example 5
-
8/8/2019 1-Pumping Lemma (1)
105/126
Sometimes pumping down" is useful when we applypumping lemma.
We illustrate this using pumping lemma to prove that
is not regular
The Pumping Lemma forRegular Languages p.32/3
Example 5
-
8/8/2019 1-Pumping Lemma (1)
106/126
Sometimes pumping down" is useful when we applypumping lemma.
We illustrate this using pumping lemma to prove that
is not regular
Proof: by contradiction using pumping lemma. Assume that
is
regular and its pumping length is
.
The Pumping Lemma forRegular Languages p.32/3
Searching for a contradiction
-
8/8/2019 1-Pumping Lemma (1)
107/126
Let
; From decomposition , from
condition 3,
it results that consists only of 0s.
The Pumping Lemma forRegular Languages p.33/3
Searching for a contradiction
f
-
8/8/2019 1-Pumping Lemma (1)
108/126
Let
; From decomposition , from
condition 3,
it results that consists only of 0s.
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
The Pumping Lemma forRegular Languages p.33/3
Searching for a contradiction
L
F d i i f
-
8/8/2019 1-Pumping Lemma (1)
109/126
Let
; From decomposition , from
condition 3,
it results that consists only of 0s.
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
The Pumping Lemma forRegular Languages p.33/3
Try something else
Si
h
id
d
-
8/8/2019 1-Pumping Lemma (1)
110/126
Since
even when , consider and
.
The Pumping Lemma forRegular Languages p.34/3
Try something else
Si
h
id
d
-
8/8/2019 1-Pumping Lemma (1)
111/126
Since
even when , consider and
.
This decreases the number of 0s in .
The Pumping Lemma forRegular Languages p.34/3
Try something else
Since
even when
consider
and
-
8/8/2019 1-Pumping Lemma (1)
112/126
Since even when , consider and
.
This decreases the number of 0s in .
Since has just one more 0 than 1 and cannot have
more 0s than 1s,(
and
) cannot be in
.
The Pumping Lemma forRegular Languages p.34/3
Try something else
Since
even when
consider
and
-
8/8/2019 1-Pumping Lemma (1)
113/126
Since even when , consider and
.
This decreases the number of 0s in .
Since has just one more 0 than 1 and cannot have
more 0s than 1s,(
and
) cannot be in
.
This is the required contradiction
The Pumping Lemma forRegular Languages p.34/3
Minimum pumping length
The pumping lemma says that every regular language
-
8/8/2019 1-Pumping Lemma (1)
114/126
The pumping lemma says that every regular language
has a pumping length , such that every string in the
language of length at least
can be pumped.
The Pumping Lemma forRegular Languages p.35/3
Minimum pumping length
The pumping lemma says that every regular language
-
8/8/2019 1-Pumping Lemma (1)
115/126
The pumping lemma says that every regular language
has a pumping length , such that every string in the
language of length at least
can be pumped.
Hence, if is a pumping length for a regular language
so is any length
.
The Pumping Lemma forRegular Languages p.35/3
Minimum pumping length
The pumping lemma says that every regular language
-
8/8/2019 1-Pumping Lemma (1)
116/126
The pumping lemma says that every regular language
has a pumping length , such that every string in the
language of length at least
can be pumped.
Hence, if is a pumping length for a regular language
so is any length
.
The minimum pumping length for
is the smallest
that is a pumping length for
.
The Pumping Lemma forRegular Languages p.35/3
Example
Consider
The minimum pumping length for
is 2
-
8/8/2019 1-Pumping Lemma (1)
117/126
Consider . The minimum pumping length for is 2.
The Pumping Lemma forRegular Languages p.36/3
Example
Consider
. The minimum pumping length for
is 2.
-
8/8/2019 1-Pumping Lemma (1)
118/126
Consider . The minimum pumping length for is 2.
Reason: the string
,
and cannot be pumped. But any
string
,
can be pumped because for where
,
,
and
. Hence, the minimum pumping length for
is 2.
The Pumping Lemma forRegular Languages p.36/3
Problem 1
Find the minimum pumping length for the language
.
-
8/8/2019 1-Pumping Lemma (1)
119/126
Find the minimum pumping length for the language .
The Pumping Lemma forRegular Languages p.37/3
Problem 1
Find the minimum pumping length for the language
.
-
8/8/2019 1-Pumping Lemma (1)
120/126
p p g g g g
Solution: The minimum pumping length for
is 4.
Reason:
but
cannot be pumped. Hence, 3 is not a
pumping length for
. If
and
can be pumped by
the division
,
,
,
.
The Pumping Lemma forRegular Languages p.37/3
Problem 2
Find the minimum pumping length for the language
.
-
8/8/2019 1-Pumping Lemma (1)
121/126
p p g g g g
The Pumping Lemma forRegular Languages p.38/3
Problem 2
Find the minimum pumping length for the language
.
-
8/8/2019 1-Pumping Lemma (1)
122/126
p p g g g g
Solution: The minimum pumping length of
is 1.
The Pumping Lemma forRegular Languages p.38/3
Problem 2
Find the minimum pumping length for the language
.
-
8/8/2019 1-Pumping Lemma (1)
123/126
Solution: The minimum pumping length of
is 1.
Reason: the minimum pumping length for
cannot be 0 because is
in the language but cannot be pumped. Every nonempty string
,
can be pumped by the division:
,
,
first character
of and the rest of .
The Pumping Lemma forRegular Languages p.38/3
Problem 3
Find the minimum pumping length for the language
-
8/8/2019 1-Pumping Lemma (1)
124/126
.
The Pumping Lemma forRegular Languages p.39/3
Problem 3
Find the minimum pumping length for the language
-
8/8/2019 1-Pumping Lemma (1)
125/126
.
Solution: The minimum pumping length for
is 3.
The Pumping Lemma forRegular Languages p.39/3
Problem 3
Find the minimum pumping length for the language
-
8/8/2019 1-Pumping Lemma (1)
126/126
.
Solution: The minimum pumping length for
is 3.
Reason: The pumping length cannot be 2 because the string
is in the
language and it cannot be pumped. Let
be a string in the language
of length at least 3. If is generated by
we can write is as
, , is the first symbol of , and is the rest of the string.
If is generated by
we can write it as ,
,
and
is the remainder of .
The Pumping Lemma forRegular Languages p.39/3