Documentation

CslibFrontier.Computability.Complexity.Problems.SharpSAT

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 #

Main results #

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 #

          The number of distinct variables occurring in φ is computable in polynomial time in unary.

          #SAT belongs to #P, with certificates as long as the encoded formula.