Counting the satisfying assignments of a Boolean formula #
QBF.modelCount φ is the number of satisfying assignments of a formula φ: the sets of free
variables of φ whose indicator makes φ true. For a quantifier-free formula, a Boolean formula
not necessarily in conjunctive normal form, this is the count #(φ) of Arora and Barak, draft
§9.3.2, printed p. 181, and φ belongs to their ⊕SAT (Definition 9.14) exactly
when the count is odd. Cslib.Complexity.SharpSAT is the count for formulas in conjunctive normal
form.
The counting verifier Cslib.Complexity.SharpFormula.verifier reads a certificate as the values
of the free variables of φ without repetition, in the order of
Cslib.Logic.PL.QBF.distinctFreeVars, and evaluates φ from its tokens. On a quantifier-free
formula it accepts exactly one certificate of that length for each satisfying assignment
(Cslib.Complexity.SharpFormula.acceptCount_verifier), and it runs in polynomial time
(Cslib.Complexity.SharpFormula.computableInPolyTime_verifier).
Main definitions #
Cslib.Logic.PL.QBF.modelCount: the number of satisfying assignments of the free variables.Cslib.Logic.PL.QBF.distinctFreeVars: the free variables without repetition.Cslib.Complexity.SharpFormula.verifier: the counting verifier.
Main results #
Cslib.Complexity.SharpFormula.acceptCount_verifier: one certificate for each satisfying assignment.Cslib.Complexity.SharpFormula.computableInPolyTime_verifier: the verifier is polynomial-time.Cslib.Logic.PL.QBF.three_mul_length_distinctFreeVars_le,Cslib.Complexity.SharpFormula.computableInPolyTime_length_distinctFreeVars: the certificate length is at most a third of the length of the encoding and computable in unary.
References #
The number of satisfying assignments of φ: the sets S of free variables of φ such
that φ is true when exactly the variables of S are true.
A formula has at least as many tokens as free variables, counted with multiplicity.
Each free variable takes at least three bits of the encoding.
The counting verifier for Boolean formulas: the certificate gives the values of the free
variables in the order of distinctFreeVars, and φ is evaluated from its tokens under the
assignment making exactly the variables of trueVars true.
On a quantifier-free formula the verifier evaluates it.
The counting verifier accepts one certificate for each satisfying assignment of a
quantifier-free formula: certificates of length |distinctFreeVars φ|.
Polynomial time #
The free variables without repetition are listed in polynomial time.
The length of a certificate is computable in polynomial time, in unary.
The counting verifier is polynomial-time, including on certificates of arbitrary length.