<<

Computational Complexity, 2012–13 1

Solutions to Exercise 2

1. Question: Prove that if NL = , then NSPACE(n) = DSPACE(n). HINT: Use padding, but there will be an obstruction to doing this straigh- forwardly that you will need to get around. Solution: Assume that NL = L. Let L be a language in NSPACE(n), and let M be a non-deterministic machine using linear space which decides L. We will use the assumption to show that L ∈ DSPACE(n). We do this by defining an auxiliary padded language L0 ∈ NL and then showing that L0 ∈ L implies L ∈ DSPACE(n). L0 is defined as follows: a string x0 belongs to L0 iff x0 = x02|x|−|x|, where x ∈ L. We first show L0 ∈ NL. We define a non-deterministic machine M 0 deciding L0 in logarithmic space. Given an input x0, M 0 first checks if the input length m is a power of 2, and if so, whether the last m − log(m) bits of the input are 0. If either of these conditions is not satisfied, it rejects. This can be done in deterministic log-space. If the conditions are both satisfied, M 0 writes the first log(m) bits of the input onto a separate read/write tape and simulates M on the contents of this tape. It accepts if and only if M accepts. Clearly M 0 decides L0 and uses logarithmic space. Now, since NL = L, we have that L0 ∈ L. Thus, there is a deterministic log-space machine N 0 deciding L0. We will show how to use N to decide L in deterministic linear space. The idea is that, given an input x, N will pad its input with 2|x| − |x| 0’s and then simulate N 0 on the padded input. The most direct implementation of this idea doesn’t work, since writing all the 0’s down takes exponential space. The key point is that N doesn’t actually need to write the 0’s down - it can just pretend that they’ there! Namely, N simulates N 0 on the input x02|x|−|x| without writing the input down, and at each point of the simulation it keeps track of which input bit N 0 is reading. Either this input bit is part of x, in which case N knows which bit it is by looking at its input, or its not, in which case it’s 0. The simulation takes space logarithmic in the size of the input of N 0, and hence is linear space as a function of |x|. By definition of L0, N accepts exactly those inputs in L.

2. Question: The graph reachability language REACH consists of all < G, s, t >, where G is a directed acyclic graph (in adjacency matrix representation) and s and t are vertices of the graph such that there is a path from s to t in G. Prove that REACH is complete for NL under log-space m-reductions. Solution: First we show that REACH is in NL. We define a non-deterministic log-space machine M deciding REACH. M first guesses a successor u1 to s and then verifies using access to the adjacency matrix of G, that u1 is indeed a successor of s. It then guesses a successor u2 of u1, again verifying Computational Complexity, 2012–13 2

that u2 is a successor. It continues this process iteratively for |G| steps. It maintains in a counter information about how many times it’s guessed a successor. If all the successor verifications succeed and there is some ui which is equal to t, it accepts, otherwise it rejects. The key point in seeing the correctness of this is that if there is a path from s to t in G, then there is one which has length at most the size of the vertex set of G. Next we show that REACH is NL-complete. Let M be a non-deterministic machine operating in logarithmic space. We consider the configuration graph of M. This graph is polynomial-size since there are at most polyno- mially many configurations of a log-space machine. The question of whether M accepts x can be reduced to the question of whether < G, s, t > is in REACH, where G is the configuration graph of M on x, s is the starting configuration and t is the accepting configuration (which can be assumed to be unique without loss of generality). The adjacency matrix of G can be computed in logarithmic space given M and x, implying that this is a log-space . The above solution is not strictly accurate since we also require G to be acyclic, and the configuration graph of a non-deterministic Turing machine is not necessarily acyclic (specifically, there might be cycles in some compo- nent not containing the accepting configuration). This was an unintended subtlety in my statement of the problem, and so I’m not going to debit you if you didn’t deal with it. One way of dealing with this subtlety is to con- sider the timed configuration graph G for which the vertex set is {< C, t >} where C is a configuration and t < nc, where c is a constant such that nc is an upper bound on the number of configurations, and only allow edges between < C, t > and < C0, t + 1 > where C0 is a successor of C in the (untimed) configuration graph.

