You are on page 1of 2

Practice Problems

1. Give the description of a one tape Turing machine, which on input w outputs wwR , where wR is the
reversal of w. Assume that w is a string in {a, b}∗ .

2. Formally define a Turing machine with a 2-dimensional tape, its configuration and its computation.
Define what it means for such a machine to decide a language L. Show that t steps of this machine,
starting from an input of length n, can be simulated by a standard Turing machine in time that is
polynomial in t and n.

3. Describe a 3-tape Turing machine which, when started with two binary (positive) integers separated
by a ‘;’ on its first tape, computes their product.

4. Show that the class of recursive languages is closed under union, concatenation and Kleene star.
Show the same for recursively enumerable languages.

5. Describe a non-deterministic Turing machine accepting the language {wwR uuR : w, u ∈ {a, b}∗ }.

6. Recall that a function f : Σ? → Σ? is recursive if it can be computed by a Turing machine (which has
to halt on all inputs). The busy-beaver function f : N → N (where N is the set of natural numbers)
is defined as follows: for each integer n, β(n) is the largest number m such that there is a Turing
machine with alphabet {a, b} and with exactly n states which, when started with the blank tape,
eventually halts at the configuration (h, .tam ), where h is a halting state.

(a) Show that, if f is any recursive function, then there is an integer kf such that β(n + kf ) ≥ f (n).
(Hint: kf is the number of states in the Turing machine Mf , which when started with input an ,
halts with af (n) on its tape.)
(b) Show that β is not recursive. (Hint: suppose it were. Then so would be f (n) = β(2n). Now use
the previous part. )

7. Show that it is an undecidable problem to determine, given a turing machine M , whether there is
some string w such that M enters each of its states during its computation on the input w.

8. We say that a Turing machine uses k tape squares on an input string w if and only if the rightmost
tape square that is visited by its tape head lies k positions from the beginning of the tape.

(a) Show that the following problem is solvable (i.e., recursive): Given a Turing machine M , an
input string w, and a number k, does M use k tape squares on input w ?
(b) Suppose that f : N → N is a recursive function: Show that the following problem is solvable:
Given a Turing machine M and an input string w, does M use f (|w|) squares on input w ?
(c) Show that the following problem is undecidable: Given a Turing machine M and an input string
w, does there exist a k ≥ 0 such that M does not use k tape squares on input w (i.e., does M
use a finite amount of tape on input w) ?

9. Which of the following problems about Turing machines are solvable, and which are undecidable ?
Give reasons.

(a) Given a Turing machine M , state q and a string w, does M ever reach the state q when started
on input w from its initial state ?
(b) Given a Turing machine M , and a symbol a, does M ever write the symbol a when started on
the empty tape ?
(c) Given a Turing machine M , and a string w, does M ever move its head left when started with
input w ?

10. Show that it is undecidable to determine, given two CFG’s G1 and G2 , whether there is a string which
is generated by both the grammars. (Hint: describe two PDAs which accept configurations of the
form #C0 #C1 # . . . #Cn , where Ci ’s are the configuration of a Turing machine and C1 , C3 , C5 , . . . are
written in the reverse order. One of the PDA should show that every even numbered configuration
follows from the previous one, and the other PDA should do this for the odd numbered configuration).

11. We say that a Turing machine M enumerates a language L if and only if, for some state q of M ,

L = {w : (s, .t) `M (q, .tw)}.

(a) Show that a language L is recursively enumerable if and only if there is a Turing machine which
enumerate L.
(b) Suppose L is recursively enumerable. Show that there is a Turing machine which enumerates it
without ever repeating an element of the language L.
(c) Let Σ be an alphabet not containing the symbol ‘;’. Let L be a subset of Σ? ; Σ? . Show that the
language L0 = {x ∈ Σ? : x; y ∈ L for some y ∈ Σ? } is recursively enumerable. Is L0 necessarily
recursive if L0 is recursive ?

12. Let Σ0 and Σ1 be two alphabets. Suppose f : Σ?0 → Σ?1 is a recursive onto function. Show that there
is a recursive function g : Σ?1 → Σ?0 such that f (g(w)) = w for each w ∈ Σ?0 .

13. Let P denote the set of languages which can be decided in polynomial time. Show that P is closed
under union, intersection, concatenation and Kleene star. Prove the same for the class N P .

14. Show that SAT is polynomial time reducible to 3-SAT.

You might also like