You are on page 1of 31

More Applications

of
the Pumping Lemma

The Pumping Lemma:


Given a infinite regular language
there exists an integer
for any string
we can write
with

w L

(critical length)

with length

| w| m

w x y z

| x y | m and | y | 1

such that:

xy z L

i 0, 1, 2, ...

Non-regular languages

L {vv : v *}

Regular languages

Theorem: The language


R

L {vv : v *}
is not regular

Proof:

Use the Pumping Lemma

{a, b}

L {vv : v *}
Assume for contradiction
that L is a regular language

Since L is infinite
we can apply the Pumping Lemma

L {vv : v *}
Let

be the critical length for

Pick a string

such that:

w L

and length

We pick

m m m m

wa b b a

| w| m

From the Pumping Lemma:


we can write: w a b b a
m

with lengths:

x y z

| x y | m, | y | 1

m m m

w xyz a...aa...a...ab...bb...ba...a
x
Thus:

y a , 1k m
k

m m m m

x y za b b a

y a , 1k m
k

From the Pumping Lemma:

xy z L
i 0, 1, 2, ...

Thus:

xy z L

m m m m

x y za b b a

y a , 1k m
k

From the Pumping Lemma:

xy z L

m m m

m+k
2

xy z = a...aa...aa...a...ab...bb...ba...a L

x
Thus:

y
a

y
m k m m m

b b a

a
BUT:

m k m m m

b b a

L {vv : v *}

m k m m m

b b a

CONTRADICTION!!!

k 1

Therefore:

Our assumption that L


is a regular language is not true

Conclusion: L

is not a regular language

END OF PROOF

Non-regular languages
n l n l

L {a b c

Regular languages

: n, l 0}

Theorem: The language


n l n l

L {a b c

: n, l 0}

is not regular

Proof:

Use the Pumping Lemma

n l n l

L {a b c

: n, l 0}

Assume for contradiction


that L is a regular language

Since L is infinite
we can apply the Pumping Lemma

n l n l

L {a b c
Let

: n, l 0}

be the critical length of

Pick a string

such that:

w L
length

We pick

m m 2m

wa b c

and

| w| m

From the Pumping Lemma:


We can write

w a b c

With lengths

| x y | m, | y | 1

2m

x y z

2m

w xyz a...aa...aa...ab...bc...cc...c
x
Thus:

y a , 1k m
k

m m 2m

x y za b c

y a , 1k m

From the Pumping Lemma:

xy z L
i 0, 1, 2, ...

Thus:

x y z = xz L

m m 2m

x y za b c

y a , 1k m
k

xz L

From the Pumping Lemma:

mk

2m

xz a...aa...ab...bc...cc...c L

x
Thus:

mk m 2m

b c

BUT:

mk m 2m

b c

n l n l

L {a b c

mk m 2m

b c

: n, l 0}

CONTRADICTION!!!

k 1

Therefore:

Our assumption that L


is a regular language is not true

Conclusion: L

is not a regular language

END OF PROOF

Non-regular languages

n!

L {a : n 0}

Regular languages

Theorem: The language

n!

L {a : n 0}
is not regular

n! 1 2 (n 1) n

Proof:

Use the Pumping Lemma

n!

L {a : n 0}

Assume for contradiction


that L is a regular language

Since L is infinite
we can apply the Pumping Lemma

n!

L {a : n 0}
Let

be the critical length of

Pick a string

such that:

w L
length

We pick

wa

m!

| w| m

From the Pumping Lemma:


We can write w a
With lengths

m!

x y z

| x y | m, | y | 1

m
w xyz a

m!

m! m

a...aa...aa...aa...aa...a

x
Thus:

y
k

y a , 1 k m

x y za

m!

y a , 1 k m

From the Pumping Lemma:

xy z L
i 0, 1, 2, ...

Thus:

xy z L

x y za

m!

y a , 1 k m

From the Pumping Lemma:

mk

xy z L

m!m

xy z a...aa...aa...aa...aa...aa...a L

x
Thus:

y
a

m! k

a
Since:

m! k

1 k m

n!

L {a : n 0}

There must exist

m! k p!

such that:

However:

m! k m! m
m! m!
m!m m!
m!(m 1)
(m 1)!

for

m 1

m! k (m 1)!
m! k p!

for any

a
BUT:

m! k

n!

L {a : n 0}

m! k

CONTRADICTION!!!

1 k m

Therefore:

Our assumption that L


is a regular language is not true

Conclusion: L

is not a regular language

END OF PROOF