Documentation

CslibFrontier.Computability.Complexity.Classes.Alternation.TQBF

Games of polynomially many moves reduce to TQBF #

A game of 2 * w alternate single-bit moves, the existential first, whose winning condition is computed by a polynomial-time machine, is a closed quantified Boolean formula: rounds of quantifiers ∃ x, ∀ y over the moves (Cslib.Logic.PL.QBF.rounds, Cslib.Logic.PL.QBF.eval_rounds_eq_true_iff), followed by the Cook–Levin tableau of the machine on the instance and the moves, its certificate bits linked to the variables of the moves and all its other variables quantified existentially. The variables of the moves are the blocks of level 0 of the reduction of CslibFrontier.Computability.Complexity.Classes.Space.TQBF.Reduction, and the tableau is its formula of level 0 (Cslib.Complexity.TQBF.baseFormula), so the formula of a game (Cslib.Complexity.TQBF.gameFormula) holds exactly when the existential player wins the game in which the tableau has a satisfying assignment with the moves as certificate (Cslib.Complexity.TQBF.eval_gameFormula).

For a polynomial-time game verifier, the formula of the game on an instance (Cslib.Complexity.TQBF.gameReduce) is computed in polynomial time and is a true closed formula exactly when the instance is accepted (Cslib.Complexity.TQBF.gameReduce_mem_TQBF_iff). Since TQBF is in PSPACE and PSPACE is closed under polynomial-time reductions, every problem with a polynomial-time game verifier is in PSPACE (Cslib.Complexity.IsGameVerifier.mem_PSPACE), and in particular every problem in AP (Cslib.Complexity.AP_subset_PSPACE): the inclusion AP ⊆ PSPACE Chandra, Kozen and Stockmeyer Sipser, Section 10.3.

Main definitions #

Main results #

References #

Rounds of quantifiers #

def Cslib.Logic.PL.QBF.rounds {V : Type u_1} (ps : List (V × V)) (φ : QBF V) :
QBF V

Rounds of quantifiers: ∃ x, ∀ y for each pair (x, y), the first pair outermost.

def Cslib.Logic.PL.QBF.roundVars {V : Type u_1} (ps : List (V × V)) :

The variables of rounds of quantifiers, in order.

theorem Cslib.Logic.PL.QBF.tokens_rounds (ps : List (ℕ × ℕ)) (φ : QBF ℕ) :
(rounds ps φ).tokens = List.flatMap (fun (p : ℕ × ℕ) => [(Kind.ex, p.1), (Kind.all, p.2)]) ps ++ φ.tokens

The tokens of rounds of quantifiers.

theorem Cslib.Logic.PL.QBF.rounds_append {V : Type u_1} (ps qs : List (V × V)) (φ : QBF V) :
rounds (ps ++ qs) φ = rounds ps (rounds qs φ)

Rounds of quantifiers over a concatenation of lists nest.

theorem Cslib.Logic.PL.QBF.length_roundVars {V : Type u_1} (ps : List (V × V)) :

Rounds of quantifiers quantify two variables each.

theorem Cslib.Logic.PL.QBF.eval_rounds_eq_true_iff {V : Type u_1} [DecidableEq V] (ps : List (V × V)) (φ : QBF V) (σ : V → Bool) :
eval σ (rounds ps φ) = true ↔ Complexity.Alternation true (List.replicate (2 * ps.length) 1) fun (z : List Bool) => eval (updates σ (roundVars ps) z) φ = true

Rounds of quantifiers are a game of alternate single-bit moves, the existential first: the formula holds exactly when the existential player wins the game in which the moves set the variables of the rounds, in order.

theorem Cslib.Logic.PL.QBF.mem_freeVars_rounds {V : Type u_1} [DecidableEq V] {ps : List (V × V)} {φ : QBF V} {x : V} :
x ∈ (rounds ps φ).freeVars ↔ x ∈ φ.freeVars ∧ x ∉ roundVars ps

The free variables of rounds of quantifiers are those of the body not quantified.

theorem Cslib.Logic.PL.QBF.eval_rounds_congr {V : Type u_1} [DecidableEq V] {φ ψ : QBF V} (h : ∀ (σ : V → Bool), eval σ φ = eval σ ψ) (ps : List (V × V)) (σ : V → Bool) :
eval σ (rounds ps φ) = eval σ (rounds ps ψ)

Rounds of quantifiers over formulas with the same values have the same values.

theorem Cslib.Logic.PL.QBF.eval_exs_congr {V : Type u_1} [DecidableEq V] {φ ψ : QBF V} (h : ∀ (σ : V → Bool), eval σ φ = eval σ ψ) (vs : List V) (σ : V → Bool) :
eval σ (exs vs φ) = eval σ (exs vs ψ)

Existential quantifiers over formulas with the same values have the same values.

