PBLean: Pseudo-Boolean Proof Certificates for Lean 4

Stefan Szeider · DOI

TL;DR

PBLean is a new tool for the Lean 4 theorem prover that imports and verifies complex pseudo-Boolean (PB) proof certificates. By using a technique called "computational reflection," it scales to proofs with tens of thousands of steps, allowing researchers to turn solver outputs into formally verified, reusable mathematical theorems.

What Problem Does This Paper Address?

Modern combinatorial optimization often relies on Pseudo-Boolean (PB) solvers. Unlike standard SAT solvers that use simple logic, PB solvers handle linear constraints (e.g., $3x_1 + 5x_2 \geq 4$) and use "cutting-planes" reasoning. This makes them incredibly efficient for problems like the pigeonhole principle or parity constraints where standard SAT solvers struggle.

However, there is a "trust gap." These solvers are complex and can have bugs. While formats like VeriPB allow solvers to output proof certificates, checking these certificates inside a formal theorem prover like Lean 4 is historically difficult. Previous methods either exhausted memory by trying to build massive proof objects or acted as "black boxes" that provided a simple verdict without creating a theorem that could be used in larger mathematical developments.

Methods

The authors introduce PBLean, which bridges the gap between high-performance PB solvers and the Lean 4 proof assistant. The core innovations include:

  • Proof by Reflection: Instead of building a Lean proof term for every single step of a derivation (which is memory-intensive), the authors wrote a Boolean checker function in Lean. They proved this checker is sound once. Lean can then execute this checker as compiled native code using native_decide. This allows the system to verify massive proofs efficiently.
  • Support for VeriPB Kernel: The tool supports the full VeriPB kernel (version 3.0), including polynomial operations, reverse unit propagation (RUP), and proof-by-contradiction subproofs.
  • Verified Encodings: To ensure the solver is actually answering the right question, PBLean supports "verified encodings." Both the translation from a high-level problem (like graph theory) to PB constraints and the proof of that translation's correctness are formalized in Lean.

Datasets

The authors evaluated PBLean on several challenging combinatorial problems rather than standard machine learning datasets. These include:

  • Paley Graphs: Calculating independence numbers for primes $p \equiv 1 \pmod 4$ up to $p=101$.
  • Classic Combinatorial Benchmarks: Langford pairings, Schur numbers, Van der Waerden numbers, Ramsey numbers, and Equitable chromatic numbers.

Key Insights and Ideas

  • Scalability via Reflection: The "aha moment" is the performance delta. While explicit proof construction fails on even medium-sized problems (timing out or crashing), reflection allows Lean to handle proofs with over 63,000 lines in just a few minutes.
  • Closing the Trust Loop: By formalizing the encoding process, the authors ensure that the resulting Lean theorem is about the original mathematical object (e.g., "This graph has no independent set of size $k$") rather than just a statement about a list of abstract constraints.
  • Mathematical Discovery: Using the tool, the authors formally verified a non-intuitive property: the independence number of Paley graphs is not monotone. Specifically, they proved $\alpha(\text{Paley}(97)) = 6$, which is larger than $\alpha(\text{Paley}(101)) = 5$.

Key Results

  • Performance: For the Paley(101) instance, PBLean verified a 62,924-line proof in approximately 200 seconds.
  • Memory Efficiency: The reflection-based approach successfully verified instances where the "explicit" method timed out at 60 seconds (starting at $p=37$).
  • Composability: Unlike standalone checkers (like CakePB), PBLean produces actual Lean theorems. These can be used as lemmas in larger, more complex formal proofs within the Lean ecosystem.

Limitations and Future Work

  • Execution Bottleneck: The current bottleneck is the execution time of the compiled checker rather than Lean's kernel verification. Further optimization of the checker's data structures (like the hash map used for constraints) could improve speed.
  • Automation: While the system is powerful, it currently requires manual effort to set up the "bridge" between the problem and the certificate. The authors suggest developing a veripb tactic to further automate this pipeline.
  • Integration: Future work includes better integration with Mathlib (Lean's massive mathematical library) to allow these combinatorial results to support broader mathematical research.

Summary updated

Abstract

We present PBLean, a method for importing VeriPB pseudo-Boolean (PB) proof certificates into Lean 4. Key to our approach is reflection: a Boolean checker function whose soundness is fully proved in Lean and executed as compiled native code. Our method scales to proofs with tens of thousands of steps that would exhaust memory under explicit proof-term construction. Our checker supports all VeriPB kernel rules, including cutting-plane derivations and proof-by-contradiction subproofs. In contrast to external verified checkers that produce verdicts, our integration yields Lean theorems that can serve as composable lemmas in larger formal developments. To derive theorems about the original combinatorial problems rather than about PB constraints alone, we support verified encodings. This closes the trust gap between solver output and problem semantics since the constraint translation and its correctness proof are both formalized in Lean. We demonstrate the approach on various combinatorial problems.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
Paley(29) independence numberPBLean, Reflect (reflection-based checker)Reflect (ms)926 msProof Checking · checker=Reflect
Source quote
L375: 29 │ 4 │ 29 │ 204 │ 53 │ 5 │ 233 │ 19\,922 │ 926
BibTeX
@misc{szeider2026pblean,
  author = {Stefan Szeider},
  title = {{PBLean: Pseudo-Boolean Proof Certificates for Lean 4}},
  year = {2026},
  eprint = {2602.08692},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.08692},
}
Figure