# Practice Midterm Exam, Spring 2010

### Directions:

• Answer the problems on the exam pages.
• There are five short problems, for ten points each, and three long problems for 25 points each. Attempt all the short problems and only two of the long ones -- the maximum score is thus 100. If you attempt all three long problems I will take the scores of the best two. Likely scale is A = 90, B = 70 but the actual scale will be determined after I grade the exam.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.

```  Q1: 10 points
Q2: 10 points
Q3: 10 points
Q4: 10 points
Q5: 10 points
Q6: 25 points
Q7: 25 points
Q8: 25 points

Total: max 100 points
```
Question 8 modified 4 March 2010 Error in Question 8 (c) corrected 10 March 2010

• Question 1 (10): A clocked Turing machine is one that is guaranteed to halt in some polynomial number p(n) of steps on any input of length n. Let X be the following language: {(M,x): M is a clocked TM and there exists a string y such that M(x,y) = 1}. Prove that X is an undecidable language. (Hint: Note that y is part of the input to M, and that there is no restriction on the length of y.)

• Question 2 (10): In Arora-Barak's proof of the Cook-Levin Theorem, they construct a CNF formula whose variables specify a series of "snapshots" and that is true if and only if the snapshots represent a valid computation. Part of the formula checks each snapshot z against the latest prior snapshot when the head was in the same position as it was for z. What must it check and why? And how does it determine which prior snapshot to check?

• Question 3 (10): The facility location problem takes as input an undirected graph with a positive integer weight for each vertex, and a positive integer t. The vertices represent possible locations for facilities, the weight of a vertex represents the value of a facility at that location, and an edge (u,v) means that vertices u and v cannot both have a facility. The output is a boolean that says whether it is possible to place facilities of total value at least t without any conflicts. Prove that this problem is NP-complete.

• Question 4 (10): Let A and B be two n by n matrices with boolean (0 or 1) entries. The matrix product AB is the n by n matrix C, where each entry Ci,j is the OR, over all k from 1 to n, of Ai,kBk,j. (Note that this is the same as the product of A and B under ordinary matrix multiplication using boolean arithmetic, with 1 + 1 = 1.) Prove that a deterministic Turing Machine can take input A and B and produce AB (on a write-only output tape, say) using space O(log n).

• Question 5 (10): Let G be a directed graph and v be a vertex in G. If k is any non-negative integer, the function NSIZE(G,v,k) gives the number of vertices w in G such that there is a path of length at most k from v to w. Outline a proof that the language {(G,v,k,m): NSIZE(G,v,k) = m} is in the class NL = NSPACE(log n).

• Question 6 (25): A one-d cellular automaton is a linear array of processors stretching arbitarily far in both directions, and operating synchronously. Each processor has the same state set Q, and on each time step each processor changes its state from its current state q to a new state δ(p,q,r), where p is the state of the processor to its left and r the state of the processor to its right. One of the states is a halt state, and the entire automaton stops when any processor enters the halt state. We start the automaton on a binary input string w = w1...wn by placing each letter wi in processor i. That is, the initial state of processor i is 0 if wi = 0, 1 if wi = 1, and 2 if there is no letter wi.

• (a,5) Argue that the language {(M,w): Cellular automaton M eventually halts on input w} is also the language of some Turing Machine (i.e., it is Turing recognizable).

• (b,10) Argue that if M halts on w in p(n) steps, where p is a polynomial, then your simulating Turing machine from part (a) will halt within q(n) steps, where q is some other polynomial.

• (c,10) Argue that if X is a language in P, there is a cellular automaton M such that on any input w of length n, M will halt within r(n) steps (where r is some polynomial) and the state of processor 0 when M halts will be 0 if w is not in X and 1 if w is in X.

• Question 7 (25): In this question you will prove a special case of the (deterministic) Space Hierarchy Theorem, that DSPACE(log n) is properly contained in DSPACE(log2 n).

• (a,10) Let M be a deterministic TM with k states and a tape alphabet of size m that uses space at most c log n on any input of length n. Explain briefly why a universal Turing machine, with a single state set and tape alphabet, can simulate M on inputs of size n using at most c' log n space, where c' is a constant depending only on k, m, and c.

• (b,5) Let M1, M2,... be a listing of all possible Turing machines (with read-only input and a single work tape), such that each machine appears infinitely often in the list. Describe a Turing machine D with space bound O(log2 n) whose language is not in DSPACE(log n). (Justifying this latter claim is part (c).)

• (c,10) Argue carefully that if any machine Mi always halts using at most c log n space for some c, your machine D cannot decide the same language as Mi.

• Question 8 (25): A space-oracle TM is an oracle machine with a write-only oracle tape. If it has an oracle for a language B, it can write a string w onto its oracle tape and then determine in one step whether w is in B, whereupon the oracle tape is cleared. It also has a read-only input tape and a work tape, and only the work tape counts as space. If B is any language, we define LB to be the languages decided by deterministic oracle machines for B using space O(log n), and NLB to be the languages of nondeterministic oracle machines for B using space O(log n).

• (a,10) Argue that if B is in the class L, then LB = L.

• (b,5) Argue that if B is in the class NL, then LB ⊆ NL.

• (c,5) Argue that NP ⊆ LSAT, quoting results from lecture as necessary.

• (d,5) It is probably not true that if B is in NP, then PNP ⊆ NP . Why doesn't an argument like that of part (b) show this to be true?