Pumping Lemma
Pumping Lemma
The language L is regular, so there exists a DFA M such that L = L(M ). Say M has p states, {q1 , . . . , qp }.
We are also given input string s ∈ L with s = s1 s2 · · · sn (n = |s| ≥ p).
M on input s (accepts):
s1 s2 s
3 sp−1 sp sp+1n s
r1 −→ r2 −→ r3 −→ · · · −−−→ rp −→ rp+1 −−−→ · · · −→ rn+1
Where rn+1 is an accept state. (Remark: the r’s are not necessarily unique – rl and rm may refer to the
same qp .)
M went through at least p + 1 states, but has only p distinct states. By pigeonhole principle, some state
repeats (there exists a cycle). This implies that there exists some j, k with j 6= k such that rj = rk . We also
know that k ≤ p + 1.
Thus, M looks like this on input s :
r1 s1 r2 s2 r3 s3 · · · sj−1 rj = rk sk rk+1 · · · sn rn+1
sk−1 sj
rk−1 rj+1
Let the input before the loop s1 s2 · · · sj−1 = x, the input in the loop sj · · · sk−1 = y, and teh input after
the loop sk · · · sn = z. By assumption, s = xyz ∈ L(M ).
We have shown that
1. For all i ≥ 0, xy i z ∈ L (because we may exploit the loop)
2. |y| ≥ 1 (because j, k are distinct)
3. |xy| ≤ p (because |xy| = k − 1 and k ≤ p + 1.)
This is really useful to show that certain languages are not regular.