This page is a catalogue of cases . The parent note gave you the skeleton; here we walk every kind of non-regularity proof you can meet, so no exam string surprises you. Prerequisites we lean on: Finite Automata (DFA NFA) , Pigeonhole Principle , and the pumping lemma statement itself .
Intuition What "every scenario" means here
The pumping-lemma game always has the same three moves: you pick w , the adversary picks the split w = x y z , you pick i . What changes from problem to problem is the shape of the trap you build . The matrix below lists every shape of trap. If you can build each one, you can attack any language they hand you.
Read this as: "what makes x y i z fall out of L ?" — the mechanism of the contradiction.
Cell
Case class
Trap mechanism
Which i
Example
A
Equal-count a n b n
pumping changes one block's count only
i = 2
Ex 1
B
Symmetry / palindrome
pumping breaks front–back mirror
i = 0
Ex 2
C
Sparse lengths (n 2 , 2 n , primes)
pumped length lands in a forbidden gap
i = 2
Ex 3
D
Multi-block relation (a n b m c ... )
$
xy
\le pp in s y$ to leftmost block
E
Degenerate / edge string (n = 0 , tiny p )
show the method still works at boundaries
—
Ex 5
F
Non-regular but PASSES the lemma (must NOT conclude regular)
pumping cannot fail — lemma gives no info
any
Ex 6
G
Real-world word problem (balanced brackets)
same as equal-count in disguise
i = 0
Ex 7
H
Exam twist: complement / intersection
pump the derived language, or use closure
i = 2
Ex 8
Every cell A–H below gets a full worked example. Cells that are geometric-on-the-automaton get a figure.
L = { a n b n : n ≥ 0 } is not regular
Forecast: if we add extra a 's but leave the b 's alone, will the counts still match? Guess before reading.
Step 1. Assume L regular, so a pumping length p ≥ 1 exists.
Why this step? The lemma only speaks if L is regular. We assume it to derive a contradiction.
Step 2. Choose w = a p b p . Note ∣ w ∣ = 2 p ≥ p and w ∈ L .
Why this step? We need one string that (a) is genuinely in L and (b) forces the adversary's hand. Packing p copies of a first means the "first p symbols" are all a .
Step 3. The adversary splits w = x y z with ∣ y ∣ ≥ 1 (condition 1) and ∣ x y ∣ ≤ p (condition 2). Since the first p symbols are all a , both x and y live inside the a -block. So y = a m with 1 ≤ m ≤ p .
Why this step? Condition 2 (∣ x y ∣ ≤ p ) is our leash on the adversary. We used it to guarantee y is pure a 's.
Step 4. Pump up, i = 2 : x y 2 z = a p + m b p .
Why this step? One extra copy of y adds m more a 's and touches no b . That is exactly the imbalance we want.
Step 5. Since m ≥ 1 (condition 1), we have p + m = p , so a p + m b p ∈ / L . But condition 3 demands x y 2 z ∈ L — contradiction.
Why this step? Condition 3 is the lemma's promise that pumping stays inside L ; producing a pumped string outside L is precisely what refutes the assumption that L is regular.
Verify: take p = 3 , m = 1 : pumped string is a 4 b 3 . Count check 4 = 3 ✓ (not in L ). The proof used only m ≥ 1 , so it holds for every legal split. ■ ⇒ L not regular.
Worked example Figure — Example 1's leash (described)
The figure below draws w = a 5 b 5 as ten coloured tiles: five blue a -tiles then five orange b -tiles. A gray double-arrow spans only the first p = 5 tiles, labelled "leash ∣ x y ∣ ≤ p ". A red rectangle wraps two of the a -tiles, labelled "y = a m trapped in a-block". A green arrow points from that region to the note "pump up i = 2 : extra a's, b's untouched". Takeaway to read off the picture: because the leash covers only a -tiles, the adversary's y can never reach the orange b -block.
L = { w w R : w ∈ { 0 , 1 } ∗ } is not regular
Forecast: if we delete a couple of leading 0 's, is the string still a mirror of itself? Guess.
Step 1. Assume regular ⇒ p exists.
Why this step? We are trying to prove non-regularity by contradiction, so we begin by supposing the opposite — that L is regular — which hands us a pumping length p to exploit.
Step 2. Choose s = 0 p 11 0 p . This equals u u R for u = 0 p 1 , so s ∈ L , and ∣ s ∣ = 2 p + 2 ≥ p .
Why? We want a long block of identical symbols at the front so the leash ∣ x y ∣ ≤ p (condition 2) traps y there.
Step 3. Adversary picks s = x y z , ∣ y ∣ ≥ 1 (condition 1), ∣ x y ∣ ≤ p (condition 2). First p symbols are all 0 , so y = 0 m , 1 ≤ m ≤ p .
Why? The leash again — y is pure leading zeros.
Step 4. Pump down , i = 0 : x y 0 z = 0 p − m 11 0 p .
Why i = 0 ? Here removing symbols is the cleaner attack: it shortens the front block while the back block stays at p , destroying the mirror. Pumping up would also work, but down is tidy.
Step 5. For 0 p − m 11 0 p to be a palindrome, front zeros must equal back zeros: p − m = p , impossible for m ≥ 1 . So it's not in L , contradicting condition 3.
Verify: p = 3 , m = 1 : 0 2 11 0 3 = 0011000 . Reverse it: 0001100 = 0011000 ✓ not a palindrome. ■
L = { a n 2 : n ≥ 0 } is not regular
Forecast: perfect squares are 0 , 1 , 4 , 9 , 16 , 25 , … — they spread further apart as they grow. If we bump a big square by a small amount, can it land on another square? Guess.
Step 1. Assume regular ⇒ p .
Why this step? Contradiction proof: assume the thing we want to disprove (L regular) so the lemma gives us a concrete p to attack.
Step 2. Choose w = a p 2 . Length p 2 is a perfect square, and p 2 ≥ p for p ≥ 1 .
Why? We attack near a large square where the gap to the next square is wide.
Step 3. Adversary: w = x y z , 1 ≤ m = ∣ y ∣ ≤ ∣ x y ∣ ≤ p (conditions 1 and 2).
Why? Here every symbol is a , so we can't pin where y is — but the leash (condition 2) still bounds how big y is: m ≤ p . That bound is the whole trick.
Step 4. Pump up, i = 2 : length becomes p 2 + m .
Why? Adds exactly m symbols, 1 ≤ m ≤ p .
Step 5. The next square after p 2 is ( p + 1 ) 2 = p 2 + 2 p + 1 . The gap is 2 p + 1 > p ≥ m . Hence
p 2 < p 2 + m < p 2 + 2 p + 1 = ( p + 1 ) 2 .
A length strictly between two consecutive squares is not a square. So a p 2 + m ∈ / L , contradicting condition 3.
Verify: p = 3 , m = 3 (largest allowed): 9 + 3 = 12 , and 9 < 12 < 16 ✓, 12 is not a perfect square ✓. ■
Worked example Figure — Example 3's gap argument (described)
The figure plots the perfect squares n 2 (blue dots joined by a line) against n = 0..6 , each dot annotated with its value 0 , 1 , 4 , 9 , 16 , 25 , 36 . Two dotted horizontal lines mark p 2 = 25 (green dot) and ( p + 1 ) 2 = 36 . A red dot at height 28 sits between them, labelled "p 2 + m = 28 lands in the gap: 25 < 28 < 36 — not a square". An orange double-arrow between the two dotted lines is labelled "gap = 2 p + 1 = 11 > p ". Takeaway to read off the picture: the gap between neighbouring squares (11 ) is bigger than the largest possible jump m ≤ p = 5 , so the pumped length can never reach the next square.
L = { a i b j c k : k = i + j } is not regular
Forecast: if we grow the a -block but keep the c -block fixed, does k = i + j survive? Guess.
Step 1. Assume regular ⇒ p .
Why this step? Standard proof-by-contradiction opening: suppose L regular so the lemma supplies a pumping length p we can turn against it.
Step 2. Choose w = a p b p c 2 p . Check: i = p , j = p , k = 2 p = i + j ✓, so w ∈ L , ∣ w ∣ = 4 p ≥ p .
Why? Put the a -block first so the leash pins y to the a 's; then pumping changes i but leaves k fixed.
Step 3. Adversary: w = x y z , ∣ x y ∣ ≤ p (condition 2). First p symbols are all a , so y = a m , m ≥ 1 (condition 1).
Why? The leash.
Step 4. Pump up, i = 2 : a p + m b p c 2 p . Now i ′ = p + m , j ′ = p , k ′ = 2 p .
Why? Extra a 's raise i + j to p + m + p = 2 p + m , but k stays 2 p .
Step 5. Need k ′ = i ′ + j ′ : 2 p = 2 p + m ⇒ m = 0 , contradicting m ≥ 1 . So the pumped string ∈ / L , contradicting condition 3.
Verify: p = 2 , m = 1 : a 3 b 2 c 4 . Test k = i + j : 4 = ? 3 + 2 = 5 , false ✓ (correctly rejected). ■
Worked example Figure — Example 4's block layout (described)
The figure draws w = a 2 b 2 c 4 (case p = 2 ) as eight tiles in three coloured blocks: two blue a -tiles, two orange b -tiles, four green c -tiles. A gray double-arrow spans only the first p = 2 tiles, labelled "leash ∣ x y ∣ ≤ p ", and a red rectangle wraps one a -tile labelled "y = a m pinned to leftmost block". Above the c -block a green bracket is labelled "k = 2 p fixed — pumping never touches it". A red arrow from the a -block to the relation "k = i + j " is annotated "pump i = 2 : i grows, k stays ⇒ relation breaks". Takeaway to read off the picture: the leash reaches only the a -block, so we can inflate i while k is frozen, guaranteeing k = i + j .
{ a n b n } contain the empty string, and does that break the proof?
Forecast: the string ε (length 0 ) is in L with n = 0 . Can the adversary force us to pump ε ? Guess.
Step 1. The lemma only constrains strings with ∣ w ∣ ≥ p . We are free to choose w ; we chose w = a p b p with ∣ w ∣ = 2 p ≥ p ≥ 1 . So w = ε .
Why this matters? Short strings (like ε , ab ) may pump fine — the lemma allows some strings to be pumpable. Non-regularity needs only one un-pumpable long string, and we control which one.
Step 2. Smallest legal p is 1 . If an adversary claims p = 1 : our w = a 1 b 1 = ab , ∣ w ∣ = 2 ≥ 1 . First 1 symbol is a , so y = a , m = 1 . Pump i = 2 : aab , which has 2 a 's and 1 b ⇒ ∈ / L .
Why check p = 1 ? We must beat every p ≥ 1 , including the smallest. The argument survives.
Step 3. Degenerate y ? Condition 1 (∣ y ∣ ≥ 1 ) forbids y = ε , so the adversary can never hand us an empty loop. The contradiction always uses m ≥ 1 .
Why this step? We close the last edge case — an empty loop would produce x y i z = w for all i and break the attack, but condition 1 rules it out.
Verify: p = 1 case: aab has a -count 2 , b -count 1 , 2 = 1 ✓ rejected. Boundary is safe. ■
L = { a i b j c k : i , j , k ≥ 0 , and ( i = 1 ⇒ j = k )} passes the pumping lemma but is not regular
Forecast: we will show every long string can be pumped and stay in L — so the lemma raises no alarm. Does that let us call L regular? Guess — this is the trap.
The forbidden situation in L is exactly: a -count equal to 1 while j = k . Every other string is in L , because the implication "i = 1 ⇒ j = k " is automatically true whenever i = 1 (a false hypothesis makes an implication true). Keep that single bad case in mind.
Step 1. We claim L satisfies the pumping lemma with pumping length p = 2 . To pass the lemma we must show: for every w ∈ L with ∣ w ∣ ≥ 2 , there is a split w = x y z with ∣ y ∣ ≥ 1 , ∣ x y ∣ ≤ 2 , such that x y i z ∈ L for all i ≥ 0 . We exhibit one good split per case.
Why this step? Passing the lemma is itself an ∃ -statement about a split; we must actually produce a working split for every witness w , not just assert it.
Step 2. Every w ∈ L has the form a i b j c k . Take w with ∣ w ∣ ≥ 2 . We choose the split by looking at the first symbol, so we always place y inside whichever block starts the string; this way the three adversarial regions (a -, b -, c -block) are all covered.
Why this step? This is the crux the reviewer wants: we must handle each block a loop could sit in, and the first-symbol rule tells us exactly which block y lands in.
Step 3 (Case i ≥ 2 ). The string starts with at least two a 's. Choose x = ε and y = a (so ∣ y ∣ = 1 , ∣ x y ∣ = 1 ≤ 2 ). Pumping gives a i − 1 + i p b j c k , where i p ≥ 0 is the pumping index (number of copies of y ). Its a -count is i − 1 + i p , which ranges over i − 1 , i , i + 1 , … as i p = 0 , 1 , 2 , … . Since i ≥ 2 , the smallest value is i − 1 ≥ 1 , and the value equals 1 only when i = 2 and i p = 0 .
Why this step? We must locate the one dangerous pumped string (the one whose a -count could hit 1 ).
Step 3b (removing the danger). If i = 2 , instead choose x = ε , y = aa (still ∣ x y ∣ = 2 ≤ 2 ). Now the a -count is i − 2 + 2 i p = 2 i p , taking values 0 , 2 , 4 , … — it never equals 1 . For i ≥ 3 , keep y = a : the a -count i − 1 + i p ≥ 2 for all i p ≥ 0 , so again it never equals 1 .
Why this step? The single criterion is "keep the a -count away from 1 ." Doubling the loop (y = aa ) when i = 2 shifts counts onto even numbers, dodging 1 ; for i ≥ 3 the count already starts at ≥ 2 , so a single-a loop is fine. Whenever the a -count is = 1 , the clause "i = 1 ⇒ j = k " is vacuously true, so x y i p z ∈ L .
Step 4 (Case i = 1 ). Then w = a b j c k with j = k (else w ∈ / L ). Choose x = ε , y = a (∣ x y ∣ = 1 ≤ 2 ). Pumping gives a i p b j c k . For i p ≥ 2 the a -count is ≥ 2 = 1 (clause vacuous, in L ); for i p = 1 we recover w (in L since j = k ); for i p = 0 we get b j c k with a -count 0 = 1 (clause vacuous, in L ). So all i p ≥ 0 stay in L .
Why this step? This handles the delicate i = 1 witnesses; pumping the lone a only ever moves the count to 0 or ≥ 2 , both of which switch the constraint off, or back to 1 where j = k already holds.
Step 5 (Case i = 0 ). Then w = b j c k (no a 's). The first symbol is b (or c if j = 0 ). Choose y = that first symbol, ∣ x y ∣ = 1 ≤ 2 . Pumping changes only the b -count (or c -count) and keeps the a -count at 0 ; since 0 = 1 the clause is vacuous, so every x y i p z ∈ L .
Why this step? This is the b -block / c -block adversarial region; pumping there never creates an a , so the special constraint stays switched off in all pumps.
Conclusion of passing. In every case (i ≥ 2 , i = 1 , i = 0 ) we produced a split whose pumps all remain in L . Hence L passes the pumping lemma — it gives us no contradiction.
Step 6 (but L is not regular). Intersect L with the regular language a b ∗ c ∗ (one a , then b 's, then c 's). This forces i = 1 , so the surviving strings are exactly { a b j c k : j = k } = { a b n c n : n ≥ 0 } — an equal-count language, non-regular by the Example 1 argument. Since regular languages are closed under intersection , if L were regular this intersection would be regular too — contradiction. So L is not regular.
Why this step? When pumping cannot fail, we switch tools: intersect with a regular set to isolate a known non-regular core, then use closure to transfer the contradiction back to L .
Verify (logic checks): with i = 0 , j = 2 , k = 5 the clause "i = 1 ⇒ j = k " has a false hypothesis, so it is true ⇒ b 2 c 5 ∈ L ✓. With i = 1 , j = 2 , k = 2 the hypothesis is true and j = k holds ⇒ abb cc ∈ L ✓. With i = 1 , j = 2 , k = 3 the hypothesis is true but j = k ⇒ abb ccc ∈ / L ✓ (this is the only kind of excluded string). ■
Common mistake The one-directional trap
Passing the pumping lemma never proves regularity. It is a necessary , not sufficient , condition. Example 6 is a language that passes yet is non-regular — so only failing the lemma proves non-regularity; to prove regularity you build a DFA/regex or use Myhill–Nerode Theorem .
Worked example The "matched parentheses" language
L = { ( n ) n : n ≥ 0 } is not regular — so a regex alone can't validate nesting.
Forecast: a text editor wants to check that every ( has a matching ) with correct nesting depth. Can a plain regex (= a DFA) do it? Guess.
Step 1. Model: symbol ( = a , symbol ) = b . Then L = { a n b n } — identical to Example 1. Assume regular ⇒ p .
Why this step? We recast brackets as letters so the equal-count machinery applies, then open the contradiction proof by assuming L regular to obtain a pumping length p we can exploit.
Step 2. Choose w = ( p ) p , length 2 p ≥ p .
Why? Front-load the opens; the leash (condition 2) pins y to opens.
Step 3. ∣ x y ∣ ≤ p (condition 2) ⇒ y = ( m , m ≥ 1 (condition 1). Pump down, i = 0 : ( p − m ) p .
Why i = 0 ? Removing opens leaves more closes than opens — unbalanced.
Step 4. ( p − m ) p has p − m opens and p closes; p − m = p , so it is not balanced ⇒ ∈ / L , contradicting condition 3.
Verify: p = 3 , m = 1 : (( ))) = ( 2 ) 3 has 2 opens, 3 closes ⇒ unbalanced ✓. Consequence: you need a stack — a pushdown automaton — hence the Pumping Lemma for Context-Free Languages governs bracket matching, not the regular one. ■
L = { w ∈ { a , b } ∗ : # a ( w ) = # b ( w )} (unequal a and b counts) is not regular.
Forecast: attacking " = " directly is awkward — pumping might keep the counts unequal. What language is easier to attack? Guess.
Step 1. Suppose L is regular. Regular languages are closed under complement , so the complement L = { w : # a ( w ) = # b ( w )} would also be regular.
Why this step? We open by assuming L regular (the contradiction hypothesis), then note closure under complement transfers regularity to L , which is a cleaner "= " target than the messy " = " of L .
Step 2. Now attack L . Assume it's regular ⇒ p . Choose w = a p b p ∈ L (equal counts), ∣ w ∣ = 2 p ≥ p .
Why? Standard equal-count front-loading so the leash traps y in the a -block.
Step 3. ∣ x y ∣ ≤ p (condition 2) ⇒ y = a m , m ≥ 1 (condition 1). Pump up, i = 2 : a p + m b p , counts p + m = p ⇒ ∈ / L , contradicting condition 3.
Why? Breaking equality is exactly what leaves L .
Step 4. So L is not regular. But we showed "L regular ⇒ L regular." Contrapositive: L not regular ⇒ L not regular.
Why this step? The closure fact runs both ways via its contrapositive, letting the contradiction about L rebound onto L .
Verify: p = 2 , m = 1 : a 3 b 2 , counts 3 = 2 ✓ leaves L ; and a 3 b 2 ∈ L (unequal) ✓ — consistent with L being the complement. ■
The diagram below (readable in words) shows the shared spine of every attack: you pick w depending on p → the constraint ∣ x y ∣ ≤ p pins y → then one of four traps fires (equal-count pumps up at i = 2 ; palindrome pumps down at i = 0 ; sparse-length uses the gap argument; multi-block breaks the relation) → each yields x y i z ∈ / L → contradiction, so L is not regular . A separate branch shows the Cell-F escape hatch: when pumping does not fail , you must instead use closure or Myhill–Nerode .
you pick w depending on p
palindrome: pump down i=0
sparse lengths: gap argument
multi-block: relation breaks
contradiction so L not regular
use closure or Myhill-Nerode
i
Up (i = 2 ) when you want to add symbols to one block (counts, gaps).
Down (i = 0 ) when removing symbols exposes broken symmetry (palindromes, front–back).
Recall In Example 3, why does
∣ y ∣ ≤ p matter rather than where y sits?
The string is all a 's, so we cannot pin the location of y ; but the leash bounds its size m ≤ p , and the gap between consecutive squares at p 2 is 2 p + 1 > p ≥ m , so the pumped length can't reach the next square.
Recall Example 6 passes the pumping lemma. What did we conclude and why?
Nothing about regularity from the lemma (passing is not sufficient). We proved non-regularity separately using intersection with the regular set a b ∗ c ∗ to isolate { a b n c n } , then closure under intersection.
Recall Example 8's trick in one line.
Complement turns " = " into "= "; attack the equal-count complement with pumping, then use closure under complement to transfer non-regularity back.
Recall Why is
w = ε never a problem for our proofs?
Because we always choose w ourselves with ∣ w ∣ ≥ p ≥ 1 , so our witness is never the empty string; and condition 1 (∣ y ∣ ≥ 1 ) forbids an empty loop, so the adversary can't hand us ε as the pumped piece either.