Counting satisfying inputs of circuits by tensor contraction #
For every finite Boolean signature, one native machine computes the number of satisfying inputs
of every circuit with s gates in time 2 ^ (A (s + 1) / √⌊log₂ (s + 2)⌋) times a polynomial in
the encoding length, and in polynomial space
(ContractionCounting.exists_circuitSatCounter). On circuits with at most C n + C gates, for
n inputs, this is time 2 ^ O_C(n / √log n) times a polynomial
(ContractionCounting.exists_linearSizeCircuitSatCounter), with the machine fixed before C.
The machine compiles the circuit with the frontier compiler (Frontier.Compiler.toCNF), which
introduces one variable for each reachable wire and preserves the count up to the factor
2 ^ Compiler.freeShift (Compiler.acceptCount_eq_two_pow_freeShift_mul_modelCount), and counts
the models of the formula with the tensor-contraction counter
ContractionCounting.exists_modelCounter. That counter runs in time
2 ^ (A (m + 1) / √⌊log₂ (n + 2)⌋) for m clauses on n variables, so it needs the formula to be
sparse: every reachable gate's wire is a variable, so a circuit of fan-in k with o outputs
compiles to at most 2 ^ (k + 1) (n + o) clauses on n variables
(Compiler.length_toCNF_le_numVars). The number of variables is at most k s + o.
This replaces the interpolationScale rate of CircuitCounting.exists_circuitSatCounter, the
§6.4 rate of [OAI26k], by the fixed-density rate of its Theorem 1.1.
Source relation #
Appendix C.1 of [OAI26k] (p. 51) encodes a circuit with n inputs and s gates as a
3-CNF with a variable for each gate and O(n + s) variables and clauses, to decide satisfiability
of linear-size circuits in time 2 ^ o(n); Theorem 1.1 (p. 2) gives the fixed-density counting
rate 2 ^ O(n / √log n) for #k-SAT with at most D n clauses. Exact counting over arbitrary
finite signatures, with the exponent in the number of gates, is a library extension.
Main results #
ContractionCounting.exists_shiftedCounter_of_polyTime_toCNF: compose the tensor-contraction counter with a polynomial-time compilation to sparse bounded-width formulas and a power-of-two factor.ContractionCounting.exists_circuitAcceptCounter,ContractionCounting.exists_circuitSatCounter,ContractionCounting.exists_booleanCircuitSatCounter: the counter, with exponentA (s + 1) / √⌊log₂ (s + 2)⌋forsgates.ContractionCounting.exists_linearSizeCircuitSatCounter,ContractionCounting.exists_linearSizeBooleanCircuitSatCounter: for each size constantC, exponentA (n + 1) / √⌊log₂ (n + 2)⌋on circuits with at mostC n + Cgates.
References #
- OpenAI, The Exponential Time Hypothesis is False, Theorem 1.1 (p. 2) and Appendix C.1 (p. 51).
Composing the counter with a compilation to sparse formulas #
Counting through a sparse compilation. Given a polynomial-time compilation φ to
formulas whose clauses have at most k literals, with at most D (n + 1) clauses on n
variables and at most C μ + C variables, and a polynomial-time shift, one machine computes
2 ^ shift x * (φ x).modelCount in time 2 ^ (A (μ x + 1) / √⌊log₂ (μ x + 2)⌋) times a
polynomial in the encoding length, and in polynomial space.
Circuits #
Acceptance counting for circuits by tensor contraction. For every finite Boolean
signature σ and output predicate acc, one machine computes c.2.acceptCount I acc on every
circuit c, in time 2 ^ (A (s + 1) / √⌊log₂ (s + 2)⌋) times a polynomial in the encoding
length, where s is the number of gates, and in polynomial space.
#Circuit-SAT by tensor contraction. For every finite Boolean signature σ, one
machine computes the number c.2.satCount I of satisfying inputs of every circuit c, in time
2 ^ (A (s + 1) / √⌊log₂ (s + 2)⌋) times a polynomial in the encoding length, where s is the
number of gates, and in polynomial space.
De Morgan #Circuit-SAT by tensor contraction. One machine computes the number of
satisfying inputs of every De Morgan circuit with s gates in time
2 ^ (A (s + 1) / √⌊log₂ (s + 2)⌋) times a polynomial in the encoding length, and in polynomial
space.
#Circuit-SAT for linear-size circuits. For every finite Boolean signature σ, one
machine computes c.2.satCount I on every circuit c, in polynomial space, and for each size
constant C its time on circuits with at most C n + C gates, for n inputs, 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 C; only A
depends on C.
De Morgan #Circuit-SAT for linear-size circuits. One machine computes the number of
satisfying inputs of every De Morgan circuit, in polynomial space, and for each size constant C
its time on circuits with at most C n + C gates, for n inputs, 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 are fixed before C; only A depends on C.