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 text is in black, solutions in blue.
Let P2 be the class of languages that can be decided in polynomial time by a two-dimensional Turing machine. Prove that P2 = P.
We first need to show that P is contained in P2, which is easy but
can't be forgotten. If X is an arbitrary language in P, we know from [AB] that
X = L(M) for some poly-time
single-tape Turing machine M. We can implement M on a 2DTM
by using a machine that never moves its head up or down, and simulates the tape
of M on the first row of its two-dimensional memory. The simulation is
step-for-step and thus poly-time.
The harder direction is to simulate M, an arbitrary poly-time 2DTM, with an
ordinary poly-time Turing machine M'. Let T(n) be a polynomial bound on the
running time of M. We need to indicate how M', which can have only a constant
number of tapes, can simulate the memory and actions of M. There are at least
three good ways to do this:
We need to simulate the finite number of computation steps of M on some
ordinary TM, called M'. The key concept of this simulation is how we simulate
M's memory, a finite string of characters from an infinite alphabet, on the
k tapes of M'. The simplest way to do this is to represent each character
ai of M by a string of characters from a fixed alphabet, such as
a(binary for i) or abi. Then a step of M is simulated by reading
this character, transferring it to a worktape, running the given Turing machine
to compute δ(q,ai), and writing the string representation of
the new character to the memory tape of M'. (This last may require moving
text to make room.) Once we show how to simulate each step of M by finitely
many steps of M' (including the steps of the δ-machine), we know that the
entire computation of M' halts after finitely many steps.
Note that even if we assume that M and the δ-machine are
polynomial-time TM's, we can't guarantee that this
M' is polynomial time. If the
transition function can change a letter ai to another letter
aj whose string representation is twice as long, in polynomially
many steps we could create a letter with an exponentially long string
representation.
Prove that PL is in the class NP and that UPL is in the class PH. What is the size of your input string, as a function of n?
Let X be the partially filled array given as input.
A certificate for PL consists of a complete array Y, and the verifier
M(X,Y) returns 1 if Y is a Latin square and every filled entry of X is the
same in Y. Testing the Latin square property takes O(n3) operations
on numbers of O(log n) bits, and testing the agreement takes only
O(n2) such operations, so the verifier is polynomial time and X is
in PL if and only if ∃Y: M(X,Y) = 1.
A partially filled array X is in UPL if and only if there exists a Latin
square Y that agrees with the filled entries of X, and there does not
exist any complete array Z that is a Latin square, agrees with X, and is not
identical to Y. We can make a poly-time verifier M(X,Y,Z) that outputs 1 if
and only if Y is a Latin square extension of X and either Z is not
a Latin square extension of X or (Y = Z) -- this is no more complicated
than the verifier above. Then X is in UPL if and only if
∃Y: ∀Z M(X,Y,Z) = 1. We have thus shown UPL to be in the class
Σp2, which is contained in the class PH.
The input is an array with up to n2 numbers, each requiring
O(log n) bits to write since they are in {1,...,n}, so the input size is
O(n2 log n).
We first count the number of each kind of letter in the input with a binary
counter, so that we have the numbers m, x, i, and y on the worktape. Since
each of these numbers is at most n, they can each be represented in O(log n)
bits. We then have to compute xi modulo m and compare it with
y modulo m.
We saw in lecture that we can multiply positive integers in logspace even if
they have polynomially many bits, and we can reduce a number modulo m in
logspace if it has O(log n) bits, by just repeated subtracting m from it until
it is less than m. So we can get y modulo m easily, and we can get
xi modulo m by the pseudocode:
There are faster ways to carry out the computation but we are only worried
about space. About the only wrong way to do this would be to try to compute
xi first as an integer, then reduce it modulo m -- this could
require up to i(log n) bits for the intermediate results, even using repeated
squaring.
z = 1;
for (j = 0; j < i; j++)
z = (z*x) % m;
The input (G,t) is in the language CFL if and only if there is a strategy for the first player that lets her place facilities with total weight at least t, no matter how the second player plays.
Prove that the language CFL is in the class ATIME(p(n)) for some polynomial p. In what deterministic complexity class can you place this language?
We define an ATM game where White and Black alternately name vertices by
guessing sequences of O(log n) bits. White wins the game if Black is the first
to pick a vertex connected by an edge to a previously picked vertex, or if no
edge violation occurs and her node weights total to at least t at the end. The
game takes polynomial (at most n log n) time for the guesses, and the winner
can clearly be checked in polynomial time by checking each pair of chosen
vertices against the input graph and by adding up White's weights.
Clearly White wins the ATM game under optimal play if and only if the first
player has a strategy to get total value at least t if and only if the input
(G,t) is in the language CFL.
We know ATIME(p(n)) is contained in PSPACE, since a deterministic
machine could evaluate the entire game tree for the game using recursion -- the
depth of the recursion would be the number of moves (polynomial) and each step
of the recursion would require only polynomial space on the stack. The language
is probably not in the class PH, and is certainly not shown to be there
by this ATM game, since the game has up to O(n) alternations between White
and Black moves.
A certificate showing a pair (G,k) to be in LONG-SIMPLE-PATH is simply a listing of the sequence of vertices in a path of length k. If k ≤ n-1, a poly-time verifier can check that the sequence is a valid path in G, is simple, and has length k. If k > n-1, there can be no simple path with k edges (as it would have k+1 > n vertices on it), and we can reject the input whatever certificate is offered. Clearly (G,k) is in LSP if and only if a valid, polynomial-length certificate exists.
We can reduce the language DHAMPATH, proved in [AB] to be NP-complete, to LSP. An input to DHAMPATH is a directed graph G, and G is in DHAMPATH if and only if there exists a simple path in G containing all n vertices and thus having exactly n-1 edges. So G is in DHAMPATH if and only if the pair (G,n-1) is in LSP, and clearly this reduction can be computed in polynomial time. We have that DHAMPATH ≤p LSP, and thus LSP is NP-hard.
If n is the size of the input string (G,k), we know that k ≤ n and that
G has at most n vertices. So we can store both a counter up to k and a constant
number of vertex names on our logspace worktape. Define a valid read-once
certificate to be a path of length k, given as a sequence of k+1 vertices.
We can test that the path is valid in a read-once way by checking that
each vertex has an edge to the next vertex (this requires having both on a
worktape at once), and counting up to k to check the path length. In [AB]
it is shown that a language is in NL if and only if we can define a read-once
certificate language that can be checked in logspace.
The restriction that k is in unary is actually not needed to solve the
problem -- that is, LONG-PATH with k in binary is still in NL.
If k is larger than the number of vertices in G, then a path of
length k exists if and only if a cycle exists, and we could let any cycle be
a certificate in that case.
Q1x1:Q2x2:... Qmxm: φ(x1,...,xm),
where each Qi is a quantifier (∃ or ∀), each xi is a boolean variable, and φ is a formula using boolean variables, constants 0 and 1, and operators ∧, ∨, and ¬.
Given any deterministic (or even nondeterministic) TM M running in space S(n) and an input x of size n, we can imagine (not write down) a configuration graph with 2O(S(n)) nodes, such that there is a path from the start node to the accept node of this graph if and only if x is in L(M). We can then define a quantified boolean formula expressing this path property using middle-first search -- a path of length 2z from vertex u to vertex v exists if and only if there exists a node w such that there are paths of length z both from u to w and from w to v. We recursively rewrite the formula, reusing variables to keep the length of the formula polynomial, until the base case refers to an edge of the configuration graph and we can express this with a quantifier-free formula. The function from x to this formula is the poly-time reduction, as the formula is true if and only if the path exists.
The two classes are equal because each is equal to PSPACE. To show that PSPACE is contained in PTQBF, we simply quote the result of part (a) and note that a poly-time deterministic oracle machine can take x, compute a single TQBF query using the reduction there, and get the answer to that query from the oracle. To show that NPTQBF is contained in PSPACE, note that we can simulate every possible computation path of the NP machine using polynomial space, since the choice sequence of the NP machine and the space it uses on each path are each polynomial. Our simulation must also simulate the oracle that the NP machine uses, but we can do this in PSPACE as well -- given a poly-size quantified boolean formula, we can evaluate it recursively, by substituting both 0 and 1 for each quantified variable, using polynomial total space. Since PTQBF is obviously contained in NPTQBF, we have shown all three classes to be equal.
Modify M to create a non-oracle nondeterministic TM M' as follows. M'
simulates M step by step except that whenever M makes an oracle query, M'
guesses the result of the query and continues computing as though that were
the answer from the oracle. Then the input x is in L(M) if and only if:
There exists a run r of M' such that every oracle query guessed true in r
is a satisfiable formula and every oracle query guessed false in r is an
unsatisfiable formula, or
∃ r: ∀φ
((φ guessed true in r) → (∃z: φ(z)=1) ∧
(φ guessed false in r) → (∀z: φ(z) = 0))
This can clearly be expressed as a quantified boolean formula -- a
Σ2 formula with a little more work.
The base case is k=0 since the statement is for all non-negative integers k.
A0i,j is defined to be 1 iff i=j, and a path of length
0 exists from i to j iff i=j.
For the inductive hypothesis, assume that for a fixed k and any i and j,
Aki,j = 1
iff there is a path of length k from i to j. By the definition of paths in
directed graphs, there is a path of length at most
k+1 from u to v iff there exists
a vertex z such that there is a path of length at most k from u to z and either
z = v or there is an
edge from z to v. By the inductive hypothesis and the definition of A, then
there is such a path iff there exists z such that Aku,z
= 1 and Az,v = 1. But this is exactly the definition of when
Ak+1u,v = 1. This completes the induction and the proof.
From (a), we can show BMP to be in NL by showing that the language X =
{(G,k,i,j): there exists a path of length at most k from i to j in G} is in
NL. Many of you incorrectly assumed that this was the language called PATH,
and shown to be NL-complete, in [AB]. But PATH is the language {(G,i,j):
there exists a path (of any length) from i to j in G}.
So we have to show directly that this language X is in NP. This is
essentially done in the solution to Question 6c above -- we guess a path and
then verify it as a read-once certificate in logspace --
with the exception that our guessed path must now start at i
and end at j.
Again, the restriction to unary k is not needed to put BMP in NL. If there
is any path of any length from i to j, there is a path of length at most n-1.
Therefore we can insist that all certificates are paths of length at most n-1,
and thus polynomial size even if k is very large.
We need to reduce a known NL-hard problem to BMP, and our only candidate from the book is PATH = {(G,i,j): there exists a path from i to j in G}. By part (a), we know that the triple (G,i,j) is in PATH iff the 4-tuple (A,n-1,i,j) is in BMP, where A is the (modified) adjacency matrix of G and n is the number of vertices in G. (Here using n in place of n-1 is still correct, where it wasn't in question 6b.) A path from i to j exists iff such a path exists with at most n-1 edges. This reduction is clearly computable in deterministic logspace.
Last modified 17 March 2010