Powered by Finite States*
A Finite State Automaton (FSA) has no memory. It only knows its current state. Feed it a string longer than its state count and, by the Pigeonhole Principle, it must revisit a state — creating a repeatable loop.
The Pumping Lemma weaponises that loop. If every string in a language can be "pumped" (its loop repeated endlessly) and still stay in the language, it might be regular. If we find even one string where pumping breaks it — the language is NOT regular.
A proof by contradiction. You vs. a hypothetical FSM that claims it can recognise a non-regular language.
Assumes the language is regular. Provides you with a pumping length p.
Carefully choose a string s ∈ L with |s| ≥ p. Classic choice: aᵖbᵖ.
Partitions s = xyz adhering strictly to |y|>0 and |xy|≤p. The y must fall in the aᵖ region.
Pump to n = 2. The result aᵖ⁺ᵏbᵖ has more a's than b's. It's NOT in the language. Contradiction. Q.E.D.
PUMPING LEMMA SIMULATOR
Interact with a live string-pumping visualisation of L = { PⁿDⁿ }
Context-Free Languages (CFLs) are more powerful than regular languages — they can be recognised by Pushdown Automata (PDAs) which have a stack for memory. But even PDAs have limits.
The CFL Pumping Lemma splits every sufficiently long string into five parts: s = uvxyz. Both v and y can be pumped simultaneously. If pumping breaks the language, it cannot be context-free.
Splits a string into 3 parts (x, y, z). Only the single loop segment y is pumped. Used to prove a language is not regular.
Splits a string into 5 parts (u, v, x, y, z). Two segments v and y are pumped simultaneously. Used to prove a language is not context-free.
The CFL pumping lemma proof mirrors the RL version but with a twist — two segments are pumped simultaneously, reflecting the left/right branches of a parse tree.
Assumes the language is context-free. Provides pumping length p (tied to the grammar's variable count).
Choose a string s ∈ L with |s| ≥ p. Classic: aᵖbᵖcᵖ (three-way balance).
Partitions s = uvxyz with |vxy| ≤ p and |vy| > 0. Since |vxy| ≤ p, v and y can touch at most 2 of the 3 symbol blocks.
Pump i = 2. Since v and y can't span all three symbols, pumping increases only 1 or 2 counts — the three-way balance is destroyed. Not in L. Contradiction. Q.E.D.
CFL PUMPING LEMMA SIMULATOR
Interact with a live CFL pumping visualisation of L = { aⁿbⁿcⁿ }