Diagonalization Our Goal: Separate Interesting Complexity Classes Question
Total Page:16
File Type:pdf, Size:1020Kb
Diagonalization Could we use diagonalization to resolve P v NP? Relativization Our goal: separate interesting complexity classes Here’s some evidence that this won’t work: An argument “relativizes” if it goes through when you give the machine oracle access. Question: could we somehow use diagonalization to resolve P v NP? An Oracle Turing machine MA is a modified TM with the ability to query an oracle for language A. Essentially, diagonalization is a simulation of one TM by another. Only general technique we have (e.g. for hierarchy theorems) Has special tape called an oracle tape. Simulation ensures that simulating machine determines behavior of When MA writes a string on oracle tape, it is informed whether that other machine and then behaves differently. Diagonalization relies on following properties of Turing machines: string is in A in one step. What if you add an oracle? Simulation proceeds as before => if we could prove P NP, we could A Turing machine can be represented by a string Observations: also prove PA NPA SAT A Turing machine can be simulated by another Turing machine without NP P much overhead in time or space. coNP PSAT (because deterministic complexity classes are closed Treats machines as blackboxes: internal workings don’t matter. under complementation) NPSAT contains languages we believe are not in NP. Example: { | is not a minimal boolean formula} 1 2 3 Diagonalization and Relativization SPACE: The next frontier Savitch’s Theorem Theorem: Quite different from time: space can be reused. Savitch’s Thm: Any nondeterministic TM that uses f(n) space can be There is an oracle B whereby PB = NPB converted to deterministic TM that uses O(f2(n)) space. There is an oracle A whereby PA NPA Space complexity of Turing machine M = space used. = maximum number of tape cells that M scans as function of input Idea: Solve yieldability problem. length. Given two configurations of the NTM C and C’, together with number t, determine if NTM can get from C to C’ in t steps. For non-deterministic TM, wherein all branches halt, space complexity O(f(n)) defined as maximum number of tape cells scanned on any branch of Solve CanYield(Cstart, Caccept, 2 ) computation as function of input length. Use recursive algorithm, by searching for intermediate configuration. As usual, use asymptotic notation. SPACE(f(n)) = {L | L is language decided by an O(f(n)) space deterministic TM} NSPACE(f(n)) = {L | L is language decided by an O(f(n)) space nondeterministic TM} 4 5 6 Savitch’s theorem PSPACE PSPACE boolean CanYield(c1, c2, t) { P. Decision problems solvable in polynomial time. Binary counter. Count from 0 to 2n - 1 in binary. if (t 1) return correct answer enumerate using binary counter Algorithm. Use n bit odometer. PSPACE. Decision problems solvable in polynomial space. foreach configuration c' { Claim. 3-SAT is in PSPACE. boolean x = CanYield(c1, c', t/2) boolean y = CanYield(c2, c', t/2) EXPTIME. Decision problems solvable in exponential time. Pf. n if (x and y) return true Enumerate all 2 possible truth assignments using counter. } return false Check each assignment to see if it satisfies all clauses. } Relationships: P NP PSPACE = NPSPACE Theorem. NP PSPACE. Pf. Consider arbitrary problem Y in NP. On input w: Since Y P 3-SAT, there exists algorithm that solves Y in poly-time O(f(n)) Output the result of CanYield (cstart, caccept, 2 ) plus polynomial number of calls to 3-SAT black box. Can implement black box in poly-space. Whenever CanYield invokes itself recursively, stores the current stage number and values of c1, c2 and t on stack. Every level of recursion uses O(f(n)) space. Depth of recursion O(f(n)) 2 => total space O(f(n) ) 7 8 9 Quantified Satisfiability QSAT is in PSPACE QSAT. Let (x1, …, xn) be a Boolean CNF formula. Is the following Theorem. QSAT PSPACE. Quantified Satisfiability propositional formula true? Pf. Recursively try all possibilities. Only need one bit of information from each subproblem. x1 x2 x3 x4 … xn-1 xn (x1, …, xn) Amount of space is proportional to depth of function call stack. assume n is odd Intuition. Amy picks truth value for x1, then Bob for x2, then Amy for return true iff both x3, and so on. Can Amy satisfy no matter what Bob does? x = 0 x = 1 1 1 subproblems are true Ex. (x1 x2 ) (x2 x3) (x1 x2 x3 ) x = 1 return true iff either x2 = 0 2 subproblem is true Yes. Amy sets x1 true; Bob sets x2; Amy sets x3 to be same as x2. (x x ) (x x ) (x x x ) Ex. 1 2 2 3 1 2 3 x3 = 0 x3 = 1 No. If Amy sets x1 false; Bob sets x2 false; Amy loses; No. if Amy sets x1 true; Bob sets x2 true; Amy loses. (0, 0, 0) (0, 0, 1) (0, 1, 0) (0, 1, 1) (1, 0, 0) (1, 0, 1) (1, 1, 0) (1, 1, 1) 11 12 Planning Problem Planning Problem: Binary Counter Planning Conditions. Set C = { C1, …, Cn }. Planning example. Can we increment an n-bit counter from the all- Initial configuration. Subset c0 C of conditions initially satisfied. zeroes state to the all-ones state? Goal configuration. Subset c* C of conditions we seek to satisfy. C corresponds to bit i = 1 Operators. Set O = { O1, …, Ok }. Conditions. C1, …, Cn. i all 0s To invoke operator Oi, must satisfy certain prereq conditions. Initial state. c0 = . all 1s After invoking Oi certain conditions become true, and certain Goal state. c* = {C1, …, Cn }. conditions become false. Operators. O1, …, On. i-1 least significant bits are 1 To invoke operator Oi, must satisfy C1, …, Ci-1. set bit i to 1 PLANNING. Is it possible to apply sequence of operators to get from After invoking Oi, condition Ci becomes true. set i-1 least significant initial configuration to goal configuration? After invoking O , conditions C , …, C become false. i 1 i-1 bits to 0 Solution. {C1} {C2} {C1, C2} {C3} {C3, C1} … Examples. n Many puzzles such as 15-puzzle, Rubik’s cube. Observation. Any solution requires at least 2 - 1 steps. Logistical operations to move people, equipment, materials and robots (software or hardware). 14 15 Planning Problem: In Exponential Time Planning Problem: In Polynomial Space Configuration graph G. Theorem. PLANNING is in PSPACE. n PSPACE-Completeness Include node for each of 2 possible configurations. Pf. Same idea as proof of Savitch’s theorem. Include an edge from configuration c' to configuration c'' if one of Suppose there is a path from c1 to c2 of length L. the operators can convert from c' to c''. Path from c1 to midpoint and from c2 to midpoint are each L/2. Enumerate all possible midpoints. PLANNING. Is there a path from c0 to c* in configuration graph? Apply recursively. Depth of recursion = log2 L. boolean hasPath(c1, c2, L) { Claim. PLANNING is in EXPTIME. if (L 1) return correct answer Pf. Run BFS to find path from c0 to c* in configuration graph. enumerate using binary counter foreach configuration c' { boolean x = hasPath(c1, c', L/2) Note. Configuration graph can have 2n nodes, and shortest path can boolean y = hasPath(c2, c', L/2) if (x and y) return true n be of length = 2 - 1. } return false } 16 17 PSPACE-Complete PSPACE-Complete PSPACE-Complete Problems PSPACE. Decision problems solvable in polynomial space. PSPACE. Decision problems solvable in polynomial space. More PSPACE-complete problems. Competitive facility location. PSPACE-Complete. Problem Y is PSPACE-complete if (i) Y is in PSPACE PSPACE-Complete. Problem Y is PSPACE-complete if (i) Y is in PSPACE Natural generalizations of games. and (ii) for every problem X in PSPACE, X P Y. and (ii) for every problem X in PSPACE, X P Y. – Othello, Hex, Geography, Rush-Hour, Instant Insanity – Shanghai, go-moku, Sokoban Various motion planning and search problems. Why polynomial reducibility? Theorem. [Stockmeyer-Meyer 1973] QSAT is PSPACE-complete. Think about what it means for a problem to be complete for a Theorem. PSPACE EXPTIME. complexity class Pf. Previous algorithm solves QSAT in exponential time, and QSAT is one of the hardest problems in the class PSPACE-complete. every other problem in the class *easily* reduced to it. so reduction must be easy, relative to complexity of typical problems in class. Summary. P NP PSPACE EXPTIME. it is known that P EXPTIME, but unknown which inclusion is strict; conjectured that all are 19 20 21 Competitive Facility Location Competitive Facility Location Competitive Facility Location assume n is odd Input. Graph with positive edge weights, and target B. Claim. COMPETITIVE-FACILITY is PSPACE-complete. Construction. Given instance (x1, …, xn) = C1 C1 … Ck of QSAT. Game. Two competing players alternate in selecting nodes. Not allowed Include a node for each literal and its negation and connect them. to select a node if any of its neighbors has been selected. Pf. – at most one of xi and its negation can be chosen i i Choose c k+2, and put weight c on literal x and its negation; n-1 n-3 4 2 Competitive facility location. Can second player guarantee at least B In PSPACE set B = c + c + … + c + c + 1. units of profit? – ensures variables are selected in order xn, xn-1, …, x1. n-1 n-3 4 2 To show that it's complete, we show that QSAT polynomial reduces As is, player 2 will lose by 1 unit: c + c + … + c + c . to it. Given an instance of QSAT, we construct an instance of COMPETITIVE-FACILITY such that player 2 can force a win iff QSAT n formula is true.