formal languages
The Pumping Lemma
You should know: finite automata
Overview
The pumping lemma for regular languages is the standard tool for PROVING a language is NOT regular — that is, that no finite automaton can recognize it. It formalizes an unavoidable consequence of having only finitely many states: any sufficiently long accepted string must revisit some state, and the loop between the two visits can be repeated ('pumped') any number of times while the machine still accepts. If a language has strings that cannot survive this repetition, no finite automaton — however large — can recognize it.
Intuition
Picture a finite automaton with only k states processing a string longer than k symbols. By the pigeonhole principle, the machine must pass through the same state twice before finishing — say at positions i and j, with i < j. The path between those two visits forms a loop the machine could traverse zero times, once, or any number of times, always landing back in the same state and hence reaching the same fate (accept or reject) on the rest of the string. So if the original string was accepted, so is the string with that loop repeated any number of times, or removed entirely. Languages where this can't possibly hold true — like matching counts that would be destroyed by repeating a chunk — cannot be regular.
Formal Definition
If A is a regular language, there exists a pumping length p such that every string s in A with |s| ≥ p can be split into three pieces s = xyz satisfying:
Notation
| Notation | Meaning |
|---|---|
| The pumping length (at least the number of states in a DFA for A) | |
| The three pieces of s, with y the 'pumpable' loop segment | |
| String s with the loop segment y repeated i times (i = 0 means y is deleted) |
Theorems
Applications
Worked Examples
Assume L is regular with pumping length p. Choose the string s = 0ᵖ1ᵖ, which is in L and has length 2p ≥ p.
By condition 3, |xy| ≤ p, so xy lies entirely within the first p symbols — meaning x and y consist only of 0s.
Pump with i = 2: this adds b extra 0s but no extra 1s, so the 0-count no longer equals the 1-count.
This contradicts condition 1 (that xyⁱz ∈ L for all i), so no valid split exists — L is not regular.
Answer: L = {0ⁿ1ⁿ} fails the pumping lemma, so it is not regular (it requires a stack — it's context-free instead).
Practice Problems
Sketch a pumping-lemma proof that L = {wwᴿ : w ∈ {0,1}*} (even-length palindromes) is not regular. (Hint: pick s = 0ᵖ1 1 0ᵖ.)
Why must the string chosen for a pumping-lemma proof have length at least p, and why do we get to choose it adversarially?
The pumping lemma is used almost exclusively to:
Common Mistakes
Using the pumping lemma to try to prove a language IS regular.
The pumping property is a necessary, not sufficient, condition for regularity — some non-regular languages can still satisfy the pumping conditions by accident. The lemma is a one-way tool: only useful for disproving regularity via contradiction.
Choosing the string s before knowing the adversary's pumping length p, or choosing a split (x, y, z) yourself.
The correct proof structure is: assume p is given by the adversary, THEN choose s (which may depend on p), and finally show that EVERY possible split the adversary could pick fails — you don't get to choose the split.
Quiz
Historical Background
The pumping lemma for regular languages emerged from the automata theory developed by Rabin, Scott, and others in the late 1950s, formalizing the pigeonhole-principle argument implicit in finite-state behavior. An analogous but distinct pumping lemma for context-free languages was proved by Yehoshua Bar-Hillel, Micha Perles, and Eli Shamir in 1961, extending the same repetition idea to grammars with a stack.
- 1959
Rabin and Scott's foundational work on finite automata implicitly contains the pigeonhole argument behind pumping
Michael Rabin, Dana Scott
- 1961
Bar-Hillel, Perles, and Shamir prove the pumping lemma for context-free languages
Yehoshua Bar-Hillel, Micha Perles, Eli Shamir
Summary
- Every regular language has a pumping length p beyond which accepted strings contain a repeatable ('pumpable') loop.
- The lemma gives three conditions on the split s = xyz: xyⁱz ∈ A for all i≥0, |y|>0, |xy|≤p.
- It is used via contradiction to prove languages like {0ⁿ1ⁿ} are NOT regular.
- Satisfying the pumping conditions is necessary but not sufficient for regularity — the lemma cannot prove a language regular.
Mathematics