# CMPSCI 401: Theory of Computation

### David Mix Barrington

### Spring, 2009

# Homework Assignment #3

#### Posted Sunday 8 March 2009

#### Due on paper in class, Friday 27 March 2009

There are thirteen questions for 100 total points plus 10 extra
credit. All but three are from
the textbook, *Introduction to the Theory of Computation*
by Michael Sipser (second edition).
The number in parentheses following each problem
is its individual point value.

Students are responsible for understanding and following
the academic honesty
policies indicated on this page.

- Exercise 3.1, part d only (5)
- Exercise 3.2, part c only (5)
- Problem C-1 (15): Give a complete
state diagram for a (deterministic, one-tape)
Turing machine that implements the
**division algorithm** as follows.
If the machine is started in configuration
q_{0}0^{y}#0^{x} for some non-negative integer x and
some positive integer y, it should terminate in configuration
q_{a}0^{q}#0^{r} such that q and r are the unique
non-negative integers such that qy + r = x and r < y. (Everybody ought to,
*once* in their life, build a TM to do something non-trivial.)
- Problem C-2 (10): A
**two-stack PDA** is like an ordinary PDA except
that it has two stacks, and its Δ relation has transitions of the form
"if you are in state q, read a from the input, pop b from stack 1, and pop
b from stack 2, you may go to state r, push d onto stack 1, and push e onto
stack 2". Here a, b, c, d, and e might be letters or ε.
- (a,5) Indicate how a nondeterministic TM can simulate a two-stack PDA.
- (b,5) Indicate how a two-stack PDA can simulate a deterministic, one-tape
TM. What do (a) and (b) indicate about the class of languages defined by
two-stack PDA's?

- Problem 3.11 (10)
- Problem 3.13 (10)
- Problem 3.15, part e only (5)
- Problem 3.20 (10)
- Exercise 4.2 (10)
- Exercise 4.5 (5)
- Exercise 4.8 (5)
- Problem 4.10 (10)
- Problem C-3 (10XC) Let Σ = {a
_{i}: n ≥ 0} =
{a_{1}, a_{2},...} be a countably infinite alphabet. Prove
that the set Σ^{*}, consisting of all *finite* strings over
Σ, is countably infinite.

Last modified 8 March 2009