Pumping Lemma for Regular Languages

Theorem
Let $\mathcal L_3$ be the set of regular languages.

Then the following holds:

$\forall L \in \mathcal L_3: \exists n_0 \in \N_0: \forall z \in L: \left|{z}\right| > n_0 \implies \exists u, v, w$ such that:


 * $z = u \cdot v \cdot w$
 * $\left|{v}\right| > 0$
 * $\left|{u v}\right| < n_0$
 * $\forall i \in \N_0: u \cdot v^i \cdot w \in L$

For finite languages
For any finite regular language $L_{fin}$, the proof is simple.

Let $s_{maxlen} \in L_{fin}$.

Thus:
 * $\forall s \in L_{fin}: \left|{s}\right| \le \left|{s_{maxlen}}\right|$

Now choose $n_0 > \left|{s_{maxlen}}\right|$.

The implication now trivially holds because the premise:
 * $\left({\left|{z}\right| > n_0}\right)$

is false.

For infinite languages
For any one infinite regular language $L_{inf}$, the following holds:


 * $(1): \quad$ There exists a finite automaton:
 * $F = \left({\Sigma, Q, q_0, A, \delta}\right)$
 * such that:
 * $\mathcal L \left({F}\right) = L_{inf}$.

See Equivalence of Finite Automata and Regular Languages for a demonstration of this.


 * $(2): \quad$ There exists an infinite number of words $s \in L_{inf}$ with:
 * $\left|{s}\right| \ge \left|{Q}\right|$

Let $s \in L_{inf}$ be one of these words.

Let $n_0 = \left|{Q}\right| + 1$.

Consider all prefixes of this $s$.

We have:
 * $\left|{s}\right| > \left|{Q}\right|$

Thus from the Pigeonhole Principle, for at least two of them $F$ needs to end in the same state.

Let the first two indices in $s$ for which this is the case be $i$ and $j$.

The difference between $prefix_i$ and $prefix_j$ ($v$ in this formulation of the theorem) is a "loop" in $F$.

This loop can be traversed any number of times (including 0) and $F$ will still be in the same state immediately afterwards.

Hence:
 * $\forall i \N_0: u v^i w \in L_{inf}$

Furthermore:
 * $\left|{u v}\right| = j - 1 < n_0$

And since $i \ne j$ it follows that:
 * $\left|{v}\right| > 0$

General case
Since it could be shown that the theorem holds for both all finite and all infinite regular languages, it can be stated that it holds for all regular languages.

Also see

 * Formal Language is not necessarily Regular, which follows from this result.