#2SAT on general 2-CNF formulas is #P-complete under counting Turing reductions #
Counting the satisfying assignments of a 2-CNF formula whose literals may have either sign
(SharpTwoSAT) belongs to #P and is #P-hard under polynomial-time counting Turing reductions
(CountingTuringComplete encCNF SharpTwoSAT).
This is not Valiant's theorem. Valiant 1979 (§4, problem 7 and
Theorem 1, p. 414, with reductions 6–7 on p. 415) proves that counting is #P-complete already for
monotone 2-CNF formulas, those in which no variable is negated (p. 413), for an oracle that
returns the function value (§2, p. 411). Hardness for general 2-CNF follows from the monotone
case and not conversely. The reduction below queries formulas with literals of both signs
(clauseWeightVarTauts, clauseWeightGadget), so it cannot call a monotone-only oracle. The
monotone theorem is not proved in this library and remains open in
#3672.
The construction and proof are original and do not follow the paper's route through matchings.
For a CNF φ with m clauses, clauseWeightTwoSAT φ r is a 2-CNF formula with
∑ σ, (r + 1) ^ φ.countUnsat σ models, the sum being over assignments to the variables of φ.
This is the value at r + 1 of a polynomial of degree at most m whose value at 0 is the model
count of φ, and a division-free finite difference recovers that value from the counts for
r = 0, …, m. Oracle answers are read through the library's bit-graph convention (AnswersBits).
Main definitions #
Cslib.Complexity.SharpTwoSAT: the number of satisfying assignments on occurring variables when every clause has length at most2, and0otherwise.Cslib.Complexity.clauseWeightTwoSAT: the2-CNFclause-weight formula.
Main results #
Cslib.Complexity.SharpTwoSAT.mem_SharpP:SharpTwoSAT ∈ SharpP encCNF.Cslib.Complexity.modelCount_clauseWeightTwoSAT: the model count∑ σ, (r + 1) ^ φ.countUnsat σof the clause-weight formula.Cslib.Complexity.countingTuringReducible_SharpSAT_SharpTwoSAT:#SAT ≤_T^#P #2SAT.Cslib.Complexity.SharpTwoSAT_countingTuringComplete:#2SATon general2-CNFformulas is#P-complete under counting Turing reductions.Cslib.Complexity.SharpTwoSAT_polyTime_implies_P_eq_NP: ifSharpTwoSAT ∈ FP, thenP = NP.
References #
- L. G. Valiant, The complexity of enumeration and reliability problems (the monotone theorem, not formalized here).
- L. G. Valiant, The complexity of computing the permanent.
- S. Arora, B. Barak, Computational Complexity: A Modern Approach.
Number of satisfying assignments of φ on its occurring variables when every clause has length
at most 2, and 0 otherwise (#2SAT). Literals of both signs are allowed: this is not the
monotone problem of Valiant 1979.
#2SAT belongs to #P.
The 2-CNF clause-weight gadget (original construction) #
Auxiliary clause-indicator variable index for clause i at weight parameter r.
Auxiliary chain variable index (i, j) (j < r - 1) at weight parameter r.
Width-2 tautology clauses ensuring every occurring variable v of φ appears at 2 * v.
The clause-weight 2-CNF formula at interpolation parameter r : ℕ.
Every clause of clauseWeightTwoSAT φ r has length at most 2.
SharpTwoSAT agrees with CNF.modelCount on clauseWeightTwoSAT φ r, whose clauses all have
length at most 2.
Number of occurring variables of clauseWeightTwoSAT φ r is at most
φ.vars.length + φ.length * (r + 1).
Binary size bound for SharpTwoSAT (clauseWeightTwoSAT φ r) whenever r ≤ φ.length.
Exact fibre counting and monotone Boolean chain cardinality #
Exact model count of the clause-weight 2-CNF formula: clauseWeightTwoSAT φ r has
∑ σ : φ.vars.toFinset → Bool, (r + 1) ^ φ.countUnsat ext(σ) models, where ext(σ) extends σ by
false outside the variables of φ.
Binomial finite-difference interpolation over ℤ and ℕ #
Exact integer finite-difference identity recovering SharpSAT φ from the 2-CNF counts
SharpTwoSAT (clauseWeightTwoSAT φ r) for r = 0, …, φ.length.
Pure nonnegative combination recovering SharpSAT φ from the list of r = 0..φ.length
answers [SharpTwoSAT (clauseWeightTwoSAT φ 0), …, SharpTwoSAT (clauseWeightTwoSAT φ φ.length)].
Polynomial-time certificates and #P-completeness of #2SAT #
#SAT reduces to #2SAT on general 2-CNF formulas by a polynomial-time counting Turing
reduction. The reduction queries clauseWeightTwoSAT φ r for r = 0, …, φ.length; these
formulas contain negated literals.
#2SAT on general 2-CNF formulas is #P-complete under polynomial-time counting Turing
reductions. This is weaker than Theorem 1 of Valiant 1979, which
proves completeness for monotone 2-CNF formulas: the hardness reduction used here queries
formulas with negated literals.
If #2SAT is computable in polynomial time (FP), then SAT ∈ P.
If #2SAT is computable in polynomial time (FP), then P = NP.