Approximate Model Counting
Approximate model counting is the task of approximating the number of satisfying assignments (models) of a Boolean formula. In the CNF setting, approximate counters typically aim to return estimates with probably approximately correct (PAC)-style guarantees on accuracy and confidence. The problem is important because exact model counting is #P-complete, and it has applications including Quantitative Information Flow.
Core approach: hashing with XOR constraints
A widely used approach to approximate model counting adds random XOR (parity) constraints to the input formula, informally shrinking the solution space until the resulting constrained instance becomes empty or small enough to reason about via SAT solving. The effectiveness of this strategy depends strongly on the SAT solver's ability to handle XOR constraints efficiently.
A recent line of work studies the use of sparse XOR constraints, motivated by the fact that shorter XORs are easier for SAT solvers to process. The available bounds for this sparse setting are closely related to the geometry of the model set, especially the minimum Hamming distance between models.
ApproxMC
For CNF formulas, ApproxMC is described as the state-of-the-art approximate model counter. It provides a scalable way to obtain model-count estimates with PAC-style guarantees. The soundness of its output depends on two pieces:
- the theoretical analysis of its randomized algorithm, and
- the correctness of its optimized implementation, particularly its stateful interaction with an incremental CNF-XOR SAT solver.
Connection to SAT witness generation
Approximate model counting is closely connected to almost-uniform generation of SAT witnesses. The SAT-sampling literature cited in the provided evidence states that almost-uniform generation is polynomially inter-reducible with approximate model counting. This connection is explicitly used by UniGen, which is described as strengthening uniformity guarantees by exploiting that relationship.
The evidence also states that in UniGen an approximate model counter is first used to estimate the number of solutions (|R_F|) within a specified tolerance and confidence. That estimate is then used to choose a small range of candidate values for the hashing parameter (m), which supports an almost-uniformity proof. This contrasts with PAWS, where the estimate is used to determine a unique value of (m), and the same style of almost-uniformity proof is not obtained.
Formal certification
Recent work presents the first certification framework for approximate model counting with formally verified guarantees on the quality of the output approximation. The framework combines:
- a static, once-off formal proof of the PAC guarantee in Isabelle/HOL, and
- dynamic, per-run verification of ApproxMC's calls to an external CNF-XOR solver using proof certificates.
The same work reports that certificate generation adds little overhead in experiments, and that its checker can fully certify 84.7% of instances with generated certificates under the same time and memory limits as the counter.