LeanCSP is a framework designed to provide formal, end-to-end verification for constraint satisfaction problems (CSPs). By integrating the Lean theorem prover, the framework ensures that both the reformulation of a problem—such as adding symmetry-breaking constraints—and the final answers provided by external solvers are mathematically correct. This allows users to establish the satisfiability or unsatisfiability of complex combinatorial problems without needing to trust the external software used to solve them.
Verifying Problem Reformulation
Practitioners often modify CSPs to improve solver performance, such as by adding symmetry-breaking constraints. However, these modifications can contain subtle errors that silently change the problem's solution. LeanCSP addresses this by allowing users to prove properties like equivalence and equisatisfiability directly within Lean. Because these proofs are parametric, they are established once for an entire problem family—such as the n-queens problem—and automatically apply to every instance of that problem regardless of size.
Certified Solver Execution
To solve specific instances, LeanCSP translates CSPs formulated in Lean into formats compatible with external solvers, including MiniZinc, SMT-LIB, and OPB. When a solver returns an answer, the framework verifies the result against the original problem specification. For unsatisfiable problems, the framework uses the pseudo-Boolean solver RoundingSat to generate proofs that are checked inside Lean using PBLean. This process ensures that any potential bugs in the external solver result in a failed check rather than an incorrect guarantee.
Performance and Practical Impact
The framework’s approach to verified symmetry breaking significantly reduces the computational burden on solvers. By applying a single parametric proof to a problem family, the authors observed a reduction in solver search effort by a factor of up to 2 × 10⁷. Despite the rigor of the formal verification process, the in-Lean certification remains efficient, requiring only a few minutes for the largest instances tested. The authors successfully used this pipeline to certify combinatorial results, including the Schur number S(4) = 44 and bounds for Ramsey and van der Waerden numbers.
Scope and Limitations
LeanCSP currently supports a library of over 40 constraint types, including comparison, arithmetic, and global constraints. The framework is specifically designed for CSPs where variables range over finite types and values are integers. While the framework provides a robust method for certifying results, it relies on the user to provide the initial formalization in Lean. The authors note that this approach distinguishes their work from standard proof-logging, which typically validates the low-level formula the solver works on, rather than establishing a theorem about the original CSP itself.
Comments (0)
to join the discussion
No comments yet
Be the first to share your thoughts!