



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




1
2
Geography. Alice names capital city c of country she is in. Bob names a capital city c' that starts with the letter on which c ends. Alice and Bob repeat this game until one player is unable to continue. Does Alice have a forced win? Ex. Budapest → Tokyo → Ottawa → Ankara → Amsterdam → Moscow → Washington → Nairobi → … Geography on graphs. Given a directed graph G = (V, E) and a start node s, two players alternate turns by following, if possible, an edge out of the current node to an unvisited node. Can first player guarantee to make the last legal move? Remark. Some problems (especially involving 2-player games and AI) defy classification according to P, EXPTIME, NP, and NP-complete.
4
P. Decision problems solvable in polynomial time. PSPACE. Decision problems solvable in polynomial space. Observation. P ⊆ PSPACE. poly-time algorithm can consume only polynomial space
5
Binary counter. Count from 0 to 2n^ - 1 in binary. Algorithm. Use n bit odometer. Claim. 3-SAT is in PSPACE. Pf. Enumerate all 2n^ possible truth assignments using counter. Check each assignment to see if it satisfies all clauses. ▪ Theorem. NP ⊆ PSPACE. Pf. Consider arbitrary problem Y in NP. Since Y ≤P 3-SAT, there exists algorithm that solves Y in poly-time plus polynomial number of calls to 3-SAT black box. Can implement black box in poly-space. ▪
7 QSAT. Let Φ(x 1 , …, xn) be a Boolean CNF formula. Is the following propositional formula true? Intuition. Amy picks truth value for x 1 , then Bob for x 2 , then Amy for x 3 , and so on. Can Amy satisfy Φ no matter what Bob does? Ex. Yes. Amy sets x 1 true; Bob sets x 2 ; Amy sets x 3 to be same as x 2. Ex. No. If Amy sets x 1 false; Bob sets x 2 false; Amy loses; No. if Amy sets x 1 true; Bob sets x 2 true; Amy loses.
∃x 1 ∀x 2 ∃x 3 ∀x 4 … ∀xn-1 ∃xn Φ(x 1 , …, xn) assume n is odd !
8
Theorem. QSAT ∈ PSPACE. Pf. Recursively try all possibilities. Only need one bit of information from each subproblem. Amount of space is proportional to depth of function call stack. ∃ ∀ x 1 = 0 ∃ ∃ x 2 = 0 x 3 = 0 x 2 = 1 x 3 = 1
x 1 = 1 Φ(0, 0, 0) Φ(0, 0, 1) Φ(0, 1, 0) Φ(0, 1, 1) Φ(1, 0, 0) Φ(1, 0, 1) Φ(1, 1, 0) Φ(1, 1, 1) return true iff both subproblems are true return true iff either subproblem is true
13
8-puzzle invariant. Any legal move preserves the parity of the number of pairs of pieces in reverse order (inversions). 3 1 2 4 5 6 8 7 3 1 2 4 6 8 5 7 3 inversions 1-3, 2-3, 7- 5 inversions 1-3, 2-3, 7-8, 5-8, 5- 3 1 2 4 5 6 8 7 3 inversions 1-3, 2-3, 7- 1 2 3 4 5 6 7 8 0 inversions 1 2 3 4 5 6 8 7 1 inversion: 7- 14
Planning example. Can we increment an n-bit counter from the all- zeroes state to the all-ones state? Conditions. C 1 , …, Cn. Initial state. c 0 = φ. Goal state. c* = {C 1 , …, Cn }. Operators. O 1 , …, On. To invoke operator Oi, must satisfy C 1 , …, Ci-1. After invoking Oi, condition Ci becomes true. After invoking Oi, conditions C 1 , …, Ci-1 become false. Solution. { } ⇒ {C 1 } ⇒ {C 2 } ⇒ {C 1 , C 2 } ⇒ {C 3 } ⇒ {C 3 , C 1 } ⇒ … Observation. Any solution requires at least 2n^ - 1 steps. Ci corresponds to bit i = 1 all 0s all 1s i-1 least significant bits are 1 set bit i to 1 set i-1 least significant bits to 0 15
Configuration graph G. Include node for each of 2n^ possible configurations. Include an edge from configuration c' to configuration c'' if one of the operators can convert from c' to c''. PLANNING. Is there a path from c 0 to c* in configuration graph? Claim. PLANNING is in EXPTIME. Pf. Run BFS to find path from c 0 to c* in configuration graph. ▪ Note. Configuration graph can have 2n^ nodes, and shortest path can be of length = 2 n^ - 1. binary counter 16
Theorem. PLANNING is in PSPACE. Pf. Suppose there is a path from c 1 to c 2 of length L. Path from c 1 to midpoint and from c 2 to midpoint are each ≤ L/2. Enumerate all possible midpoints. Apply recursively. Depth of recursion = log 2 L. ▪ boolean hasPath(c 1 , c 2 , L) { if (L ≤ 1) return correct answer foreach configuration c' { boolean x = hasPath(c 1 , c', L/2) boolean y = hasPath(c 2 , c', L/2) if (x and y) return true } return false } enumerate using binary counter
18
PSPACE. Decision problems solvable in polynomial space. PSPACE-Complete. Problem Y is PSPACE-complete if (i) Y is in PSPACE and (ii) for every problem X in PSPACE, X ≤P Y. Theorem. [Stockmeyer-Meyer 1973] QSAT is PSPACE-complete. Theorem. PSPACE ⊆ EXPTIME. Pf. Previous algorithm solves QSAT in exponential time, and QSAT is PSPACE-complete. ▪ Summary. P ⊆ NP ⊆ PSPACE ⊆ EXPTIME. it is known that P ≠ EXPTIME, but unknown which inclusion is strict; conjectured that all are 19
More PSPACE-complete problems. Competitive facility location. Natural generalizations of games.
Input. Graph with positive edge weights, and target B. Game. Two competing players alternate in selecting nodes. Not allowed to select a node if any of its neighbors has been selected. Competitive facility location. Can second player guarantee at least B units of profit? 10 1 5 15 5 1 5 1 15 10 Yes if B = 20; no if B = 25.