Sie sind auf Seite 1von 23

Pumping Lemma for Regular

Sets
Beulah A.
AP/CSE
Introduction
A Regular language is a formal language that can be expressed
using a regular expression
A regular language satisfies the following equivalent
properties:
it is the language accepted by a nondeterministic finite automaton
it is the language accepted by a deterministic finite automaton
it can be generated by a regular grammar
it can be generated by a prefix grammar
it can be accepted by a read-only Turing machine
Regular set is a set of strings of a Regular Language
For every regular language there is a FA that accepts the
language
Beulah A. 2
The Pigeonhole Principle
If you put n pigeons into m pigeonholes, and n > m > 0, then at least
at least two pigeons are in the same pigeonhole.

Beulah A. 3
The Pigeonhole Principle
4 pigeons

3 pigeonholes

Beulah A. 4
The Pigeonhole Principle
A pigeonhole must
contain at least two pigeons

Beulah A. 5
Pigeonhole Principle & DFAs

Consider a DFA with 4 states

b
b b

q1 a a b
q2 q3 q4
a a
Beulah A. 6
Pigeonhole Principle & DFAs
Consider the walk of a “long‟‟ string: aabb (>=4)

A state is repeated in the walk of aabb


q1 a q2 a q3 b q4 b q4

b
b b

q1 a a b
q2 q3 q4
Beulah A. a a 7
Pigeonhole Principle & DFAs
The state is repeated as a result of the pigeonhole principle

Walk of aabb
Pigeons: q1 a q2 a q3 b q4 b q4
(walk states)

Are more than

Nests: q1 q2 q3 q4
(Automaton states)
Automaton States Repeated
Beulah A.
state 8
Pumping Lemma
Describes an essential property of all regular languages
For a particular language, any sufficiently long string in the language
contains a section, or sections, that can be removed, or repeated any
number of times(pumping), with the resulting string remaining in that
language
The pumping lemma is often used to prove that a particular language
is non-regular

Beulah A. 9
Pumping Lemma
Let L be a regular language. Then there is a constant n
(which depends on L/ number of states in FA) such that for
every string w in L such that |w|  n, we can break w into
three strings, w = xyz, such that y   ie |y| > 0, |xy|  n,
and for all i  0, xyiz is also in L.
Proof
Let n be |Q|.
If w L and |w|  n. Let w =a 1 a 2…a m, where m  n.
( q 0, a 1 a 2…a i)= q i, i = 1, 2, …, m.

Beulah A. 10
Pumping Lemma
Since there are only n states in Q and m  n, by the pigeon hole
theorem there are two states of q 0 , q 1 , q 2 , …, and q n are same, say 0
 i  j  n and q i = q j.

q0 q i = q j. qn

Beulah A. 11
Pumping Lemma
If w L and |w|  n, then, at least one state is repeated
in the walk of w

Walk in DFA of w  a1a2 am

a1 a2 am
...... q ......

Repeated state in DFA

Beulah A. 12
Pumping Lemma
There could be many states repeated
Take q to be the first state repeated

ai ai 1 aj a j 1 am
a1 a2 .... .... ....
q q

Unique states

Beulah A. 13
Pumping Lemma
We can write w = xyz

ai ai 1 aj a j 1 am
a1 a2 .... .... ....
q q

x  a1 ai y  ai 1  a j z  a j 1 am
Beulah A. 14
Pumping Lemma
In DFA: write w = xyz

1 occurrence of y (xyz)
y
...

a1 a j ai 1
... ai ... ... am
q a j 1

Beulah A. x z 15
Pumping Lemma
2 occurrences of y (xyyz)

y
...

a1 a j ai 1
... ai ... ... am
q a j 1

Beulah A. x z 16
Pumping Lemma
3 occurrences of y (xyyyz)

y
...

a1 a j ai 1
... ai ... ... am
q a j 1

Beulah A. x z 17
Pumping Lemma
Many occurrences of y (xyiz)
xyiz is also in L

y
...

a1 a j ai 1
... ai ... ... am
q a j 1

Beulah A. x z 18
Pumping Lemma
(q0, a1a2…ai) = qi = qj
(qi, ai+1..aj) = qi, and
(qj, aj+1…am) = qn

It is obvious that (qi, yi) = qi for i 0.


So, if the FA accepts w = xyz, it also accepts xyiz.

Beulah A. 19
Application
Useful to prove a language L is not a regular set
Method
Select an arbitrary „n‟
Choose a string w in L where |w|  n
For any partition of w = xyz such that
|xy|  n and |y|  1, show a contradiction;
i.e. show that there is a string xykz not in L;
k will depend on n, x, y, and z

Beulah A. 20
Summary
Definition of Pumping lemma – Regular Language
Application of pumping lemma

Beulah A. 21 July 23,


2018
Test Your Knowledge
If we select a string w such that w∈L, and w=xyz. Which of the
following portions cannot be an empty string?
a) x
b) y
c) z
d) all of the mentioned
Which of the following one can relate to the given statement:
Statement: If n items are put into m containers, with n>m, then
atleast one container must contain more than one item.
a) Pumping lemma
b) Pigeon Hole principle
c) Count principle
d) None of the mentioned

Beulah A. 22 July 23,


2018
Reference
Hopcroft J.E., Motwani R. and Ullman J.D, “Introduction to
Automata Theory, Languages and Computations”, Second
Edition, Pearson Education, 2008

Beulah A. 23 July 23,


2018

Das könnte Ihnen auch gefallen