



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This document from cs 273 lecture 9 discusses how to prove that certain languages are not regular using closure properties. A motivating example of the language l = anbn and its non-regularity proof, as well as an explanation of the pumping lemma and its contrapositive. The document also covers examples of non-regular languages and their proofs using closure properties.
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Reminder: Exam Tuesday 19 Feb, 7-9 pm, 100 MSEB (Material Science and Engineering Building, 1304 W. Green St.). Please check for conflicts NOW. If you have one, send a note to Margaret Fleck explaining the nature of the conflict and including your schedule.
In this lecture, we will see how to prove that a language is not regular. This material is taken from Sipser section 1.4 and from the “closure properties” handout posted for lecture
We will see two methods for showing that a language is not regular. The “pumping lemma” shows that certain key “seed” languages are not regular. From these seed languages, we can show that many similar languages are also not regular, using closure properties.
Consider the language L =
anbn
∣ n^ ≥^0
. Intuitively, L can not be regular, because we
have to remember how many a’s we have seen before reading the b’s, and this can not be done with a finite number of states.
Claim 1.1 The language L =
anbn
∣ n ≥ 0
is not regular.
Proof: Suppose that L were regular. Then L is accepted by some DFA M = (Q, Σ, δ, q 0 , F ). Suppose that M has p states. Consider the string apbp. It is accepted using a sequence of states s 0 s 1... s 2 p. Right after we read the last a, the machine is in state sp. In the sub-sequence s 0 s 1... sp, there are p + 1 states. Since L has only p distinct states, this means that two states in the sequence are the same (by the pigeonhole principle). Let us call the pair of repeated states qi and qj , i < j. This means that the path through M’s state diagram looks like, where ap^ = xyz 1.
But this DFA will accept all strings of the form xypz 1 bp. That is, if |y| = m, it accepts all strings of length ap−m+jm, for any j ≥ 0. For any value of j other than 1, such strings are not in L. So our DFA M accepts some strings that are not in L. This is a contradiction, because L was supposed to accept L. Therefore, we must have been wrong in our assumption that L was regular.
2 The Pumping Lemma
The pumping lemma generalizes the above argument into a standard template, which we can prove once and then quickly apply to many languages.
Theorem 2.1 (Pumping Lemma.) Let L be a regular language. Then there exists an integer p (the “pumping length”) such that for any string w ∈ L with |w| ≥ p, w can be written as xyz with the following properties:
Proof: The proof is written out in full detail in Sipser, here we just outline it. Let M be a DFA accepting L, and let p be the number of states of M. Let w = c 1 c 2... cn be a string of length n ≥ p, and let the accepting state sequence (i.e., trace) for w be s 0 s 1... sn. There must be a repeat within the sequence from s 0 to sp, since M has only p states, and as such, the situation looks like the following.
So if we set z = z 1 z 2 , we now have x, y, and z satisfying the conditions of the lemma.
Which is equivalent to
∀p ∃w ∈ L |w| ≥ p and
∀x, y, z
w = xyz, |xy| ≤ p, |y| ≥ 1 ,
=⇒ ∃i xyiz /∈ L.
(^) =⇒ L is not regular.
The translation into words is the contrapositive of the Pumping Lemma (stated in The- orem 3.1 below).
Theorem 3.1 (Pumping Lemma restated.) Consider a language L. If for any integer p ≥ 0 there exists a word w ∈ L, such that |w| ≥ p, and for any breakup of w into three strings x, y, z, such that:
implies that there exists an i such that xyiz /∈ L, then the language L is not regular.
Let us assume that we want to show that a language L is not regular. Such a proof is done by contradiction. To prove L is not regular, we assume it is regular. This gives us a specific (but unknown) pumping length p. We then show that L satisfies the rest of the contrapositive version of the pumping lemma, so it can not be regular. So the proof outline looks like:
Notice that our adversary picks p. We get to pick w whose length depends on p. But then our adversary gets to pick the specific division of w into x, y, and z.
4 Examples
Claim 4.1 The language L = anbn^ is not regular.
Proof: For any p ≥ 0, consider the word w = apbp, and consider any breakup of w into three parts, such that w = xyz |y| ≥ 1, and |xy| ≤ p. Clearly, xy is a prefix of w made out of only as. As such, the word xyyz has more as in it than bs, and as such, it is not in L. But then, by the Pumping Lemma (Theorem 3.1), L is not regular.
Claim 4.2 The language L =
ww
∣ w^ ∈^ Σ∗
is not regular.
Proof: For any p ≥ 0, consider the word w = 0 p 10 p 1 , and consider any breakup of w into three parts, such that w = xyz |y| ≥ 1, and |xy| ≤ p. Clearly, xy is a prefix of w made out of only 0 s. As such, the word xyyz has more 0 s in its first part than the second part. As such, xyyz is not in L. But then, by the Pumping Lemma (Theorem 3.1), L is not regular.
Consider the word w used in the above claim:
5 Proofs using closure properties
If we know certain seed languages are not regular, then we can use closure properties to show other languages are not regular. We remind the reader that homomorphism is a mapping h : Σ 1 → Σ∗ 2 (namely, every letter of Σ 1 is mapped to a string over Σ 2 ). We showed that if a language L over Σ 1 is regular, then the language h(L) is regular. We referred to this property as closure of regular languages under homomorphism.
Claim 5.1 The language L′^ = { 0 n 1 n^ | n ≥ 0 } is not regular.
7 A note on finite languages
A language L is finite if has a bounded number of words in it. Clearly, a finite language is regular (since you can always write a finite regular expression that matches all the words in the language). It is natural to ask why we can not apply the pumping lemma Theorem 2.1 to L? The reason is because we can always choose the threshold p to be larger than the length of the longest word in L. Now, there is no word in L with length larger than p in L. As such, the claim of the Pumping Lemma holds trivially for a finite language, but no word can be pumped - and as such L stays finite. So the pumping lemma makes sense even for finite languages!