4.6.28Theory of Computation

PSPACE — Quantified Boolean Formula

2,050 words9 min readdifficulty · medium

WHAT it is


WHY a QBF is a game



HOW to evaluate a QBF — derive the recursive algorithm from scratch

We want an algorithm EVAL(ψ) returning the truth value. Build it from the meaning of the leading quantifier.

Base case. If ψ\psi has no quantifiers, it's a closed Boolean expression with all variables fixed → just plug in and compute. Cost: polynomial space.

Existential step. ψ=xψ\psi = \exists x\, \psi'. By definition xψ\exists x\,\psi' is true iff ψ\psi' is true for x=0x{=}0 OR x=1x{=}1: EVAL(xψ)=EVAL(ψ[x=0])    EVAL(ψ[x=1]).\mathrm{EVAL}(\exists x\,\psi') = \mathrm{EVAL}(\psi'[x{=}0]) \;\lor\; \mathrm{EVAL}(\psi'[x{=}1]).

Universal step. ψ=xψ\psi = \forall x\,\psi' is true iff ψ\psi' holds for both values: EVAL(xψ)=EVAL(ψ[x=0])    EVAL(ψ[x=1]).\mathrm{EVAL}(\forall x\,\psi') = \mathrm{EVAL}(\psi'[x{=}0]) \;\land\; \mathrm{EVAL}(\psi'[x{=}1]).


WHY TQBF is PSPACE-complete (sketch you can reconstruct)


The 80/20 — what to actually remember


Flashcards

What does a fully-quantified Boolean formula evaluate to (no free vars)?
A single truth value — true or false.
SAT is which special case of TQBF?
All quantifiers existential: x1xnϕ\exists x_1\cdots\exists x_n\,\phi.
How is xψ\exists x\,\psi' evaluated recursively?
EVAL(ψ[x=0])EVAL(ψ[x=1])\mathrm{EVAL}(\psi'[x{=}0]) \lor \mathrm{EVAL}(\psi'[x{=}1]).
How is xψ\forall x\,\psi' evaluated recursively?
EVAL(ψ[x=0])EVAL(ψ[x=1])\mathrm{EVAL}(\psi'[x{=}0]) \land \mathrm{EVAL}(\psi'[x{=}1]).
Why is TQBF in PSPACE despite exponential time?
Recursion reuses the same memory across the two branches; space =O(nψ)=O(n\cdot|\psi|).
What is TQBF's complexity-class status?
PSPACE-complete (canonical complete problem for PSPACE).
In the PSPACE-hardness reduction, why add (u,v)\forall(u,v) in REACHt\mathrm{REACH}_t?
To make REACHt1\mathrm{REACH}_{t-1} appear only once → polynomial-size formula (Savitch folding).
What goes wrong with m[R(a,m)R(m,b)]\exists m[R(a,m)\land R(m,b)]?
Rt1R_{t-1} appears twice → formula size doubles each level → exponential reduction.
Game interpretation of a true QBF?
The \exists-player has a winning strategy against the \forall-player.
Why isn't xyϕ=yxϕ\exists x\forall y\,\phi = \forall y\exists x\,\phi?
In yx\forall y\exists x, xx may depend on yy; swapping forces one xx for all yy.
Recall Feynman: explain to a 12-year-old

Imagine a tug-of-war played with switches. Player YES wants a light bulb ON; player NO wants it OFF. They take turns flipping switches in a fixed order. The little word "exists" means it's YES's turn — YES only needs one good flip. The word "for all" means it's NO's turn, and YES wins only if the bulb stays ON no matter what NO does. The question "is this QBF true?" just asks: can YES always win this game? To check, a computer plays out every possible game — but cleverly erases and reuses the same scratch paper for each branch, so it never needs much paper (= little memory), even though it may take a very long time.


Connections

  • SAT and NP-completeness — TQBF is the PSPACE analogue of SAT.
  • Savitch's Theorem — the \forall-folding trick reused as quantifiers.
  • PSPACE and Polynomial Space — class TQBF is complete for.
  • Polynomial Hierarchy — bounded-alternation QBF gives levels Σk,Πk\Sigma_k, \Pi_k.
  • Two-Player Games and Game Trees — QBF as a perfect-information game.
  • NP vs PSPACE — why TQBF is unlikely to be in NP.

Concept Map

generalized by

prenex form

no free vars

true formulas

is

member of

interpreted as

exists player

forall player

true iff

computed by

exists uses OR, forall uses AND

reuses memory per branch

SAT: exists only

QBF: alternating quantifiers

Q1 x1 ... Qn xn phi

True or False value

TQBF language

PSPACE-complete

PSPACE: poly space

Two-player game

Prover wants TRUE

Spoiler wants FALSE

Exists has winning strategy

Recursive EVAL algorithm

Depth-n recursion

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, normal SAT problem poochta hai: "kya koi assignment exist karta hai jo formula ko true bana de?" — yaani sirf ek ∃ (exists) player jo formula ko TRUE karna chahta hai. QBF (Quantified Boolean Formula) mein hum ∃ aur ∀ (for all) ko alternate karte hain, jaise do players ka game ho: ∃ = "Prover" jo TRUE chahta hai, ∀ = "Spoiler" jo FALSE chahta hai. Saari variables quantified hoti hain, koi free variable nahi, isliye QBF ka answer sidha true ya false hota hai.

Evaluate kaise karein? Simple recursion: x\exists x matlab dono values (x=0x{=}0 aur x=1x{=}1) ka OR lo (ek bhi true mil gaya to kaam ho gaya). x\forall x matlab dono ka AND lo (saare true hone chahiye). Yeh ek game-tree ban jaata hai. Sabse important baat: jab hum tree explore karte hain, ek branch ka answer nikaalo, phir wahi memory dobara use karke doosri branch nikaalo — dono ko ek saath yaad rakhne ki zarurat nahi. Isliye space sirf O(nψ)O(n\cdot|\psi|) lagta hai, time chahe exponential ho. Yahi reason hai ki TQBF, PSPACE mein hai.

Aur TQBF PSPACE-complete hai — matlab jaise SAT, NP ka "boss problem" hai, waise hi TQBF, PSPACE ka boss problem hai. Hardness ka proof Savitch wale trick se aata hai: reachability ko "config aa se bb tak 2t2^t steps mein pahunch sakte hain?" ke roop mein QBF banao. Agar tum naive tareeke se m[R(a,m)R(m,b)]\exists m[R(a,m)\land R(m,b)] likhoge to formula har level pe double ho jaayega (exponential size — galat!). Isliye ek extra (u,v)\forall(u,v) daal kar dono halves ko fold karte hain taaki Rt1R_{t-1} sirf ek baar aaye — formula polynomial size ka reh jaata hai. Yaad rakho: "∃ = OR, ∀ = AND" aur "∀ se fold karo warna size phat jayega."

Go deeper — visual, from zero

Test yourself — Theory of Computation

Connections