# Pumping Lemma for Regular Languages

## Theorem

Let $\LL_3$ be the set of regular languages.

Then the following holds:

$\forall L \in \LL_3: \exists n_0 \in \N_0: \forall z \in L: \card z > n_0 \implies \exists u, v, w$ such that:

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

## Proof

### 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}: \card s \le \card {s_{maxlen} }$

Now choose $n_0 > \card {s_{maxlen} }$.

The implication now trivially holds because the premise:

$\paren {\card z > n_0}$

is false.

$\Box$

### For infinite languages

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

$(1): \quad$ There exists a finite automaton:
$F = \struct {\Sigma, Q, q_0, A, \delta}$
such that:
$\map \LL F = 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:
$\card s \ge \card Q$

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

Let $n_0 = \card Q + 1$.

Consider all prefixes of this $s$.

We have:

$\card s > \card Q$

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:

$\card {u v} = j - 1 < n_0$

And since $i \ne j$ it follows that:

$\card v > 0$

$\Box$

### 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.

$\blacksquare$