CS5371 Theory of Computation
CS5371 Theory of Computation
Homework 1
Due: 3:20 pm, October 13, 2006 (before class)
1. Assume that the alphabet is {0, 1}. Give the state diagram of a DFA that recognizes the
language {w | w ends with 00}.
2. Assume that the alphabet is {0, 1}. Give the state diagram of a DFA that recognizes the
language {w | w contains an equal number of occurrences of the substrings 01 and 10}.
3. Prove that the language {wp | p is prime} is not regular. (You may assume that the number
of primes is infinite.)
n o
4. Consider the language F = ai bj ck | i, j, k ≥ 0 and if i = 1 then j = k .
5. For languages A and B, let the perfect shuffle of A and B be the language
Show that the class of regular languages is closed under perfect shuffle.
(a) Show that if L is recognized by a DFA with k states, L has index at most k.
(b) Show that, if the index of L is a finite number k, it is recognized by a DFA with k
states.
(c) Conclude that L is regular if and only if it has finite index. Moreover, its index is the
size of the smallest DFA recognizing it.
1
8. (Bonus Question) If A is any language, let A 1 be the set of all first halves of strings in A
2
so that
A 1 = {x | for some y, |x| = |y| and xy ∈ A} .
2