1. Automata Theory and Logic
Pumping Lemma for Regular Language
A TUTORIAL
BY
ANIMESH CHATURVEDI
AT
INDIAN INSTITUTE OF TECHNOLOGY INDORE (IIT-I)
2. Pumping Lemma
If L is finite language then it is definitely regular.
L is regular if strings x, y and z such that |xy| ≤ p, |y| ≥ 1 and xyiz is in L for every integer i ≥ 0
If L is regular then a pumping lemma will exist for L.
If pumping lemma for L then L is regular. (ab)n where n > 0
If L is non-regular then there may be pumping lemma. (ab)n U ap where p is prime number
Regular language consist of pattern that keep on repeating.
x
z
y
3. Language Regular or not?
an / n >= 1
an bm / n, m >= 1
anbn / n <= 1010
an bn / n >= 1
wwR / |w| = 2
wwR / |w| >= 1
anbmck / n, m, k >= 1
aib2j / i, j >= 1
aib4j / i, j >= 1
Regular or not?
4. Language Regular or not?
an / n >= 1 Two state DFA exist.
an bm / n, m >= 1 Three state DFA exist.
anbn / n <= 1010
Regular because it is finite
an bn / n >= 1 Not regular because this requires memory to store the number of ‘a’ for same number of ‘b’.
wwR / |w| = 2 Regular because language is finite and bounded
wwR / |w| >= 1 Not Regular because language is infinite and need to store w for writing its reverse as wR
anbmck / n, m, k >= 1 Regular expression aa*bb*cc*
aib2j / i, j >= 1 Regular expression aa*(bb)(bb)*
aib4j / i, j >= 1 Regular expression aa*(bbbb)(bbbb)*
Regular or not?
5. Language Regular or not?
an / n is even
an / n is odd
an / n is prime
an / n=m2 and m >= 1
an / n=2m and m >= 1
Regular has Arithmetic progress
6. Language Regular or not?
an / n is even {a0, a2, a4, a6 …} string length is 0, 2, 4, 6 … which forms AP with difference 2. Hence Regular
an / n is odd {a1, a3, a5, a7 …}string length is 1, 3, 5, 7 … forms AP with difference 2. Hence Regular
an / n is prime Not regular because string length is not in AP.
an / n=m2 and m >= 1 {a1, a4, a9, a16, a25 …} Not regular because string length is not in AP.
an / n=2m and m >= 1 {a2, a4, a8, a16, a32 …} Not regular because string length is not in AP.
Regular has Arithmetic progress
7. Language Regular or not?
anbm / n >= 1, m = j2 where j >= 1
anbm / n >= 1, m = 2j where j >= 1
w / na(w) = nb(w)
w / na(w) <= nb(w)
w / na(w) >= nb(w)
w / na(w) mod 3 >= nb(w) mod 3
wwwR
anbn+mcm / n, m >= 1
Regular or not
8. Language Regular or not?
anbm / n >= 1, m = j2 where j >= 1 Not Regular because of bm
anbm / n >= 1, m = 2j where j >= 1 Not Regular because of bm
w / na(w) = nb(w) Not Regular because we can’t count and store number of a and b
w / na(w) <= nb(w) Not Regular because we can’t count and store number of a and b
w / na(w) >= nb(w) Not Regular because we can’t count and store number of a and b
w / na(w) mod 3 >= nb(w) mod 3 Regular because it is finite to create states to measure multiple of 3
wwwR Not Regular because storing and reversing both required
anbn+mcm / n, m >= 1 Not Regular because storing and reversing both required
Regular or not?
9. Language Regular or not?
wwR / w is (0 + 1)+
wxwR / w, x is (0 + 1+
wxwR / w, x is (0 + 1)+ and |x| = 5
xwwRy / w, x, y is (0 + 1)+
xwwR / w, x is (0 + 1)+
wwRy / w, y is (0 + 1)+
Regular or not?
10. Language Regular or not?
wwR / w is (0 + 1)+
Not Regular because storing and reversing both required
wxwR / w, x is (0 + 1+
Regular because we can re-write it as 0(0+1)*0 + 1(0+1)*1
wxwR / w, x is (0 + 1)+ and |x| = 5 Not Regular because x is of fixed length thus we need storing and reversing
xwwRy / w, x, y is (0 + 1)+ Regular because we can re-write it as (0+1)*00(0+1)* + (0+1)*11(0+1)*
xwwR / w, x is (0 + 1)+ Not Regular because x cannot be expanded here thus we need storing and reversing
wwRy / w, y is (0 + 1)+ Not Regular because y cannot be expanded here thus we need storing and reversing
Regular or not?