22-Pumping Lemma For Regular Languages-22-02-2024
22-Pumping Lemma For Regular Languages-22-02-2024
Theory of Computation
Lecture 16
Dr. Saritha Murali
(SCOPE, VIT Vellore)
22-02-2024
Are all languages Regular?
Techniques for showing that a language L is regular
2. If there is no pattern to generate all the strings in language, then it is not regular. Finding
prime itself is not possible with FA.
Example 5 – L = { ap | p is prime } is not regular.
3. The pattern of strings form an A.P.(Arithmetic Progression) is regular.
But the pattern with G.P.(Geometric Progression) is not regular.
Example– L = { an | n>=2 } forms an A.P. Hence, regular. So we can draw a finite automaton with 3
states.
4. Whenever unbounded storage is required for storing the count and then comparison with
other unbounded counts, then the language is not regular.
Example – L = {anbn | n>=1 } is not regular, because we need to first store the count of a and
then compare it against count of b, but finite automaton has a limited storage, but in L, there can
be infinite number of a’s coming in, which can’t be stored.
Example– L = { w | na(w)%3 > nb(w)%3 } is regular, because modulus operation requires bounded
storage i.e. modulus can be only 0, 1 or 2 for %3 operation and then similarly for b, it would be 0, 1
and 2. So, the states represented in DFA would be the combinations of the remainders of a and b.
How can we prove that a language L is not regular?
Prove that there is no DFA that accepts L ??
using Contradiction
• Assume that L is Regular
• It should have a Pumping Length (n)
• All strings longer than P can be pumped |S| ≥ n
• Now find a string 'S' in L such that |S| ≥ n
• Divide S into x y z
• Show that x yi z ∉ L for some i
• Then consider all the ways that S can be divided into x y z
• Show that none of these can satisfy all the 3 pumping conditions at the
same time
• S cannot be Pumped == CONTRADICTION
Prove that L={anbn|n>=1} is not regular
a mbmbma m = a...aa...a...ab...bb...ba...a
x y z
y = ak , k ³ 1
We have: x y z = a mb mb m a m y = ak , k ³ 1
From the Pumping Lemma:
i
xy z Î L i = 0, 1, 2, ...
2
Thus: x y z Î L
x y2 z = x y y z = a m + k b mb m a m Ï L
CONTRADICTION. Hence L is not regular.
Prove that L = { ap | p is prime } is not regular