True quantified Boolean formulas
DefinitionEvaluation of a quantified CNF formula#✓fully proved
Let \(\varphi\) be a CNF formula, let \(a : \mathbb{N} \to \{\mathrm{true}, \mathrm{false}\}\) be an assignment, and let \(Q\) be a quantifier prefix, a list of pairs \((e, v)\) of a flag \(e\) (true for \(\exists\), false for \(\forall\)) and a variable \(v \in \mathbb{N}\). Write \(a[v \mapsto b]\) for the assignment that agrees with \(a\) except that it sends \(v\) to \(b\). With the empty prefix, the formula holds under \(a\) when \(a\) satisfies \(\varphi\). With a prefix whose first entry is \((e, v)\) and whose remaining entries form \(Q'\), it holds under \(a\) when, if \(e\) is true, the formula with prefix \(Q'\) holds under \(a[v \mapsto \mathrm{true}]\) or under \(a[v \mapsto \mathrm{false}]\), and, if \(e\) is false, the formula with prefix \(Q'\) holds under both \(a[v \mapsto \mathrm{true}]\) and \(a[v \mapsto \mathrm{false}]\).
def EvalQBF (pref : List (Bool × ℕ)) (φ : Cslib.Logic.PL.CNF)
(assign : ℕ → Bool) : Prop :=
match pref with
| [] => Cslib.Logic.PL.CNF.Satisfies assign φ
| (isEx, v) :: rest =>
if isEx then
EvalQBF rest φ (Function.update assign v true) ∨
EvalQBF rest φ (Function.update assign v false)
else
EvalQBF rest φ (Function.update assign v true) ∧
EvalQBF rest φ (Function.update assign v false)
abbrev CNF := List CNFClause
CSLibExt/Logics/Propositional/CNF/Basic.lean:33
def Satisfies (assignment : Nat → Bool) (formula : CNF) : Prop :=
∀ clause ∈ formula, CNFClause.Satisfies assignment clause
CSLibExt/Logics/Propositional/CNF/Semantics.lean:71
Uses 2 · Used by 1
DefinitionTQBF as a decision problem#✓fully proved
The TQBF decision problem accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding, to a pair \((Q, \varphi)\), where \(Q\) is a quantifier prefix, a list of \(m\) pairs \((e_1, v_1), \dots, (e_m, v_m)\) of a flag \(e_i\) (true for \(\exists\), false for \(\forall\)) and a variable \(v_i \in \mathbb{N}\), and \(\varphi\) is a CNF formula, such that \(v_1, \dots, v_m\) are \(0, 1, \dots, m - 1\) in some order, every variable occurring in \(\varphi\) is less than \(m\), and the quantified formula with prefix \(Q\) and matrix \(\varphi\) holds under the assignment that sends every variable to false.
noncomputable def tqbfDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := List (Bool × ℕ) × Cslib.Logic.PL.CNF) x with
| some i => decide (
List.Perm (i.1.map Prod.snd) (List.range i.1.length) ∧
(∀ clause ∈ i.2, ∀ l ∈ clause, l.1 < i.1.length) ∧
EvalQBF i.1 i.2 (fun _ => false))
| none => false
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def bitDecode [BitstringEncoding α] (l : List Bool) : Option α := toEncoding.decode l
MathlibExt/Computability/Complexity.lean:58
abbrev CNF := List CNFClause
CSLibExt/Logics/Propositional/CNF/Basic.lean:33
def EvalQBF (pref : List (Bool × ℕ)) (φ : Cslib.Logic.PL.CNF)
(assign : ℕ → Bool) : Prop :=
match pref with
| [] => Cslib.Logic.PL.CNF.Satisfies assign φ
| (isEx, v) :: rest =>
if isEx then
EvalQBF rest φ (Function.update assign v true) ∨
EvalQBF rest φ (Function.update assign v false)
else
EvalQBF rest φ (Function.update assign v true) ∧
EvalQBF rest φ (Function.update assign v false)
WantedExt/Complexity/KeyTheorems/TQBFPSPACECompleteWanted.lean:45
Uses 12 · Used by 1
TheoremTQBF is PSPACE-complete#●ready to prove
The TQBF decision problem, of true quantified Boolean formulas with a CNF matrix, lies in the class PSPACE of decision problems, and every decision problem in PSPACE has a polynomial-time many-one reduction to it.
public theorem_wanted tqbf_pspace_complete :
tqbfDec ∈ PSPACE ∧ ∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ PSPACE → Cslib.CookLevin.PolyManyOneRed L tqbfDec
noncomputable def tqbfDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := List (Bool × ℕ) × Cslib.Logic.PL.CNF) x with
| some i => decide (
List.Perm (i.1.map Prod.snd) (List.range i.1.length) ∧
(∀ clause ∈ i.2, ∀ l ∈ clause, l.1 < i.1.length) ∧
EvalQBF i.1 i.2 (fun _ => false))
| none => false
WantedExt/Complexity/KeyTheorems/TQBFPSPACECompleteWanted.lean:59
def PSPACE : DecisionComplexityClass :=
{L | langOf L ∈ Cslib.Turing.MultiTapeTM.Classes.PSPACE}
CSLibExt/Computability/Complexity/Classes.lean:117
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def PolyManyOneRed (L₁ L₂ : MetaMathlibExt.ComplexityTheory.DecisionProblem) : Prop :=
∃ reduce : List Bool → List Bool,
MetaMathlibExt.ComplexityTheory.IsPolyTime reduce ∧ ∀ x, L₁ x = L₂ (reduce x)
CSLibExt/Computability/CookLevin.lean:396
Sources
- L. J. Stockmeyer and A. R. Meyer, "Word problems requiring exponential time", Proceedings of the Fifth Annual ACM Symposium on Theory of Computing (STOC 1973), 1-9; C. H. Papadimitriou, Computational Complexity, 1994, Theorem 7.4.
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.