State and Prove the Pumping Lemma for Regular Sets

State and Prove the Pumping Lemma for Regular Sets

Verified Sources
Sep 12, 2026

The pumping lemma for regular sets is a structural property of regular languages (equivalently, regular sets of strings). It provides a necessary condition: every regular language admits a “pumping length” so that sufficiently long strings can be decomposed and iterated without leaving the language. A standard use is to prove that certain languages are not regular by contradiction.

We will present (i) a precise statement, (ii) the pumping property using a DFA proof, and (iii) a broader perspective connecting pumping to the finite-state nature of regular languages.

Key notions:

  • Regular set
  • Pumping length
  • Decomposition
  • DFA

Pumping Lemma for Regular Languages (DFA proof)

Statement (pumping lemma for regular languages)

Let LL be a regular language. Then there exists a constant p1p \ge 1 (the pumping length) such that for every string sLs \in L with sp|s| \ge p, there exist strings x,y,zx,y,z with:

  1. s=xyzs = xyz
  2. y1|y| \ge 1
  3. xyp|xy| \le p
  4. For all integers i0i \ge 0, the string xyizLxy^iz \in L.

This lemma formalizes the idea that, beyond a certain length, the DFA must revisit some state while processing the prefix of the string, enabling “pumping” of the segment between the repeated states.

Keywords for this section:

  • Pumping lemma
  • Factorization
  • Repetition of states
  • Closure under repetition

How the lemma is used

To show LL is not regular, assume it is regular, apply the lemma, and then pick a specific long string sLs\in L. If you can show that for every decomposition with y1|y|\ge1 and xyp|xy|\le p, pumping breaks membership, you get a contradiction.

Proof strategy (DFA + pigeonhole principle)

Because LL is regular, there exists a DFA M=(Q,Sigma,delta,q0,F)M=(Q,\\Sigma,\\delta,q_0,F) that recognizes LL. Let p=Qp=|Q|.

Take any sinLs\\in L with sgep|s|\\ge p. Consider the sequence of states reached by MM while reading the string from left to right. Since MM has only pp states, within the first pp input symbols the machine must repeat a state. The segment of input read between the two visits corresponds to the substring yy that can be pumped.

This proof is purely automata-theoretic and relies on:

  • existence of a DFA for regular languages
  • the pigeonhole principle on runs of length pp

DFA-based proof of the pumping lemma

  1. 1
    Step 1

    Since LL is regular, fix a DFA M=(Q,Σ,δ,q0,F)M=(Q,\Sigma,\delta,q_0,F) such that L(M)=LL(M)=L. Let p=Qp=|Q|.

  2. 2
    Step 2

    Let sLs\in L with sp|s|\ge p. Since MM accepts ss, the run of MM on ss ends in an accepting state.

  3. 3
    Step 3

    Write s=a1a2ans=a_1a_2\dots a_n with n=spn=|s|\ge p. Consider the sequence of states r0,r1,,rpr_0,r_1,\dots,r_p where r0=q0r_0=q_0 and rk=δ(rk1,ak)r_k=\delta(r_{k-1},a_k) for 1kp1\le k\le p.

  4. 4
    Step 4

    There are p+1p+1 states in the sequence (r0,,rp)(r_0,\dots,r_p) but only pp distinct states in QQ. Therefore, there exist indices 0i<jp0\le i<j\le p such that ri=rjr_i=r_j.

  5. 5
    Step 5

    Let x=a1aix=a_1\dots a_i, y=ai+1ajy=a_{i+1}\dots a_j, and z=aj+1anz=a_{j+1}\dots a_n. Then s=xyzs=xyz and y=ji1|y|=j-i\ge 1. Also, xy=jp|xy|=j\le p.

  6. 6
    Step 6

    Let δ\delta-run from state rir_i. Because ri=rjr_i=r_j, reading the block yy takes the machine from rir_i back to rir_i. Hence, for any i0i\ge 0, the run on xyizxy^iz follows the same sequence as on xyzxyz except that the loop induced by yy is repeated ii times. Therefore, MM ends in the same final state as it would on xyzxyz, so xyizLxy^iz\in L for all i0i\ge 0.

  7. 7
    Step 7

    All required conditions hold: s=xyzs=xyz, y1|y|\ge1, xyp|xy|\le p, and xyizLxy^iz\in L for every i0i\ge0. Thus LL satisfies the pumping lemma.

Formalizing the “same final state” argument

Let the DFA run on xyzxyz reach state rir_i after reading xx, then after reading yy reach again rj=rir_j=r_i. By induction, after reading yiy^i the DFA is still in rir_i. Consequently, the suffix zz moves the machine from rir_i to the same state it reaches on zz after the original ii-th visit. Since MM accepts xyzxyz, it also accepts xyizxy^iz for all ige0i\\ge 0.

We have therefore established the pumping property: forallsinL,sgep,existsx,y,z:s=xyz,yge1,xylep,forallige0,xyizinL.\\forall s\\in L,\\ |s|\\ge p,\\ \\exists x,y,z:\\ s=xyz,\\ |y|\\ge1,\\ |xy|\\le p,\\ \\forall i\\ge0,\\ xy^iz\\in L.

Keywords:

  • Loop state
  • [Induction on pumping factor]{def="Proving yiy^i keeps the run in the same state via repeated application"}
  • Acceptance
  • Run on input

Common mistake: pumping both sides

The lemma guarantees pumping the middle substring yy with xyp|xy|\le p and y1|y|\ge1. Pumping arbitrary parts of the string (e.g., prefix or suffix) is not supported by the theorem.

Where the xylep|xy|\\le p condition comes from

Because the repeated state is guaranteed among the first pp transitions, we can ensure that jlepj\\le p. By construction xy=a1dotsaj=j|xy|=|a_1\\dots a_j|=j, so xylep|xy|\\le p.

This matters: the lemma does not allow us to pump anywhere in the string—it forces the pumped section to lie within the first pp symbols of the input.

Mermaid view of how the repeated state yields a loop:

Keywords:

  • Prefix length bound
  • [Repeated-state loop]{def="A cycle in the DFA run enabling yy to be iterated"}

Alternative viewpoint: pumping as a consequence of finiteness

The pumping lemma is ultimately a manifestation of finite memory. A DFA has finitely many states; reading enough symbols forces repetition. The decomposed substring yy is precisely the segment that takes the automaton around a cycle. Pumping corresponds to traversing this cycle multiple times.

This is also why the lemma works for all equivalent regular model forms (e.g., regexes via DFA/NFA conversion, or right-linear grammars), because they all characterize the same class of languages.

Keywords:

  • Finite automaton
  • Cycle pumping
  • Equivalence of models

Constraints in the Pumping Lemma

What each condition guarantees

Edge cases and subtleties

Knowledge Check

Question 1 of 4
Q1Single choice

Let LL be regular. In the pumping lemma, we pick p=Qp=|Q| for a DFA with state set QQ. Which condition must the decomposition s=xyzs=xyz satisfy?