Homework 2
CS 310
Spring 2000
Craig A. Rich


Solve the following problems from chapters 3 and 4 of Martin, "Introduction to Languages and the Theory of Computation."

1
(Exercise 3.21, Martin) For the DFAs (a) and (d) pictured in Figure 3-11,

i) Describe, by writing a regular expression, the strings that cause the DFA to be in each state;
ii) Give a regular expression that denotes the language accepted by the DFA.

2
(Exercise 3.22, Martin) For each of the following languages, draw a DFA that accepts the language.

a) The language of all strings containing exactly two 0's.
b) The language of all strings containing at least two 0's.
c) The language of all strings that do not end with 01.
d) The language of all strings that begin or end with 00 or 11.
e) The language of all strings containing no more than one occurrence of the string 00. (The string 000 should be viewed as containing two occurrences of 00.)
f) The language of all strings in which the number of 0's is even.

3
(Exercise 3.24, Martin) Draw a DFA that recognizes the language of all strings of 0's and 1's of length at least 1 that, if they were interpreted as binary representations of integers, would represent integers evenly divisible by 3. Leading 0's are permissable.

4
(Exercise 3.25, Martin) Suppose M is the DFA (Q, Σ, q0, A, δ).

a) Using induction on the length of y, show that for any x and y in Σ*, and any q in Q,
δ*(q,xy) = δ**(q,x),y).
b) Using induction on the length of x, show that if δ(q,a) = q for every a in Σ, then for every x in Σ*, δ*(q,x) = q.
c) Using induction on n, show that if δ*(q,x) = q, then for every n >= 0, δ*(q,xn) = q.

5
(Exercise 4.1, Martin) An NFA with states 1-5 and input alphabet {a,b} has the following transition table.

qδ(q,a)δ(q,b)
1{1,2}{1}
2{3}{3}
3{4}{4}
4{5}{}
5{}{5}

a) Calculate δ*(1,ab). Show all work.
b) Calculate δ*(1,abaab). Show all work.

6
(Exercise 4.6, Martin) Can every regular language not containing Λ be accepted by an NFA having only one accepting state? Prove your answer.