# count-catcher: Lean Theorems from Model Counting Certificates

arXiv: https://arxiv.org/abs/2610.36196 · HTML: https://mlsanity.com/paper/2610.36196/

## Key facts

- No citing papers in the map yet (data through 26 Nov 2026).
- Builds on 11 of its 60 references that are in the map.
- Submitted 26 Oct 2026.

## Builds on (most cited first, 11 of 11)

- [Efficient Certified RAT Verification](https://mlsanity.com/paper/1612.02353/) (2016)
- [Lean-SMT: An SMT tactic for discharging proof goals in Lean](https://mlsanity.com/paper/2505.15796/) (2025)
- [Formal Verification of the Empty Hexagon Number](https://mlsanity.com/paper/2403.17370/) (2024)
- [Knowledge compilation languages as proof systems](https://mlsanity.com/paper/1903.04039/) (2019)
- [Formally Certified Approximate Model Counting](https://mlsanity.com/paper/2406.11414/) (2024)
- [Certified Knowledge Compilation with Application to Formally Verified Model Counting](https://mlsanity.com/paper/2501.12906/) (2025)
- [A canonical generalization of OBDD](https://mlsanity.com/paper/2604.05537/) (2026)
- [Complete Symmetry Breaking for Finite Models](https://mlsanity.com/paper/2502.10155/) (2025)
- [The Model Counting Competitions 2021-2023](https://mlsanity.com/paper/2504.13842/) (2025)
- [Sequencelib: A Computational Platform for Formalizing the OEIS in Lean](https://mlsanity.com/paper/2601.11757/) (2026)
- [Streaming LRAT Certificates into Lean Theorems](https://mlsanity.com/paper/2607.00815/) (2026)

## Abstract (arXiv)

We present count-catcher, a tool that turns a CPOG certificate of a count by the exact model counter d4 into a Lean theorem that a CNF formula defined in Lean has exactly N models over V variables. With an encoding lemma, this theorem becomes a theorem about the number of combinatorial objects. A CPOG certificate consists of a Boolean circuit equivalent to the formula and a proof of equivalence. count-catcher checks in Lean that the formula implies the circuit (forward check) and the circuit implies the formula (reverse check). For the forward check, lrat-catcher streams a refutation through the LRAT checker of Lean's standard library. The reverse check and the validity check of the circuit are computations proved correct in Lean. Lean runs all three checks as compiled code, so the theorem depends on Lean's kernel, compiler and runtime, as does CPOG's verified checker. We combine the theorem with results from Mathlib, for instance with Burnside's lemma to count graphs up to isomorphism. We prove the number of Latin squares of order 8 as a weighted sum of hundreds of certified counts from about eight terabytes of certificates. We turn about half of the 2022 Model Counting Competition formulas into theorems, with the three checks taking about a quarter of the time of CPOG's verified checker. We found that CPOG's unverified checker reported wrong counts, and removed its verified checker's dependence on two unproved lemmas. End to end, a theorem costs about the same as a checked count.
