Documentation

CslibFrontier.Computability.Complexity.FineGrained.WideClauseCounting

Model counting by tensor contraction for unbounded clause width #

One native machine computes the number of satisfying assignments CNF.modelCount φ of every formula φ in conjunctive normal form, with no bound on the width of its clauses, in time 2 ^ (A (N + 1) / √⌊log₂ (N + 2)⌋) times a polynomial in the encoding length and in polynomial space, where N is the number of literal occurrences of φ (φ.vars.length) (ContractionCounting.exists_modelCounter_unboundedWidth). For formulas with at most D n literal occurrences on n variables this is 2 ^ O_D(n / √log n) times a polynomial (ContractionCounting.exists_modelCounter_unboundedWidth_linearLength), so sparse formulas are counted in time 2 ^ o(n) even when their clauses are long.

The machine. It splits every clause into binary OR gates (Cslib.Complexity.toSharpThreeSAT, the count-preserving split of §2.8 of [OAI26k], p. 18). The result has clauses of at most three literals, the same number of satisfying assignments, and between N and 7 N literal occurrences (Cslib.Complexity.length_vars_toSharpThreeSAT). Then it runs the contraction counter for width three (ContractionCounting.exists_modelCounter_occurrences), whose exponent is O(N / √log N) in the number of literal occurrences.

After the split, every vertex of the contracted network has at most four ports and an explicit table, so the form of Theorem D.1 with entries computed by procedures, which allows degree ⌈s ^ (9/10)⌉, is not needed; without a split it would not cover clauses wider than that bound either.

Source relation. Theorem 1.1 of [OAI26k] (p. 2) is stated for k-CNF with fixed k, in terms of the numbers of variables and clauses; its fixed-density case is proved in Appendix D.2 (p. 54) from Theorem D.1 (p. 53). The bound here, for unbounded width and in terms of the number of literal occurrences, combines that proof with the split of §2.8; the combination is a library extension, not a statement of the manuscript.

Main results #

References #

theorem Cslib.Complexity.ContractionCounting.exists_modelCounter_unboundedWidth :
∃ (count : Logic.PL.CNF ℕ → ℕ) (A : ℕ) (e : ℕ) (b : ℕ), (∀ (φ : Logic.PL.CNF ℕ), count φ = φ.modelCount) ∧ Turing.MultiTapeTM.ComputableInO count encCNF Turing.MultiTapeTM.encNat (fun (φ : Logic.PL.CNF ℕ) => 2 ^ (A * (φ.vars.length + 1) / (Nat.log 2 (φ.vars.length + 2)).sqrt) * ((encCNF φ).length + 1) ^ e) fun (φ : Logic.PL.CNF ℕ) => ((encCNF φ).length + 1) ^ b

Model counting by tensor contraction for unbounded clause width. One machine computes φ.modelCount on every formula φ, in time 2 ^ (A (N + 1) / √⌊log₂ (N + 2)⌋) times a polynomial in the encoding length and in polynomial space, where N is the number of literal occurrences of φ.

theorem Cslib.Complexity.ContractionCounting.exists_modelCounter_unboundedWidth_linearLength :
∃ (count : Logic.PL.CNF ℕ → ℕ) (T : Logic.PL.CNF ℕ → ℕ) (S : Logic.PL.CNF ℕ → ℕ) (e : ℕ) (b : ℕ), (∀ (φ : Logic.PL.CNF ℕ), count φ = φ.modelCount) ∧ Turing.MultiTapeTM.ComputableInO count encCNF Turing.MultiTapeTM.encNat T S ∧ (∀ (φ : Logic.PL.CNF ℕ), S φ = ((encCNF φ).length + 1) ^ b) ∧ ∀ (D : ℕ), ∃ (A : ℕ), ∀ (φ : Logic.PL.CNF ℕ), φ.vars.length ≤ D * φ.numVars → T φ ≤ 2 ^ (A * (φ.numVars + 1) / (Nat.log 2 (φ.numVars + 2)).sqrt) * ((encCNF φ).length + 1) ^ e

Linearly many literal occurrences. One machine computes φ.modelCount on every formula φ, in polynomial space, and for each D its time on formulas with at most D n literal occurrences, for n variables, is 2 ^ (A (n + 1) / √⌊log₂ (n + 2)⌋) times a polynomial in the encoding length. The machine, its time and space functions and the degree e of the polynomial are fixed before D; only A depends on D.