Professional Documents
Culture Documents
In what follows, we demonstrate that {0n 1n : n > 0} and similar Proof. Given any regular L, choose a DFA D = (Q, Σ, δ, s, F ) such
languages cannot be recognized by FAs. that L = L(D) and let k = |Q|.
The intuitive reason for this is that an FA may store information For a word w = w1 · · · wn ∈ L where the wi are in Σ, let q1 , . . . , qn
about the already read prefix of its input only by its state, hence be the sequence of states that occur during the processing of the
will not be able to distinguish such prefixes appropriately. input w , i.e., q0 = s and δ(s, w1 · · · wi ) = qi for i = 1, . . . , n.
This idea is made formal in the following pumping lemma.
w1 w2 w3 wn
Theorem (Pumping lemma for regular languages) q0 q1 q2 ··· qn
Pumping lemma for regular languages Pumping lemma for regular languages
Example 1 (Blocks of zeroes and ones of equal size) Example 2 (Equal number of zeroes and ones)
The language L1 = {0n 1n : n > 0} is not regular. The language L2 = {w ∈ {0, 1}∗ : #0 (w ) = #1 (w )} of all words
For a proof by contradiction, assume that L1 is regular and that contain as many zeroes as ones is not regular.
accordingly choose a constant k as in the pumping lemma. For a proof by contradiction, it suffices to observe that in case the
Then the word w = 0k 1k has a partition w = xyz as in the language L2 were regular, then the language
pumping lemma.
L1 = L2 ∩ {0m 1n : m, n}
Because of y 6= λ and |xy | ≤ k, it holds that y = 0` for
some ` > 0. were the intersection of two regular languages and hence itself
By the pumping lemma, then also regular, contradicting Example 1.
Alternatively, the nonregularity of L2 can be demonstrated by using
xy 0 z = xz = 0k−` 1k ∈ L1 the pumping lemma in an argument that is almost literally the
same as the one in Example 1.
contradicting the definition of L1 .
Pumping lemma for regular languages Pumping lemma for regular languages
Example 3 (Words of prime length)
Proposition (The pumping lemma and nonregular languages)
The language L3 = {w ∈ {1}∗ : |w | is prime} of all words of prime
length over the unary alphabet is not regular. There is a nonregular language for which the conclusion of the
pumping lemma is true.
For a proof by contradiction, assume that L3 is regular and
accordingly choose a constant k as in the pumping lemma and a Proof. Let L0 be any language over the alphabet {0, 1} and
prime number p ≥ k + 2. consider the language
Let w = xyz be a partition of w = 1p as in the pumping lemma. L = {0, 1}∗ ∪ {#k u : k ≥ 0 and u ∈ L0 } ⊆ {0, 1, #}∗ .
For m = |y |, it holds that 1 ≤ m ≤ |xy | ≤ k ≤ p − 2 (∗).
Then the conclusion of the pumping lemma holds with k = 1 for
By the pumping lemma, the word xy p−m z is in L3 , however its the language L because for every word w in L, if we write w = az
length cannot be prime because of for some symbol a ∈ {0, 1, #}, we have
|xy p−m z| = |xz| + |y | (p − m) = (m + 1) (p − m), ai z ∈ L for all i ≥ 0.
|{z} |{z} | {z } | {z }
|w |−|y |=p−m =m ≥2 by (∗) ≥2 by (∗)