Algorithm II
9. PSPACE
WU Xiaokun 吴晓堃
xkun.wu [at] gmail
Geography. Alice names capital city c of country she is in. Bob names a capital
city c' that starts with letter on
which c ends. Alice and Bob repeat this
game until one player is unable to continue.
Q. Does Alice have a forced win?
Ex. Budapest \rightarrow Tokyo \rightarrow Ottawa \rightarrow Ankara \rightarrow Amsterdam \rightarrow Moscow \rightarrow Washington \rightarrow etc.
Geography on graphs. Given a digraph G = (V, E) and a start node s, two players alternate turns by following, if possible, an edge leaving 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 \mathcal{P}, EXPTIME, \mathcal{NP}, and \mathcal{NP}-complete.
\mathcal{P}. Decision problems solvable in polynomial time.
PSPACE. Decision problems solvable in polynomial space.
Observation. \mathcal{P} \subseteq PSPACE.
Binary counter. Count from 0 to 2^n - 1
in binary.
Algorithm. Use n-bit
“odometer”.
Claim. 3-SAT \in
PSPACE.
Pf.
Theorem. \mathcal{NP}
\subseteq PSPACE.
Pf. Consider arbitrary problem Y \in \mathcal{NP}.
QSAT. Let \Phi(x_1, .., x_n) be a boolean CNF formula. Is the following propositional formula true?
\exists x_1 \forall x_2 \exists x_3 \forall x_4 \ldots \exists x_{n-1} \forall x_n \Phi(x_1, .., x_n),\ \text{assume $n$ is odd}
Intuition. Amy picks truth value for x_1, then Bob for x_2, then Amy for x_3, and so on. Can Amy satisfy \Phi no matter what Bob does?
Ex. (x_1 \vee x_2) \wedge
(x_2 \vee \bar{x_3}) \wedge (\bar{x_1} \vee \bar{x_2} \vee
x_3)
Yes. Amy sets x_1
true; Bob sets x_2; Amy sets x_3 to be same as x_2.
Ex. (x_1 \vee x_2) \wedge
(\bar{x_2} \vee \bar{x_3}) \wedge (\bar{x_1} \vee \bar{x_2} \vee
x_3)
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.
Theorem. Q-SAT \in
PSPACE.
Pf. Recursively try all possibilities.
8-puzzle, 15-puzzle. [Noyes Chapman 1874]
Conditions. Set C = \{
C_1, .., C_n \}.
Initial configuration. Subset c_0 \subseteq C of conditions initially
satisfied.
Goal configuration. Subset c^\ast \subseteq C of conditions we seek to
satisfy.
Operators. Set O = \{ O_1,
.., O_k \}.
PLANNING. Is it possible to apply sequence of operators to get from initial configuration to goal?
Examples.
Planning example. Can we solve the 8-puzzle?
Conditions. C_{ij}, 1 \le
i, j \le 9: tile i is in square
j.
Initial state. c_0 = \{
C_{11}, C_{22}, .., C_{66}, C_{78}, C_{87}, C_{99} \}.
Goal state. c^\ast = \{
C_{11}, C_{22}, .., C_{66}, C_{77}, C_{88}, C_{99} \}.
Operators.
Solution. No solution to 8-puzzle or 15-puzzle!
8-puzzle invariant. Any legal move preserves the parity of the number of pairs of pieces in reverse order (inversions).
Planning example. Can we increment an n-bit counter from the all-zeroes state to the all-ones state?
Conditions. C_1, ..,
C_n: C_i corresponds to
bit-i = 1.
Initial state. c_0 =
\emptyset: all 0s.
Goal state. c^\ast = \{ C_1,
.., C_n \}: all 1s.
Operators. O_1, ..,
O_n.
Solution. \{ \} \Rightarrow \{C_1\} \Rightarrow \{C_2\} \Rightarrow \{C_1, C_2\} \Rightarrow \{C_3\} \Rightarrow \{C_3, C_1\} \Rightarrow ..
Observation. Any solution requires at least 2^n - 1 steps.
Configuration graph G.
PLANNING. Is there a path from c_0 to c^\ast in configuration graph?
Claim. PLANNING \in
EXPTIME.
Pf. Run BFS to find path from c_0 to c^\ast in configuration graph.
Note. Configuration graph can have 2^n nodes, and shortest path can be of length = 2^n - 1 (binary counter).
Theorem. PLANNING \in PSPACE.
Pf.
hasPath
(c_1, c_2,
L)
hasPath
(c_1, c', L/2);hasPath
(c_2, c', L/2);PSPACE. Decision problems solvable in polynomial space.
PSPACE-complete. Problem Y \in PSPACE-complete if (i) Y \in PSPACE and (ii) for every problem X \in PSPACE, X \le_P Y.
Theorem. [Stockmeyer–Meyer 1973] QSAT \in PSPACE-complete.
Theorem. PSPACE \subseteq EXPTIME.
Pf. Previous algorithm solves QSAT in exponential time;
and QSAT is PSPACE-complete.
Summary. \mathcal{P} \subseteq \mathcal{NP} \subseteq PSPACE \subseteq EXPTIME.
More PSPACE-complete problems.
Input. Graph G = (V,
E) 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?
Claim. COMPETITIVE-FACILITY-LOCATION \in PSPACE-complete.
Pf.
Construction. Given instance \Phi(x_1, .., x_n) = C_1 \wedge C_1 \wedge .. \wedge C_k of Q-SAT.
Construction. Given instance \Phi(x_1, .., x_n) = C_1 \wedge C_1 \wedge .. \wedge C_k of Q-SAT.