3. Question: Prove that there is a language L that can be decided by circuits of size n3 but not by circuits of size n2. HINT: Use a counting argument, together with the fact that any Boolean function for which a small number of inputs map to 1 has circuits of small size. n 3/2 Solution: Let Sn ⊆ {0, 1} be such that |S| = bn c. Any such Sn can be represented by a DNF of size n5/2 and hence is recognized by a circuit n 3/2 n3/2 n9/4 of that size. On the other hand, there are at least (2 /n ) > 2 such subsets S while there are at most nO(n2) circuits with n2 gates. For n9/4 O(n2) large enough n, 2 > n , therefore there is some such subset Sn not recognized by any circuit of size n2. Now take L to be the set of x for which 3 2 x ∈ S|x|. L has circuits of size n but not circuits of size n . 4. Question: The BIT SORTING problem is as follows. The input is a binary Computational Complexity, 2012–13 3

string x, and the output is 0m1|x|−m, where m is the number of 0’s in x. Show that the BIT SORTING function can be computed in NC. Solution: Assume without loss of generality that |x| is a power of 2. If not, we can just bit-sort 02dlog(|x|)e−|x|x and ignore the first 02dlog(|x|)e bits of the output (i.e., not include them among the designated outputs). We construct NC circuits for BIT SORTING iteratively. At level i of the iteration, the substring xjxj+1 . . . xj+2i−1 of the input will be bit-sorted for each j = 1, 2i, 2 ∗ 2i, 3 ∗ 2i .... At level i + 1, we will show how to “merge” the bit-sorts of consecutive pairs of blocks from the previous stage. Level log(n) of the iteration will give the desired output for the BIT SORTING problem on the entire input. The base case is easy - the input is itself a bit-sort at level 0. We now show how to construct poly-size log-depth circuits that take in the output at level i and produce the output at level i + 1. Let y0, y2 . . . ym and z0, z2 . . . zm be bit-sorted inputs. We show how to produce a bit sort of the string y0y1 . . . ymz0z1 . . . zm. The basic idea is simple. Bit j of the output (counting starting at zero from the least significant bit) will be 1 if and only if there is an 6 j such that yr = 1 and zj−r = 1. This can be checked using an OR of ANDs of polynomial size, where each AND has two inputs. Such an OR of ANDs can be implemented as a logarithmic-depth circuit. It is not hard to see that the structure of the circuit is regular enough that we can produce a description of it in logarithmic space. Since the circuit is polynomial size and O(log2(n)) depth, this implies BIT SORTING is in NC.

5. Question: Show that NC1 ⊆ L. Build on this to prove unconditionally that TQBF is not in NC. Solution: Let L ∈ NC1. This means that there is a log-space machine which, for each n, computes the description of a circuit Cn of logarithmic depth solving Ln. We show L ∈ L by simulating Cn in logarithmic space. The simulation is recursive. At any gate, we ask for the values of the two inputs to that gate. We obtain this values recursively by evaluting the circuit at a lower level. The depth of recursion is logarithmic and we only need to store a constant amount of information (namely at most one input value to a gate, as well as information about which input value we are currently considering) at each level of recursion. Thus, the simulation can be done in logarithmic space. TQBF is PSPACE-complete. The proof that NC1 ⊆ L can be generalized to show that NC ⊆ POLYLOG, where POLYLOG is the class of problems solv- able in poly-logarithmic space. If TQBF were in NC, then PSPACE ⊆ NC (since NC is closed under logarithmic-space reductions), and hence Computational Complexity, 2012–13 4

PSPACE ⊆ POLYLOG, which is a contradiction to the space hierarchy the- orem.

Rahul Santhanam, March 2013