You are on page 1of 67

Pumping Lemma Examples

L> = {aibj : i > j}


L> is not regular. We prove it using the Pumping Lemma.

L> = {aibj : i > j}


L> is not regular. Fix an arbitrary pumping length n>0.

L> = {aibj : i > j}


L> is not regular. Fix an arbitrary pumping length n>0. Choose a proper string s in L>.

L> = {aibj : i > j}


L> is not regular. Fix an arbitrary pumping length n>0. Choose a proper string s in L>.

|s| n

L> = {aibj : i > j}


L> is not regular. Fix an arbitrary pumping length n>0. Choose a proper string s in L>. s = an+1bn L>.

aaaaabbb
n+1
n

L> = {aibj : i > j}



L> is not regular. Fix an arbitrary pumping length n>0. Choose a proper string s in L>. s = an+1bn L>. Consider all possible splittings of s in x,y,z with the desired properties.

aaaaabbb
n+1
n

L> = {aibj : i > j}



L> is not regular. Fix an arbitrary pumping length n>0. Choose a proper string s in L>. |xy| n s = an+1bn L>. |y| 1 Consider all possible splittings of s in x,y,z with the desired properties.

aaaaabbb
n+1
n

L> = {aibj : i > j}



L> is not regular. Fix an arbitrary pumping length n>0. Choose a proper string s in L>. |xy| n s = an+1bn L>. |y| 1 Consider all possible splittings of s in x,y,z with the desired properties.

aaaaabbb
n+1
n

L> = {aibj : i > j}



L> is not regular. Fix an arbitrary pumping length n>0. Choose a proper string s in L>. |xy| n s = an+1bn L>. |y| 1 Consider all possible splittings of s in x,y,z with the desired properties.

aaaaabbb
n+1 n

L> = {aibj : i > j}



L> is not regular. Fix an arbitrary pumping length n>0. Choose a proper string s in L>. s = an+1bn L>. Consider all possible splittings of s in x,y,z with the desired properties: y = am, 1 m n.

aaaaabbb
n+1 n

L> = {aibj : i > j}



L> is not regular. Fix an arbitrary pumping length n>0. Choose a proper string s in L>. s = an+1bn L>. Consider all possible splittings of s in x,y,z with the desired properties: y = am, 1 m n. xz =an+1-mbn L>.

aaabbb

n+1-m n

L> = {aibj : i > j}



L> is not regular. Fix an arbitrary pumping length n>0. Choose a proper string s in L>. s = an+1bn L>. Consider all possible splittings of s in x,y,z with the desired properties: y = am, 1 m n. xz =an+1-mbn L>. So L> is not regular!

