Fall 2013 CMU CS Computational Complexity Lecture 5 Savich’s theorem, and IS theorems. These slides are mostly a resequencing of Chris Umans’ slides From CS 151: Complexity Theory (Spring 2013) at CalTech.CS 151: Complexity Theory (Spring 2013)
World Picture EXP PSPACE P L NEXP NP coNP coNEXP 9/24/2013
Ladner’s Theorem Try to “merge”: on input x, either –answer SAT(x) –answer TRIV(x) if can decide which one in P, L NP SATTRIV MiMi M0M0 L N0N0 NiNi :: ::... ≠ ≠ ≠ ≠ 9/24/2013
Ladner’s Theorem Key: n eventually large enough to notice completed previous stage L f 0011kkk... MiMi input x input z < x ≠ suppose k = 2i I’m sup- posed to ensure M i is killed I finally have enough time to check input z I notice z did the job, increase f to k+1 kk 9/24/2013
April 4, At most 2 O(f(n)) bits to describe a SPACE(fn)) configuration.. # configurations for a q-tape TM (work tape + read-only input) that runs in space f(n) n x f(n) q x |Q| x |∑| f(n)q = O( c qf(n) ) = 2 O(f(n)) input-tape head position work-tape head positions state work-tape contents
At most 2 O(f(n)) bits to describe a SPACE(fn)) configuration.. Pick any consistent way of interpreting binary strings as configurations of a TM. n x f(n) q x |Q| x |∑| f(n)q = O( c qf(n) ) = 2 O(f(n))
April 4, Configuration graph for NTMs configuration graph of M on input x: nodes are all sequences of 2 O(f(n)) bits configurations, edge (C, C’) iff the config of M(x) represented by C, and the config of M(x) represented by C’ are consistent with the transition relation of M.
NSPACE(f(n)) = languages decidable by a multi-tape NTM that touches at most f(n) squares of its work tapes along any computation path, where n is the input length, and f :N ! N Let C configuration graph for a space f(n) NTM on input x. C has c f(n) = 2 kf(n) nodes (Exponential in f(n)) f(n) = k’log(n) means POLY-SIZED graph. 9/24/2013
Do DFS or BFS on C most n k configurations of given NTM M running in NSPACE(log n). q start x 1 x 2 x 3 …x n q accept q reject xLxL q accept q reject xLxL easy to determine if C yields C’ in one step configuration graph for M on input x: 9/24/2013
Reachability Conclude: NL P –and NPSPACE EXP S-T-Connectivity (STCONN): given directed graph G = (V, E) and nodes s, t, is there a path from s to t ? Theorem: STCONN is NL-complete under logspace reductions. 9/24/2013
Reachability Proof: –given L NL decided by NTM M construct configuration graph for M on input x (can be done in logspace) –s = starting configuration; t = q accept 9/24/2013
STCONN is in NL NUMSTEPS = 0 (number of steps taken.) C = s (current node) FLAG=False Until NUMSTES = n do –GUESS Z from 1 to n –Increment NUMSTEPS –If (c,z) is an edge in G, set c=z –If c==t set FLAG= True. 9/24/2013
I started at S – I got drunk – and now I am at T I wandered, therefore, my path from S to T exists. 9/24/2013
Two startling theorems Strongly believe P ≠ NP nondeterminism seems to add enormous power for space: Savitch ‘70: NPSPACE = PSPACE and NL SPACE(log 2 n) 9/24/2013
Two startling theorems Strongly believe NP ≠ coNP seems impossible to convert existential into universal for space: Immerman/Szelepscényi ’87/’88: NL = coNL 9/24/2013
Savitch’s Theorem Theorem: STCONN SPACE(log 2 n) Corollary: NL SPACE(log 2 n) Corollary: NPSPACE = PSPACE 9/24/2013
Proof of Theorem –input: G = (V, E), two nodes s and t –recursive algorithm: /* return true iff path from x to y of length at most 2 i */ PATH(x, y, i) if i = 0 return ( x = y or (x, y) E ) /* base case */ for z in V if PATH(x, z, i-1) and PATH(z, y, i-1) return(true); return(false); end 9/24/2013
Proof of Theorem –answer to STCONN: PATH(s, t, log n) –space used: (depth of recursion) x (size of “stack record”) –depth = log n –claim stack record: “(x, y, i)” sufficient size O(log n) –when return from PATH(a, b, i) can figure out what to do next from record (a, b, i) and previous record 9/24/2013
Nondeterministic space Robust nondeterministic space classes: NL = NSPACE(log n) NPSPACE = k NSPACE(n k ) 9/24/2013
Second startling theorem Strongly believe NP ≠ coNP seems impossible to convert existential into universal for space: Immerman/Szelepscényi ’87/’88: NL = coNL 9/24/2013
I started at S – I got drunk NL lucky, tiny brain – and now I am NOT at T How might I know that NO PATH from S to T exists ???? ! 9/24/2013
I-S Theorem Theorem: ST-NON-CONN NL Proof: slightly tricky setup: –input: G = (V, E), two nodes s, t t s “yes” t s “no” 9/24/2013
I-S Theorem –want nondeterministic procedure using only O(log n) space with behavior: “yes” input “no” input q accept q reject q accept q reject t s t s 9/24/2013
I-S Theorem –observation: given count of # nodes reachable from s, can solve problem for each v V, guess if it is reachable if yes, guess path from s to v –if guess doesn’t lead to v, reject. –if v = t, reject. –else counter++ if counter = count accept 9/24/2013
I-S Theorem –every computation path has sequence of guesses… –only way computation path can lead to accept: correctly guessed reachable/unreachable for each node v correctly guessed path from s to v for each reachable node v saw all reachable nodes t not among reachable nodes 9/24/2013
I-S Theorem –R(i) = # nodes reachable from s in at most i steps –R(0) = 1: node s –we will compute R(i+1) from R(i) using O(log n) space and nondeterminism –computation paths with “bad guesses” all lead to reject 9/24/2013
I-S Theorem –Outline: in n phases, compute R(1), R(2), R(3), … R(n) –only O(log n) bits of storage between phases –in end, lots of computation paths that lead to reject –only computation paths that survive have computed correct value of R(n) –apply observation. 9/24/2013
I-S Theorem –computing R(i+1) from R(i): –Initialize R(i+1) = 0 –For each v V, guess if v reachable from s in at most i+1 steps R(i) = R(2) = 6 9/24/2013
I-S Theorem –if “yes”, guess path from s to v of at most i+1 steps. Increment R(i+1) –if “no”, visit R(i) nodes reachable in at most i steps, check that none is v or adjacent to v for u V guess if reachable in ≤ i steps; guess path to u; counter++ KEY: if counter ≠ R(i), reject at this point: can be sure v not reachable 9/24/2013
I-S Theorem correctness of procedure: two types of errors we can make (1) might guess v is reachable in at most i+1 steps when it is not –won’t be able to guess path from s to v of correct length, so we will reject. “easy” type of error 9/24/2013
I-S Theorem (2) might guess v is not reachable in at most i+1 steps when it is –then must not see v or neighbor of v while visiting nodes reachable in i steps. –but forced to visit R(i) distinct nodes –therefore must try to visit node v that is not reachable in ≤ i steps –won’t be able to guess path from s to v of correct length, so we will reject. “easy” type of error 9/24/2013
Summary nondeterministic space classes NL and NPSPACE ST-CONN NL-complete 9/24/2013