Lecture 04

A Non-regular Language

Thesis I Decision problems = languages

Thesis II Solving = recognizable by a finite automata

\(L=\{o^n1^n:n\geq 0\}\)

Theorem \(L_{0^n1^n}\) is not regular

Pigeonhole Principle If I have \(n\) pigeons and I put them in \(m\) boxes for any \(m<n\), at least one box contains more than one pigeon.

Proof By contradiction.

Assume there is a DFA \(M\) with \(m\) states, that recognize \(L_{0^n1^n}\). Consider the state in \(M\) \(r_0,...,r_m\) reached after reading \(\epsilon, 0, 00,...,0^m\).

By the pigeonhole principle, there exists \(0\leq k < l \leq m\) such \(r_k=r_l\).

So \(M\) is in the same state after reading \(0^k\) and \(0^l\), so it mush also be in the same state after reading \(0^kw\) and \(0^lw\) for any string \(w\in\{0,1\}^*\).

But then consider \(w=1^k\). Then \(M\) either accepts or rejects both \(0^k1^k\) and \(0^l1^k\). In either case, \(M\) does not recognized \(L_{0^n1^n}\) \(\Rightarrow\Leftarrow\).

Pumping Lemma

For any regular language \(L\), there exists \(p\geq 1\) (pumping length), such that every string \(s\in L\) of length at least greater than \(p\) can be expressed as \(s=xyz\) such that

  1. \(\forall i\geq 0\), \(xy^iz\in L\)
  2. \(|y|>0\)
  3. \(|xy|\leq p\)

Proof Let \(M\) be the smallest DFA that recognizes \(L\). Let \(m\) be the number of states in \(M\).

Set \(p=m\), fix any \(s\in L\) of length \(|s|>p\) by the pigeonhole principle, if \(r_0,...,r_p\) are the states reached in \(M\) after reading \(i=0,1,...,p\) symbols of \(s\), there exists \(0\leq k < l \leq p\) such that \(r_k=r_l\).

Let \(x=s_1,...,s_k\) \(y=s_{k+1},...,s_l\), \(z=s_{l+1},...,s_{|s|}\) we have that

  1. \(|xy|=l\leq p\)
  2. \(|y|\geq 1 > 0\) because \(l>k\)
  3. \(r_k=r_l\) mean that \(M\) reaches the same state after reading \(xw\) and \(xyw\) for any \(m\in\Sigma^*\).

In particular, with \(w=z\) we see that \(M\) reaches the same state on \(xz\) and \(xyz=s\). Since \(M\) accepts \(s\), it accepts \(xz\) as well.

When \(w=yz\), we see that \(M\) reaches same state on both \(xyz=s\) and \(xyyz\), so it accepts \(xyyz\).

Rest: Induction on \(i\geq 2\)

I step: Induction Hypothesis states that we have already shown \(xy^{i-1}z\in L\).

Now consider \(xy^iz\). Set \(w=y^{i-1}z\). Then \(M\) reaches the same state on both \(xy^{i-1}z\in L\) and \(xyy^{i-1}z=xy^iz\). So \(xy^iz\in L\) also.

Definition \(L\) has the pumping property if it satisfies the condition of the pumping lemma.

Using the Pumping Lemma

To show \(L\) is not regular, it suffices to show that it does not have the pumping property.

(Show that \(\forall p\geq 1\), there is a string \(s\in L\) of length \(|s|\geq p\) such that for any decomposition \(s=xyz\) with \(|y| > 0\) and \(|xy|\leq p\), there exists \(i\geq 0\) such that \(xy^iz\not\in L\))

E.g. \(L_{0^n1^n}\) is not regular

Proof For any \(p\geq 1\), we can choose \(s=0^p1^p\in L\).

Fix any decomposition \(s=xyz\) such that \(|y| > 0\) and \(|xy|\leq p\). In any such decomposition, \(y=0^j\) for some \(1\leq j\leq p\).

So when \(i=2\), \(xy^2z=0^{p+j}1^p\not\in L_{0^n1^n}\)


  1. \(L=\{w\in\{0,1\}^*:w\) has more \(1\)s that \(0\)s \(\}\)
  2. \(L=\{ww: w\in\{0,1\}^*\}\)
  3. \(L=\{1^{n^2}: n\geq 0\}\)

Glimpse Beyond