L={ww : w in

* {a,b}

First, figure out what this language is.

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language?

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab Another string in the language?

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab Another string in the language? aaaaaa

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab Another string in the language? aaaaaa A string not in the language?

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab Another string in the language? aaaaaa A string not in the language? abbb

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab Another string in the language? aaaaaa A string not in the language? abbb Is in the language?

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab Another string in the language? aaaaaa A string not in the language? abbb Is in the language? YES! ( = )

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab Another string in the language? aaaaaa A string not in the language? abbb Is in the language? YES! ( = ) Is aa in the language?

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab Another string in the language? aaaaaa A string not in the language? abbb Is in the language? YES! ( = ) Is aa in the language? YES!

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab Another string in the language? aaaaaa A string not in the language? abbb Is in the language? YES! ( = ) Is aa in the language? YES! Is a in the language?

L={ww : w in

* {a,b}

First, figure out what this language is. A string in the language? aabaab Another string in the language? aaaaaa A string not in the language? abbb Is in the language? YES! ( = ) Is aa in the language? YES! Is a in the language? NO!

L={ww : w in

* {a,b}

First, figure out what this language is. L = {, aa, bb, aaaa, abab, baba, bbbb, aaaaaa }

abaabba|abaabba

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma.

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. First fix an arbitrary number n>0 to be the pumping length.

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Choose wisely!!!

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = a2n

aaaaaa|aaaaaa
n n

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = a2n For x = , y = a2, z = a2n-2 y z

aaaaaa|aaaaaa
n n

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = a2n For x = , y = a2, z = a2n-2 y y z

aaaaaaa|aaaaaaa L
n+1 n+1

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = a2n For x = , y = a2, z = a2n-2 y y y z

aaaaaaaa|aaaaaaaa L
n+2 n+2

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = a2n For x = , y = a2, z = a2n-2 z

aaaaa|aaaaa L
n-1 n-1

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = a2n For x = , y = a2, z = a2n-2, there is no i: xyiz L!

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = a2n For x = , y = a2, z = a2n-2, there is no i: xyiz L! s = a2n doesnt work!!!

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = (ab)2n

abababab|abababab
n n

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = (ab)2n For x = , y = abab, z = (ab)2n-2 y z

abababab|abababab
n n

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = (ab)2n For x = , y = abab, z = (ab)2n-2 y y z

ababababab|ababababab L
n+1 n+1

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = (ab)2n For x = , y = abab, z = (ab)2n-2 For any i, xyiz = (ab)2i(ab)2n-2 = (ab)2(i-n-2) L!

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Example: For s = (ab)2n For x = , y = abab, z = (ab)2n-2 For any i, xyiz = (ab)2i(ab)2n-2 = (ab)2(i-n-2) L! s = (ab)2n doesnt work!

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Use s = anbanb

aaaaaab|aaaa...aab
n n

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language. Use s = anbanb For any splitting of s in x,y,z with the desired properties:

aaaaaab|aaaa...aab
n n

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language Use s = anbanb For any splitting of s in x,y,z with the desired properties: y = am with 1 m n.

L={ww : w in

* {a,b}

We prove that L is not regular by using the pumping lemma. Pumping length: n Choose a proper string in the language Use s = anbanb For any splitting of s in x,y,z with the desired properties: y = am with 1 m n. Observe that xy2z = am+nbanb is not in L QED

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular?

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? A first attempt to design a FA
a,b a,b a,b a,b

q10

q11

q12

q13

... ...

q1n

q2n

a,b

q2n-1

a,b

q2n-2

a,b

q2n-3

a,b

q20

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? A first attempt to design a FA fails!
a,b a,b a,b a,b

q10

q11

q12

q13

... ...

q1n

q2n

a,b

q2n-1

a,b

q2n-2

a,b

q2n-3

a,b

q20

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Looks similar with L (L = {w1w2 : w1 = w2}.

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Looks similar with L (L = {w1w2 : w1 = w2}. But the pumping lemma holds!

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Looks similar with L (L = {w1w2 : w1 = w2}. But the pumping lemma holds!
Fix pumping length k=2.

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Looks similar with L (L = {w1w2 : w1 = w2}. But the pumping lemma holds!
Fix pumping length k=2. For every proper string s in L,

2n2

abbbaabb|bbabaaaa
n n

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Looks similar with L (L = {w1w2 : w1 = w2}. But the pumping lemma holds!
Fix pumping length k=2. For every proper string s in L, split s in x, y, z with the desired properties.

y n

|y|1 and |xy| 2 n

abbbaabb|bbabaaaa

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Looks similar with L (L = {w1w2 : w1 = w2}. But the pumping lemma holds!
Fix pumping length k=2. For every proper string s in L, split s in x = ,y = first two symbols of s, z = rest.

y n

z n

abbbaabb|bbabaaaa

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Looks similar with L (L = {w1w2 : w1 = w2}. But the pumping lemma holds!
Fix pumping length k=2. For every proper string s in L, split s in x = ,y = first two symbols of s, z = rest. xy2z in L.

y y

ababbbaab|bbbabaaaa L
n+1 n+1

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Looks similar with L (L = {w1w2 : w1 = w2}. But the pumping lemma holds!
Fix pumping length k=2. For every proper string s in L, split s in x = ,y = first two symbols of s, z = rest. xy3z in L.

y y y

abababbbaa|bbbbabaaaa L
n+2 n+2

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Looks similar with L (L = {w1w2 : w1 = w2}. But the pumping lemma holds!
Fix pumping length n=2. For every proper string s in L, split s in x = ,y = first two symbols of s, z = rest. xy0z in L.

bbaabbb|babaaaa L
n-1 n-1

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Looks similar with L (L = {w1w2 : w1 = w2}. But the pumping lemma holds!
Fix pumping length n=2. For every proper string s in L, split s in x = ,y = first two symbols of s, z = rest. For every i 0, xyiz in L.

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Consider L = {w : w has even length}.

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Consider L = {w : w has even length}.

Every string of even length

abbbaabb.bbabaaaa
2n

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Consider L = {w : w has even length}.

Every string of even length can be split into two parts of equal length

abbbaabb|bbabaaaa
n n

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Consider L = {w : w has even length}.

Every string of even length can be split into two parts of equal length and vice versa.

abbbaabb.bbabaaaa
2n

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Consider L = {w : w has even length}. L = L Every string of even length can be split into two parts of equal length and vice versa.

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular? Consider L = {w : w has even length} L = L A DFA for L:
a,b even a,b odd

L = {w1w2 : w1,w2 {a,b}*,|w1|=|w2|}


Is it regular?

YES!!! L = L A DFA for L:


a,b even a,b odd

You might also like