ACPOG: A Lean 4 Verified Algebraic Proof System for Exact Model Counting
We present ACPOG (Algebraic Certified Partitioned-Operation Graph), a certificate format and formally verified checker for exact weighted model counts over the Gaussian rationals ā(i). A single 92-line specification (Acpog/Syntax.lean) covers #SAT, rational weighted model counting (WMC), and complex algebraic model counting (AMC). The Lean 4 development totals 11,532 implementation lines across 19 files (11,587 lines across all 21 .lean files) built on core Lean v4.19.0 with zero Mathlib or external dependencies. The main theorem Acpog.acpog_sound proves with zero external hypotheses that every accepted certificate establishes the exact weighted count of the input formula. The verified checker implements five rules: raw clause import (R-Import), single-pivot š½2 affine elimination (R-Affine), local signed linear identities (R-Linear), exact table contraction with a ā¤2 Gauss-sum step (R-Contract), and a non-crossing Pfaffian rule with Valiant's holographic basis change (R-Pfaffian), proved sound from two linear-order stack tests, a fraction-free skew eliminator, and Valiant's Lemma G without Kasteleyn orientations or planar embeddings. We formalize linear-token XOR completeness in Lean and prove on paper that the unmodified five-rule checker already certifies all three tractable classes (š, š«, ā³) of the Cai-Fu planar #CSP trichotomy over ā(i) in polynomial size, deriving the ā¤4 Gauss sum inside join and marg (alongside a standalone Lean-verified stepGauss4_sound optimization). We establish unconditional exponential separations beyond Tseitin: 2Ī©(āN) on Valiant's triangular grids against d-DNNF, decision-DNNF, MICE, and dense/sparse tensor proof systems, and 2Ī©(n) on unweighted quadratic-parity expander level sets against parity-augmented DNNF[ā] (plus exact 2nāα(G) for AFF[āØ]), while four-rule ACPOG certifies both in O(n(m+n)) steps. Against the compiled Lean binary, 64 end-to-end tests, 24 adversarial Pfaffian forgeries, and 27 affine and DNNF[ā] runs all match expected verdicts. Source code, Lean 4 proofs, and exact verification scripts: https://github.com/dvgyl/subsat and archive DOI 10.5281/zenodo.24689870.
Authors
- Dev D. Goyal (ORCID: https://orcid.org/0009-0009-9132-744X)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-30
- DOI
- https://doi.org/10.5281/zenodo.24689867
- Primary Topic
- Formal Methods in Verification
- Type
- preprint