The Pumping Lemma
Statement
Theorem (Pumping Lemma for Regular Languages):
Let be a regular language. There exists (the pumping length) such that for every with :
can be written as where:
- (so )
- for all
Intuition
If a string is long enough and the language is regular, then some part of the string can be “pumped” (repeated) any number of times while staying in the language.
The pumped part corresponds to a loop in an accepting computation of the DFA.
Proof Idea
Let be a DFA for with .
Set .
For any with : the computation visits states in sequence. By the pigeonhole principle, some state is visited twice.
The part of that causes the loop can be pumped.
Formal Argument
Path through DFA: .
Since states are visited, but there are only states, some for .
Let (before the loop), (the loop), (after).
- Condition 1: Loop occurs within first states, so
- Condition 2: , so
- Condition 3: Repeating or omitting the loop keeps the computation in the accepting state
Using the Pumping Lemma
To Prove Non-regularity
- Assume is regular with pumping length
- Choose a string with
- Show that for ALL possible decompositions satisfying conditions 1 and 2:
- There exists such that
- Conclude: contradiction, so is not regular
Key Point
You must show that the pumping lemma fails for every possible choice of satisfying the conditions.
Application:
Proof
Assume is regular with pumping length .
Choose (in , length ).
For any decomposition with and :
- Since , the substring consists of only ‘s
- Thus for some
Consider :
- Number of ‘s is
- Number of ‘s is
- Not equal, so
Contradiction. Thus is not regular.
Application:
Proof
Assume is regular with pumping length .
Choose (in , length ).
For any decomposition with and :
- means lies within the first (actually, within first )
- So for some
Consider :
- This is not of the form (different lengths of prefix)
- Alternatively: after pumping, the string is , not a square
Contradiction.
Application:
Proof
Choose .
The pumped string is for some with .
We need to be a perfect square.
But for .
So .
Limitations of the Pumping Lemma
The pumping lemma is a necessary condition for regularity, not sufficient.
Some non-regular languages satisfy the pumping lemma conditions.
For proving non-regularity, use:
- Pumping lemma
- Myhill-Nerode theorem
- Closure properties
Summary
- Pumping lemma: long strings in regular languages have pumpable parts
- Proof uses pigeonhole principle on DFA states
- Use: assume regular, find a counterexample string, show pumping fails
- Applications: , , are not regular
- Not a characterisation: necessary, not sufficient