MELJUN CORTES Automata Lecture the Pumping Lemma 1
-
Upload
meljun-cortes-mbampa -
Category
Documents
-
view
217 -
download
0
Transcript of MELJUN CORTES Automata Lecture the Pumping Lemma 1
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
1/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 1 of 21
The Pumping Lemma
The Pumping Lemma
The Pumping Lemma
Introduction
• Recall that all regular
languages have this property
that if they have strings that
are long enough, then each of
these strings has a substring
that can be repeated an
arbitrary number of times, and
the resulting string will still be
in the language.
• This property can be used to
prove the non-regularity of
languages and is the basis of
the pumping lemma.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
2/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 2 of 21
The Pumping Lemma
• Consider the following DFA:
Assume that the input string w
= 001100. Let m = 6 be the
number of states of the DFA.
Since w ≥ m, then at least
one state will be traversed at
least twice.
The states that will be
traversed are
q 0 q 5q 1 q 2 q 3 q 40 0 1 1 1
1 1
0
0 0, 1
0
q 0
0
q 1
0
q 2
1
q 3
1
q 4
0
q 2
0
q 5
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
3/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 3 of 21
The Pumping Lemma
• In this example, state q2 was
traversed twice therebyforming a loop or cycle
consisting of states q2, q3, and
q4. Specifically,
• The part of the input string
001100 that caused the loop is
the substring 110.
• Take note that the first
repeated state appeared within
the first m symbols of the input
string.
q 2 q 3 q 4
0 0 1 1 0
this part
caused theloop
0
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
4/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 4 of 21
The Pumping Lemma
• Therefore, the substring 110can be repeated an arbitrary
number of times (pumped) and
the resulting strings will still be
part of the language. These
include strings such as001101100, 001101101100,
and 001101101101100.
• The input string can actually
be viewed as being composed
of three parts (called x , y , and
z) as shown below:
0 0 1 1 0
y
0
x z
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
5/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 5 of 21
The Pumping Lemma
• Substring x is the first part of
the input string that iscomposed of the symbols
before the 1st appearance of
the repeated state which is q2.
• Substring y is the second partof the input string that contains
the input symbols from the first
occurrence of the repeated
state up to its second
occurrence. This is the loopwithin the input string.
• Substring z is composed of the
remaining symbols of the input
string that lead to the finalstate.
• The input string w can then be
written as
w = xyz
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
6/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 6 of 21
The Pumping Lemma
• Since substring y can be
repeated an arbitrary number
of times and the resulting
string is still part of thelanguage, then w can be
generalized as
w = xy iz where i ≥ 0
Examples:
w = xy 1z = 001100
w = xy 2z = 001101100
w = xy 3z = 001101101100
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
7/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 7 of 21
The Pumping Lemma
• To summarize this specialproperty of regular languages:
1. Let w be any string of
regular language L whoselength is greater than or
equal to the number of
states of the DFA that
recognizes language L ( w
≥ m).
2. The string w can be
divided into three parts xyz
where y contains the inputsymbols from the first
occurrence of a repeated
state to its second
occurrence.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
8/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 8 of 21
The Pumping Lemma
3. The length of substring xy
will be less than or equal to
the number of states of the
DFA ( xy ≤ m).
4. The length of y ≥ 1.
5. Substring y can berepeated or pumped any
number of times and the
resulting string is still a
member of language L.
• The summary given is an
informal statement of the
pumping lemma.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
9/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 9 of 21
The Pumping Lemma
The Pumping Lemma
• If L is a regular language, then
there is a number p (the
pump ing leng th ) where, if w
is any string in L whose length
is greater than or equal to p,
then w may be divided into
three parts, w = xyz , satisfying
the following conditions:
1. for each i ≥ 0, xy iz L,
2. y ≥ 1, and
3. xy p.
• Take note that the pumpinglength p refers to the number of
states of the DFA recognizing
the language. Hence, w ≥ p in
order for the pumping lemma to
be used.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
10/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 10 of 21
The Pumping Lemma
• Major points:
1. The string w = xy iz L for
each i ≥ 0. This states that
the loop or cycle within the
input string w can be
pumped any number oftimes and w will still be a
member of L.
2. y ≥ 1 refers to that fact
that y cannot be an empty
string. There has to be aloop or cycle that can be
pumped.
3. xy p refers to the fact
that the loop or cycle that
will be pumped is the firstone encountered from the
start of the input string. In
other words, the part to be
pumped is within the first p
symbols of the input string.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
11/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 11 of 21
The Pumping Lemma
• The pumping lemma can be
used to prove the non-
regularity of languages.
• Pumping lemma proofs often
use proof by contradiction:
1. First, assume that the
language L is regular.
2. Since L is regular, the
pumping lemma states thatall strings of L that are long
enough can be pumped.
3. Find a string w that is long
enough that cannot bepumped.
4. If there is such a string,
then the pumping lemma
was contradicted. Hence,
language L is not regular.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
12/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 12 of 21
The Pumping Lemma
• Example 1: Prove that the
language L1 = {0 x 1 x x > 0} is
not regular.
Assume first that L1 is regular.
Let p be the pumping length of
L1.
Let the string to be pumped bew = 0p1p.
Since w ≥ p, the string chosen
is long enough to be pumped.
Consider now the various
ways in which w can be
divided into x , y , and z
substrings.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
13/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 13 of 21
The Pumping Lemma
Option 1: Let y be all 0s.
If y = all 0s, pumping it
would create a string in
which there are more 0s
than 1s. Hence, the
resulting string will not be
in L1. This violates
condition 1 of the pumping
lemma.
Option 2: Let y be all 1s.
If y = all 1s, pumping it
would create a string in
which there are more 1s
than 0s. Hence, theresulting string will not be
in L1. This violates
condition 1 of the pumping
lemma. Condition 3 is also
violated.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
14/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 14 of 21
The Pumping Lemma
Option 3: Let y be composedof 0s and 1s.
If y is composed of 0s and
1s, pumping it would
create a string that mayhave the same number of
0s and 1s, but they will be
out of order with some 1s
before 0s. Hence, the
resulting string will not bein L1. This violates
condition 1 of the pumping
lemma. Condition 3 is also
violated.
Since L1 has a string that
cannot be pumped, then this
contradicts the original
assumption that L1 is regular.
Therefore, L1 is not regular.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
15/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 15 of 21
The Pumping Lemma
• Example 2: Prove that the
language L2 = {ww w {0,1}*}is not regular.
Assume first that L2 is regular
and let p be the pumping
length of L2.
Let the string to be pumped be
w = 0p10p1. Since w ≥ p, the
string can pumped.
From condition 3, substring y
can only be 0s that belong to
the first half of the input string.
If y is pumped, then there will
be more 0s in the first half of the string compared to its
second half, thereby creating
an imbalance. This contradicts
the original assumption that L2is regular. Therefore, L
2 is not
regular.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
16/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 16 of 21
The Pumping Lemma
• Example 3: Prove that the
language L3 = {w {0,1}* w =wR } is not regular.
Assume first that L3 is regular
and let p be the pumping
length of L3.
Let the string to be pumped be
w = 0p10p. Since w ≥ p, the
string can pumped.
From condition 3, the substring
y can only be 0s that belong to
the first block of consecutive
0s (to the left of the single 1) of
the input string. If y is pumped,then the string is no longer a
palindrome.
This contradicts the original
assumption that L3 is regular.
Therefore, L3 is not regular.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
17/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 17 of 21
The Pumping Lemma
• Example 4: Prove that the
language L4 = {0i1 j i > j } is not
regular.
Assume first that L4 is regular
and let p be the pumping
length of L4.
Let the string to be pumped be
w = 0p+11p. Since w ≥ p, the
string chosen is long enough
to be pumped.
From condition 3, substring y
can only be 0s that belong to
the block of consecutive 0s of
the input string. If y is pumped,then there will still be more 0s
than 1s. Hence, the string is
still in language L4.
Is the language regular?
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
18/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 18 of 21
The Pumping Lemma
Condition 1 of the pumping
lemma states that w = xy iz L
for each i ≥ 0. This means that
i can be equal to 0 making w =
xy i
z = xy 0
z = xz . This is calledpump ing down .
If y is pumped down, then
there will be more consecutive1s than 0s. Hence, the
resulting string is not in L4.
Since L4 has a string thatcannot be pumped, then this
contradicts the original
assumption that L4 is regular.
Therefore, L4 is not regular.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
19/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 19 of 21
The Pumping Lemma
• Example 5: Prove that the
language L5 = { 0i 2 i ≥ 0} is
not regular.
Assume first that L5 is regular
and let p be the pumping
length of L5.
Consider two strings xy 1z and
xy 2z . These two strings differ
in length by y .
Condition 3 states that xy p.
This means that y p.
If the string to be pumped is w = 0 p
2, then w = xyz = p2. If y
is pumped once, then w =
xy 2z . The length of w will then
be w = xy 2z p2 + p.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
20/21
Theory of Computation (With Automata Theory)
* Property of STI
Page 20 of 21
The Pumping Lemma
If xy 2z p2 + p, then this
inequality can be rewritten as
xy 2z < ( p + 1)2
Observe that replacing p2 + p
with ( p + 1)2 does not
invalidate the inequalitybecause p2 + p < ( p + 1)2.
Since the length of xy 1z is
equal to p2 (a perfect square),the length of the next string
should be ( p + 1)2, which is the
next perfect square after p2.
-
8/21/2019 MELJUN CORTES Automata Lecture the Pumping Lemma 1
21/21
Theory of Computation (With Automata Theory)
* Property of STI The Pumping Lemma
But the next string after xy 1z is
xy 2z and its length is less than
( p + 1)2
. Therefore, the lengthof xy 2z is not a perfect square
because there is no perfect
square number between p2
and ( p + 1)2. Hence, xy 2z
does not belong to L5.
Since L5 has a string that
cannot be pumped, then this
contradicts the originalassumption that L5 is regular.
Therefore, L5 is not regular.