Professional Documents
Culture Documents
Pump Examples
Pump Examples
Examples
L> = {a b : i > j}
i j
|s|≥ n
L> = {a b : i > j}
i j
aaa…aabb…b
n+1 n
L> = {a b : i > j}
i j
aaa…aabb…b
n+1 n
L> = {a b : i > j}
i j
aaa…aabb…b
n+1 n
L> = {a b : i > j}
i j
aaa…aabb…b
n+1 n
L> = {a b : i > j}
i j
abaabba|abaabba
L={ww : w in {a,b} } *
aaa…aaa|aaa…aaa
n n
L={ww : w in {a,b} } *
abab…abab|abab…abab
n n
L={ww : w in {a,b} } *
aaaa…aab|aaaa...aab
n n
L={ww : w in {a,b} } *
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
q2n q2n-1 q2n-2 q2n-3 ... q20
L’ = {w1w2 : w1,w2 ϵ {a,b}*,|w1|=|w2|}
Is it regular?
• A first attempt to design a FA fails!
q2nsizes up to n! ...
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’,
2n≥2
abbba…abb|bbaba…aaa
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.
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 z
abbba…abb|bbaba…aaa
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 z
ababbba…ab|bbbaba…aaa ϵ L’
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 z
abababbba…a|bbbbaba…aaa ϵ L’
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’.
z
bba…abbb|baba…aaa ϵ L’
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}.
abbbaabb….…bbabaaaa
2n
L’ = {w1w2 : w1,w2 ϵ {a,b}*,|w1|=|w2|}
Is it regular?
• Consider L’’ = {w : w has even length}.
abbbaabb…| …bbabaaaa
n n
L’ = {w1w2 : w1,w2 ϵ {a,b}*,|w1|=|w2|}
Is it regular?
• Consider L’’ = {w : w has even length}.
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 odd
a,b
L’ = {w1w2 : w1,w2 ϵ {a,b}*,|w1|=|w2|}
Is it regular?
• YES!!!
• L’ = L’’
• A DFA for L’:
a,b
even odd
a,b