Coputational Coplexity Theory, Fall 2010 Septeber 8 Lecture 5: Logspace reductions and copleteness Lecturer: Kristoffer Arnsfelt Hansen Scribe: Claes Højer Jensen Recall the given relation between classes: L NL P NP PSPACE EXP NEXP EXPSPACE... These classes are defined for two reasons: First to study coputation under resources such as tie and space, but also just as iportantly to help us understand the coputational coplexity of concrete coputational probles that we are interested in. It turns out that all the classes above have natural coplete probles. Recalling the notion of NP-copleteness, this is based on polynoial tie reduction. This is however not useable for lesser classes such as NL and P, so a weaker notion of reductions is needed. Definition 1. The language L f associated with a function f : Σ is L f = {< x, bin(j), y > x Σ, j N, y, f(x) j = y} L f will here work as a substitute for the funciton f. Definition 2. We say f is P-coputable if: f(x) = n O(1) and L f P. f is L-coputable if: f(x) = n O(1) and L f L. Definition 3. Let A Σ and B be languages. We say A p B (p stands for polynoial tie, stands for any-one, i.e. any instances ay be apped to one instance) if there is a P-coputable f so that x Σ, x A f(x) B We say A log B if there is an L-coputable f so that x Σ, x A f(x) B Let C be a class of languages. Definition 4. L is log -hard for C if for all L C : L log L. Definition 5. L is log -coplete for C if L is log hard for C, L C. Lea 6. (Transitivity) If A log B and B log C then A log Proof. Let the reductions be given by L-coputable functions f and g, i.e. we have L f L and L g L. Define h(x) = g(f(x)), and let M f, M g be logspace achines for L f, L g. We ust show that h is L-coputable. Note that since we have liited space available, we can t just copute and put f(x) on a tape, as an interediate result. We will now construct a logspace achine M h for L h. C 1
On input < x, bin(j), y >, M h will siulate M g with a fictitious input tape containing < f(x), bin(j), y >. We will aintain the position of the tapehead on the fictitious tape by a counter, stored on the work tape. Whenever M g requires the current sybol on the fictitious input tape, M h will run the achine M f to copute the sybol. M f will be able to read x fro the input tape of M h. Space analysis on input x: for M g : O(log( f(x) )) = O(log( x O(1) )) = O(log( x )). for counter: O(log( f(x) )) = O(log( x O(1) )) = O(log( x )). for M f : O(log( x )). Thus the space used by M h is O(log( x )). We know that NP is closed under reductions; so is all the other classes we have considered. Lea 7. Closure under reductions If B C and A log B then A C, for C = L, NL, P,..., Exaple of log-coplete proble in NL: Definition 8. STCON Instance: Directed graph G = (V, E), s, t V Question: Is there a path fro s to t? Theore 9. STCON is coplete for NL Proof. STCON NL: For this we have the following algorith: 1. v := s 2. for i = 0 to n 1 3. guess u V 4. if (v, u) / E, reject 5. if u = t, accept 6. v = u Space usage: O(log n), since we only need to store node index v, counter i, etc. NL-hardness: Let L NL, and let M be a nondeterinistic O(log n) space bounded achibe for L. We will assue that M has a unique accepting configuration. This we can easily do by odifying M, to clearing the work tape and place tape heads at cell 1, before accepting. Reduction: On input x, output: G: configuration graph of M on input x s: initial confiduration 2
t: accept configuration Since M is O(log n) space bounded, each configuration is encoded by a string of length O(log n). We can thus output the configuration graph, by looping over check pairs of string encoding configurations, and check if M can go fro one configuration to the next in 1 step. This can be done in O(log n) space. Theore 10. (Ieran-Szelepcsenyi) Let S(n) log(n). Then (recall that co - C = {L L C}) co - NSPACE(S(n)) = NSPACE(S(n)) Proof. We will prove that STCON NL. Then the stateent of the theore follows by running the NL algorith on the configuration graph of a O(S(n)) space bounded nondeterinistic achine. We first note that siply switching accept and reject in the algorith fro the proof of STCON is in NL does not work: this would not copute the copleent of STCON. Crucial idea: Let V i = set of vertices reachable fro s in i steps, and let C i = V i. If we are given C i, then we can nondeterinistically enuerate the vertices of V i and afterwards we can know for sure if we enuerated exactly the vertices in V i as follows: 1. count := 0 2. for u V 3. nondeterinistically guess a path fro s to u of length i, vertex by vertex. (done with earlier shown algorith) 4. if found 5. count := count + 1 6. if count = C i, correct enueration! Algorith for STCON : 1. C cur := 1 //C 0 = 1 2. for i = 1 to n 1 //copute C i, given C i 1 3. C prev := C cur, C cur = 0 4. for all v V //test if v V i 5. count := 0, include := false 6. for all u V //enuerate V i 1 7. nondeterinistically guess a patch fro s to u of length i 1 vertex by vertex 8. if (found) 9. count := count + 1 10. if ((u, v) E or u = v) 11. include := true 12. if count! = C prev reject // Enueration of V i 1 failed 13. if (include) C cur := C cur + 1 // At this point we have coputed C n 1 correctly. 3
14. count := 0 15. for all u V // Enuerate V n 1 to see if t V n 1 16. nondeterinistically guess a path fro s to u of length n 1 vertex by vertex 17. if(found) 18. count := count + 1 19. if(u = t) reject 20. if (count = C cur accept) // If enueration was succesful we can tell for sure if t V n 1 Boolean Circuits Inputs: x 1,..., x n 0, 1 Circuit: Directed acyclic graph. Nodes correspond to gates, edges to wires. indegree 0 nodes: labeled by variables indegree 1 nodes: labeled by 1 indegree 2 nodes: labeled by, specified output node C coputes a function f : {0, 1} {0, 1}. Circuit value proble, CVP: Instance: Circuit C on n inputs and concrete input x {0, 1} n. Question: Is C(x) = 1? Circuit-SAT: Instance: Circuit C. Question: Does there exist x 0, 1 n such that C(x) = 1? Theore 11. CVP is log coplete for P Proof. To show that CVP P, given a circuit together with an input, we siple evaluate the circuit botto up. To show log -hardness, let L P, and let M be p(n) tie bounded single-tape TM accepting L. Build circuit by tableu ethod. 4
In each coordinate (i, t) we encode the content of the tape in cell i, whether the tape head is scanning the cell, and if so, the state of the achine. Now given this inforation we can copute the contents of the cell just by looking at the 3 previous cells below, in the neighbor positions (see figure). Theore 12. Circuit-SAT is log coplete for NP Proof. This can again by proven by the tableau ethod. We have additional inputs to describe the nondeterinistic choices. These are fed to each coordinate. The reduction will on input x construct this circuit, and then hardwire x, leaving the inputs for the nondeterinistic choices be the only inputs left. 5