$30
CS 334: Problem Set 5.
Problem 1. (10 points) Use the pumping lemma to prove that the language {0
2
π
: π ≥ 0} is not
regular. The language consists of strings of 0’s whose lengths are powers of 2. Be sure to
include all details of your proof.
Problem 2. (10 points) Prove that the language π΅ = {0
π1
π
: π ≠ π} is not regular. Do not use the
pumping lemma. Instead, consider how π΅ is related to the non-regular language {0
π1
π
: π ≥ 0}.
Problem 3. (10 points) The pumping lemma says that every regular language has a pumping
length π, such that every string in the language can be pumped if it has length π or greater. If π
is a pumping length for regular language π΄, then so is any length π
′ ≥ π. The minimum
pumping length for π΄ is the smallest π that is a pumping length of π΄.
For example, the pumping length of 01∗
cannot be 1 because the string π = 0 of length 1
cannot be pumped to give another string in the language. But, any string of length 2 or more
can be pumped by choosing π₯ = 0, π¦ = 1, πππ π§ to be the rest of the string.
What is the minimum pumping length for each of the following languages? Justify your answer
in each case.
1. 0001∗
2. 0
∗1
∗
3. 0
∗1
∗0
∗1
∗ ∪ 10∗1
4. (01)
∗
5. 1
∗ 01∗ 01∗
Problem 4. (10 points) Give context-free grammars that generate the following languages (the
alphabet in each case is {0,1}):
1. {π€: π€ = π€
π
}, the language of palindromes
2. {π€: π€ π π‘πππ‘π πππ ππππ π€ππ‘β π‘βπ π πππ π π¦ππππ}
3. {π€: π€ ππππ‘ππππ ππππ 0
′
π π‘βππ 1
′
π }