Counting satisfying assignments: #SAT #
SharpSAT φ is the number of satisfying assignments of a formula φ in conjunctive normal form
over variables numbered by ℕ: the assignments of the variables occurring in φ that satisfy it
(Cslib.Logic.PL.CNF.modelCount). Valiant showed that #SAT is complete for #P under
parsimonious reductions Valiant, Arora and Barak, Section 17.3;
completeness is proved in CslibFrontier/Computability/Complexity/CookLevin/Counting.lean.
#SAT belongs to #P (Cslib.Complexity.SharpSAT.mem_SharpP). The verifier of SAT
(Cslib.Complexity.SAT.verifier) reads the value of each variable at the position of its first
occurrence in φ.vars and ignores the other bits of the certificate, so it accepts each
satisfying assignment once for every setting of the ignored bits. The counting verifier
Cslib.Complexity.SharpSAT.verifier asks in addition that the ignored bits be false
(Cslib.Complexity.SharpSAT.canonical). It then accepts exactly one certificate of length
|encCNF φ| for each satisfying assignment (Cslib.Complexity.SharpSAT.acceptCount_verifier).
Main definitions #
Cslib.Complexity.SharpSAT: the number of satisfying assignments.Cslib.Complexity.SharpSAT.isFirst: testing for the first occurrence of a variable.Cslib.Complexity.SharpSAT.canonical,Cslib.Complexity.SharpSAT.verifier: the canonical certificates and the counting verifier.
Main results #
Cslib.Complexity.SharpSAT.mem_SAT_iff,Cslib.Complexity.SharpSAT.mem_USAT_iff:SATandUSATthrough#SAT.Cslib.Complexity.SharpSAT.acceptCount_verifier: the verifier accepts one certificate for each satisfying assignment.Cslib.Complexity.SharpSAT.computableInPolyTime_card_vars: the number of occurring variables is computable in polynomial time in unary.Cslib.Complexity.SharpSAT.computableInPolyTime_verifier: the verifier is polynomial-time.Cslib.Complexity.SharpSAT.mem_SharpP:#SATbelongs to#P.
References #
#SAT: the number of satisfying assignments of a formula over variables numbered by ℕ,
counting assignments of the variables occurring in the formula.
Instances For
A formula is satisfiable exactly when it has a satisfying assignment.
A formula is uniquely satisfiable exactly when it has one satisfying assignment.
The counting verifier #
Position i of a certificate for φ is the first occurrence of a variable in φ.vars.
Instances For
A certificate for φ is canonical when it is false at every position that is not the first
occurrence of a variable.
Instances For
The verifier for #SAT: the certificate is canonical and describes a satisfying assignment,
read at the first occurrences of the variables.
Instances For
The counting verifier accepts one certificate for each satisfying assignment: the
certificates of length |encCNF φ| it accepts are as many as the satisfying assignments of φ.
Polynomial time #
Testing for a first occurrence is polynomial-time, with the position in unary.
The number of distinct variables occurring in φ is computable in polynomial time in unary.
The counting verifier is polynomial-time, including on certificates of arbitrary length.