theorem Cslib.Logic.PL.QBF.eval_rounds_map_pair {V : Type u_1} [DecidableEq V] {φ : QBF V} {d : V} (hd : d ∉ φ.freeVars) (vs : List V) (σ : V → Bool) :
eval σ (rounds (List.map (fun (v : V) => (v, d)) vs) φ) = eval σ (exs vs φ)

Vacuous universal quantifiers: the rounds ∃ v, ∀ d for the variables v of a list, over a variable d that is not free in the body, are existential quantifiers over the list.

theorem Cslib.Logic.PL.QBF.closed_rounds_ofCNF_iff {V : Type u_1} [DecidableEq V] (ps : List (V × V)) (ψ : CNF V) :
(rounds ps (ofCNF ψ)).Closed ↔ ∀ c ∈ ψ, ∀ l ∈ c, l.1 ∈ roundVars ps

A formula in alternating prenex conjunctive normal form is closed exactly when all the variables of its clauses are quantified.

The formula of a game #

The rounds of a game of 2 * w moves: the move j sets the variable certVar w j of the blocks of level 0.

The variables of the moves are those of the blocks of level 0.

noncomputable def Cslib.Complexity.TQBF.gameFormula {k : ℕ} {State : Type} [Fintype State] (tab : Logic.PL.CNF (CookLevin.Var k State)) (w : ℕ) :

The formula of a game on a tableau: rounds of quantifiers over the blocks of level 0, then the tableau as the formula of level 0.

theorem Cslib.Complexity.TQBF.eval_gameFormula {k : ℕ} {State : Type} [Fintype State] (tab : Logic.PL.CNF (CookLevin.Var k State)) (w : ℕ) (σ : ℕ → Bool) :
Logic.PL.QBF.eval σ (gameFormula tab w) = true ↔ Alternation true (List.replicate (2 * w) 1) fun (z : List Bool) => ∃ (τ : CookLevin.Var k State → Bool), CookLevin.certWord τ (2 * w) = z ∧ Logic.PL.CNF.eval τ tab = true

The formula of a game holds exactly when the existential player wins the game of 2 * w moves in which the tableau has a satisfying assignment with the moves as its first 2 * w certificate bits.

theorem Cslib.Complexity.TQBF.closed_gameFormula {k : ℕ} {State : Type} [Fintype State] (tab : Logic.PL.CNF (CookLevin.Var k State)) (w : ℕ) :

The formula of a game is closed.

The reduction #

noncomputable def Cslib.Complexity.TQBF.gameReduce {α : Type} (enc : α ↪ List Bool) (p : Polynomial ℕ) {kV : ℕ} {StateV : Type} [Fintype StateV] [DecidableEq StateV] (tmV : Turing.MultiTapeTM kV Bool StateV) (cV dV : ℕ) (a : α) :

The reduction of a game to TQBF: the formula of the game of 2 * p (enc a).length moves on the Cook–Levin tableau of a machine tmV, on the input frame (enc a) and the moves, unrolled for cV * (2 * (enc a).length + 2 * p (enc a).length + 2) ^ dV steps.

theorem Cslib.Complexity.TQBF.gameReduce_mem_TQBF_iff {α : Type} {enc : α ↪ List Bool} {p : Polynomial ℕ} {V : α × List Bool → Bool} {kV : ℕ} {StateV : Type} [Fintype StateV] [DecidableEq StateV] {tmV : Turing.MultiTapeTM kV Bool StateV} {cV dV : ℕ} {sV : α × List Bool → ℕ} (htm : tmV.ComputesFunTidilyInTimeAndSpace (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool V (fun (x : α × List Bool) => cV * (((Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encBits) x).length + 1) ^ dV) sV) (a : α) :
gameReduce enc p tmV cV dV a ∈ TQBF ↔ Alternation true (List.replicate (2 * Polynomial.eval (enc a).length p) 1) fun (z : List Bool) => V (a, z) = true

The reduction of a game is correct. If tmV computes the winning condition V tidily within time cV * (n + 1) ^ dV, then the formula of the game on a is a true closed formula exactly when the existential player wins the game of 2 * p (enc a).length moves with winning condition V (a, ·).

The tokens of a round of the game.

The formula of a game is polynomial-time in the tableau and the number of rounds in unary.

theorem Cslib.Complexity.TQBF.computableInPolyTime_gameReduce {α : Type} {enc : α ↪ List Bool} {p : Polynomial ℕ} {kV : ℕ} {StateV : Type} [Fintype StateV] [DecidableEq StateV] (tmV : Turing.MultiTapeTM kV Bool StateV) (cV dV : ℕ) :

The reduction of a game is polynomial-time.

Games of polynomially many moves are decided in polynomial space: a problem with a polynomial-time game verifier is in PSPACE.

theorem Cslib.Complexity.AP_subset_PSPACE {α : Type} {enc : α ↪ List Bool} :
AP enc ⊆ PSPACE enc

AP ⊆ PSPACE Chandra, Kozen and Stockmeyer Sipser, Section 10.3: a problem decided by an alternating machine within polynomial time is a game of polynomially many moves with a polynomial-time winning condition, which reduces to TQBF.