Quantified Boolean formulas #
Quantified Boolean formulas over an arbitrary type V of variables: variables, the two constants,
negation, conjunction, disjunction, and quantifiers ∃ v and ∀ v over the truth value of a
variable Stockmeyer and Meyer. QBF.eval σ φ is the truth value of φ
under the assignment σ; a quantifier over v evaluates its body with v set to each of the two
truth values (Function.update).
The value of a formula depends only on its free variables (QBF.eval_congr), so a closed formula,
one without free variables, has the same value under every assignment (QBF.eval_eq_of_closed).
The true closed formulas form the problem TQBF (Cslib.Complexity.TQBF), which is proved
PSPACE-complete in Complexity.Computability.Complexity.Classes.Space.TQBF
(Cslib.Complexity.TQBF_pspaceComplete) Arora and Barak, Section 4.2.
cslib's Cslib.Logic.PL.Proposition has no quantifiers and is a syntax for proof systems rather
than an evaluated one, so it is not reused. QBF V instantiates cslib's logical operator
typeclasses (Top, Bot, Cslib.Logic.HasNot, Cslib.Logic.HasAnd, Cslib.Logic.HasOr,
Cslib.Logic.HasImp, Cslib.Logic.HasIff), so that ⊤, ⊥, ¬, ∧, ∨, →, ↔, and ⋀
are available on QBF V when Cslib.Logic is open.
Main definitions #
Cslib.Logic.PL.QBF: the formulas, withTop,Bot,HasNot,HasAnd,HasOr,HasImp, andHasIffinstances.Cslib.Logic.PL.QBF.eval: the value of a formula under an assignment.Cslib.Logic.PL.QBF.freeVars,Cslib.Logic.PL.QBF.Closed.Cslib.Logic.PL.QBF.vars,Cslib.Logic.PL.QBF.size: the variables, free or bound, and the number of nodes.Cslib.Logic.PL.QBF.exs,Cslib.Logic.PL.QBF.alls,Cslib.Logic.PL.QBF.conj,Cslib.Logic.PL.QBF.imp,Cslib.Logic.PL.QBF.iff,Cslib.Logic.PL.QBF.lit: derived connectives, blocks of quantifiers and conjunctions of lists (QBF.conj_eq_finiteAnd).Cslib.Logic.PL.QBF.ofClause,Cslib.Logic.PL.QBF.ofCNF: clauses and formulas in conjunctive normal form as quantified Boolean formulas.
Main results #
Cslib.Logic.PL.QBF.eval_ex_eq_true_iff,Cslib.Logic.PL.QBF.eval_all_eq_true_iff: the quantifiers as∃and∀over a truth value.Cslib.Logic.PL.QBF.eval_congr: the value depends only on the free variables.Cslib.Logic.PL.QBF.eval_eq_of_closed: a closed formula has the same value under every assignment.Cslib.Logic.PL.QBF.eval_not_ex,Cslib.Logic.PL.QBF.eval_not_all: De Morgan's laws for the quantifiers.Cslib.Logic.PL.QBF.eval_exs_eq_true_iff,Cslib.Logic.PL.QBF.eval_alls_eq_true_iff: blocks of quantifiers range over the assignments that agree outside the block.Cslib.Logic.PL.QBF.eval_ofCNF,Cslib.Logic.PL.QBF.mem_freeVars_ofCNF: formulas in conjunctive normal form keep their value and their variables.
References #
Quantified Boolean formulas over variables of type V.
- var {V : Type u_1} (v : V) : QBF V
The variable
v. - top {V : Type u_1} : QBF V
The constant true.
- bot {V : Type u_1} : QBF V
The constant false.
- not {V : Type u_1} (φ : QBF V) : QBF V
Negation.
- and {V : Type u_1} (φ ψ : QBF V) : QBF V
Conjunction.
- or {V : Type u_1} (φ ψ : QBF V) : QBF V
Disjunction.
- ex {V : Type u_1} (v : V) (φ : QBF V) : QBF V
Existential quantification
∃ v, φover the truth value ofv. - all {V : Type u_1} (v : V) (φ : QBF V) : QBF V
Universal quantification
∀ v, φover the truth value ofv.
Instances For
Instances For
Evaluation #
Evaluating a variable var v under σ yields σ v.
The constant top evaluates to true.
The constant bot evaluates to false.
Evaluating ex v φ takes the disjunction of φ with v set to false and to true.
Evaluating all v φ takes the conjunction of φ with v set to false and to true.
Free variables #
The free variables of a formula: the variables with an occurrence outside the scope of every quantifier over them.
Instances For
The free variables of var v are {v}.
The constant top has no free variables.
The constant bot has no free variables.
Negation preserves the set of free variables.
Existential quantification over v removes v from the free variables of φ.
Universal quantification over v removes v from the free variables of φ.
Updating a variable that is not free does not change the value of a formula.
Variables and size #
The variables of a formula, free or bound, with multiplicity, in prefix order.
Instances For
The number of nodes of a formula.
Instances For
Closed formulas #
A formula is closed when it has no free variables.
Instances For
Being closed is decidable when variable equality is decidable.
A closed formula has the same value under every assignment.
A negated formula φ.not is closed if and only if φ is closed.
Derived connectives #
QBF.conj agrees with Cslib.Logic.finiteAnd (⋀).
The literal of v with sign b: v itself for true, its negation for false.
Instances For
A block of existential quantifiers ranges over the assignments that agree with the given one outside the block.
A block of universal quantifiers ranges over the assignments that agree with the given one outside the block.
Embedding a clause via ofClause preserves its truth value under σ.
A formula in conjunctive normal form keeps its value.