October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Pumping Lemma Explained: How to Prove a Language Isn’t Regular

A sound pumping-lemma proof assumes regularity, chooses a long witness string, and shows every permitted split can be pumped outside the language.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To prove a language is not regular with the pumping lemma, assume it is regular, take the pumping length supplied by that assumption, and choose a long string in the language. Then show that every split permitted by the lemma can be pumped to produce a string outside the language. The crucial point is that you must handle every valid split—not just a convenient one.

What the pumping lemma says

If a language L is regular, there is an integer p ≥ 1 such that every string w in L with |w| ≥ p can be written as w = xyz, satisfying:

As an Amazon Associate I earn from qualifying purchases.

  • |xy| ≤ p
  • |y| > 0
  • xyiz is in L for every integer i ≥ 0

Here, y is a nonempty part of the string that can be repeated or removed. The condition |xy| ≤ p confines it to the first p symbols. The lemma follows from the behavior of a deterministic finite automaton: in a sufficiently long accepted input, a state repeats, forming a loop that can be traversed more or fewer times.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The proof pattern

  1. Assume regularity. This assumption gives you a pumping length p.
  2. Choose a string. Pick w in the language with |w| ≥ p, chosen so the lemma’s split constraints have useful consequences.
  3. Consider every permitted split. Let w = xyz be any decomposition satisfying |xy| ≤ p and |y| > 0.
  4. Choose a pump count. Show that for each such split, at least one value of i ≥ 0 makes xyiz fall outside the language.
  5. Reach a contradiction. The lemma says every pumped string must remain in the language. If one must leave, the assumption that L is regular is false.

The quantifiers determine who controls each choice: the assumption supplies p; you choose w after p is fixed; then the argument must defeat every valid decomposition. Only after considering a decomposition do you choose a pump count that breaks membership.

Worked example: equal numbers of zeros followed by ones

Consider L = {0n1n | n ≥ 0}. Each string has a block of zeros followed by an equally long block of ones. We will show that this language is not regular.

  1. Assume, for contradiction, that L is regular, and let p be its pumping length.
  2. Choose w = 0p1p. It belongs to L and is at least p symbols long.
  3. Take any valid split w = xyz. Since |xy| ≤ p, the parts x and y lie within the first p symbols, all of which are zeros. Since |y| > 0, y contains at least one zero and no ones.
  4. Set i = 2. Repeating y adds zeros without adding any ones, so xy2z has more zeros than ones and is not in L.

This works for every valid split, contradicting the requirement that all pumped strings stay in L. Therefore, L is not regular.

Rank #2
Sale

Common mistakes to avoid

  • Choosing one convenient split: A regular language needs only one valid split to satisfy the pumping property. To contradict it, your proof must show that every split meeting the constraints fails for some pump count.
  • Choosing the pumping length yourself: The assumed regularity supplies p. Your witness string must be selected after that value is fixed.
  • Checking only one pump count: The lemma requires membership for every i ≥ 0. Your proof needs a value that breaks membership for each candidate split; that value may depend on the split.
  • Treating the lemma as a test for regularity: It gives a necessary property of regular languages, not a complete characterization. A language that satisfies the pumping property is not thereby proved regular.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to use Myhill–Nerode instead

The pumping lemma is not guaranteed to prove every nonregularity claim. Myhill–Nerode provides a full characterization: a language is regular exactly when its indistinguishability relation has finitely many equivalence classes. To prove nonregularity with this method, construct infinitely many prefixes that are pairwise distinguishable by suffixes. See the Boston University CS 332 Myhill–Nerode handout for the theorem and its contrast with the pumping lemma.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For instance, the language {aibj | i ≥ j} is an example for which a pumping-lemma nonregularity argument can fail, while distinguishable prefixes can be used to show nonregularity. A failed pumping-lemma attempt says only that this proof technique did not establish the claim; it does not show that the language is regular. The University of Central Florida COT 4210 Myhill–Nerode handout discusses this limitation.

Choose between the methods based on the proof obligation: the pumping lemma requires reasoning about all permitted decompositions of a chosen string, while Myhill–Nerode requires an infinite family of pairwise distinguishable prefixes. Use whichever yields the shorter, clearer argument for the language at hand.

Quick Recap

Rank #4

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.