Results checked
by a proof assistant.
For selected exact results, PQCF generates a Lean 4 statement that a reader can inspect, together with a proof that Lean's kernel checks mechanically. This page presents the first certificates, explains what they establish and what they do not, and shows how to reproduce them.
PQCF is the solver.
Lean is the judge.
Computational systems should not only produce results. For the claims they make, they should increasingly provide evidence that can be checked independently. Formal verification brings this capability to scientific software, one result at a time.
Three components have distinct responsibilities: Erlang/OTP coordinates, PQCF computes, and Lean 4 checks. The verification service is implemented in erlang-lean4, Quanterall's project for integrating Lean 4 proof checking into Erlang/OTP systems.
PQCF's solvers perform polynomial factorisation, gcd computation, exact linear algebra, reconstruction and integral reduction. These operations are tested against independent programs, but testing covers only the cases it executes. For an individual result, a stronger form of assurance is possible: PQCF generates a Lean 4 statement describing the result, together with a proof that Lean's kernel checks mechanically.
- Soundness of individual results. The proposed factors multiply back to the original polynomial; the proposed gcd divides both input polynomials, with the corresponding cofactors reconstructing them; and a proposed solution satisfies every equation of a linear system. These certificates establish the stated properties exactly, over the rationals.
- A small, explicit trusted base. Verification relies on Lean's kernel, Mathlib, the pinned Lean 4.36.0 toolchain and the three approved standard axioms (
propext,Classical.choice,Quot.sound). Each verdict reports the axioms used by the checked theorems. - No Lean build dependency in PQCF. PQCF generates certificates through
pq_leanwithout requiring Lean as a build dependency. Verification is performed separately by lean-check, which can run on the same Erlang node or on another node.
Testing, proof checking, and what neither covers. Testing checks selected executions. Formal proof checking establishes that a proof follows from a formal statement and its permitted axioms. Neither establishes by itself that the formal statement expresses the intended requirement.
What a certificate does not cover. A certificate covers the result it states, not the implementation that produced it. The current certificates establish specific soundness properties; they do not yet establish that a proposed gcd is the greatest common divisor, that polynomial factors are irreducible, or that a linear system has a unique solution. A further distinction matters: a verdict establishes that the proof is correct for the formal statement submitted to Lean. It does not establish that the statement captures the intended claim. That is why the statement itself is made available for inspection.
Proof checking
as an Erlang/OTP service.
erlang-lean4 (Apache 2.0) brings Lean 4 to Erlang/OTP systems. Its first part, lean-check, runs a supervised pool of Lean 4 workers with Mathlib behind one function, and returns a verdict for each check: valid, or invalid with Lean's errors, timeout or unavailable, with the axioms each theorem depends on. A worker that exceeds its time is killed and restarted, and the service can be called in the same node or from another over Erlang distribution, so an existing Erlang application can add proof checking without making Lean part of its own logic.
Submitted proofs are untrusted input: Lean can run code while it checks a file. lean-check therefore screens each submission and rejects constructs that would run or inject code. The screen is a deny-list, not a sandbox: it narrows what a submission can do, and a deployment that accepts proofs from others still needs operating-system and container isolation. Ours runs the workers in a container without network access.
| PQCF function | certifies | Lean proof |
|---|---|---|
pq_lean:factor | a factorisation: the input equals the product of the factors | ring |
pq_lean:gcd | a gcd G of A and B: A = G·A′ and B = G·B′, with the cofactors PQCF computed | ring |
pq_lean:linear | a solution of a linear system: every equation holds | norm_num |
How a certificate looks,
and a wrong one rejected.
PQCF factors x4 − y4 and asks lean-check, on another Erlang node, to certify that the factors multiply back. The statement Lean checks:
theorem pqcf_factor (x y : ℚ) :
(((x ^ 4) + ((-1) * (y ^ 4))) : ℚ) =
(1 * ((1 * x) + ((-1) * y)) * ((1 * x) + (1 * y)) * ((1 * (x ^ 2)) + (1 * (y ^ 2)))) := by
ring
| result | verdict | time |
|---|---|---|
| x4 − y4 = (x − y)(x + y)(x2 + y2) | valid | 450 ms |
| gcd(x3 − x, x2 + 2x + 1) = x + 1, with its cofactors | valid | 380 ms |
| x = 9/14, y = −13/28 solves 3x + 2y = 1, x − 4y = 5/2 | valid | 604 ms |
| the wrong solution y = 13/28 | invalid | Lean reduces the statement to False |
The factorisation's verdict lists the axioms its proof uses: the three approved standard ones (propext, Classical.choice, Quot.sound) and nothing else. These are small examples, chosen to show the whole path: PQCF computes, writes the certificate, sends it to lean-check over Erlang distribution, and receives the verdict. The output is reproduced in full, with the Lean source of each certificate, in PQCF's lean-certificates.md.
Fifteen published results,
all certified.
The polynomial gcds (task T7) and factorisations (task T8) of PQCF's published comparison with FORM, regenerated from their fixed seeds: five variables, inputs of 572 to 751 terms. For each, PQCF computes the result, writes its certificate, and lean-check checks it on another Erlang node.
| task | results | input terms | Lean source | verdict | checked in |
|---|---|---|---|---|---|
| T7 · gcds, with their cofactors | 10 | 572–751 | 171–243 kB each | 10 of 10 valid | 58–99 s each |
| T8 · factorisations | 5 | 572–722 | 87–108 kB each | 5 of 5 valid | 27–39 s each |
Every verdict lists the three approved standard axioms and nothing else; the fifteen took 16 minutes on one Lean worker (aarch64). How it was possible: Lean's own ring tactic builds its proof step by step, and on a 575-term identity it ran for more than 30 minutes without finishing. lean-check therefore adds a small certified library, PqcfCert: polynomial expressions, their value in any commutative ring, and a canonical form, with one theorem proved once, that two expressions with the same canonical form have the same value. A certificate is then checked by Lean's kernel computing both canonical forms, with no new axioms and no compiled code trusted; the same 575-term identity takes about a minute.
The run's full output, line by line: results/part1-2026-11-25.txt.
What is released,
and what comes next.
| part | status |
|---|---|
| erlang-lean4: lean-check, proof checking as an OTP service | Released Apache 2.0, on GitHub |
PQCF's certificates for factorisations, gcds and linear systems (pq_lean) | Tested on PQCF's main branch, not in a tagged release |
| Certificates for the 15 gcds and factorisations of PQCF's published comparison with FORM | Tested Reproduced 15 of 15 valid |
| Certificates for more of PQCF's published exact results | In development |
| A gcd's greatestness (a Bezout certificate), identities PQCF already compares with other programs (Wigner symbols, colour factors, β-function coefficients), exact steady states, interval certificates for high-precision numbers | Planned |
| lean-check as the proof checker in the reasoning of eAgent, part of layer L3 of FVLLMP | Planned |
| In-process verified kernels: small proven Lean functions called from the BEAM | Planned not implemented |
From a fresh clone,
to Lean's verdicts.
| what | version |
|---|---|
| PQCF | dd472fc, Erlang/OTP 27 (image pqcf-dev) |
| erlang-lean4 (lean-check) | 137489b, Erlang/OTP 27 (image lean-check) |
| Lean, Mathlib | Lean 4.36.0; Mathlib at its v4.36.0 tag, with the Lean REPL at the same tag, all pinned in lean-check's image |
| Machine | Docker, git, Linux x86_64 or aarch64, about 15 GB of disk and 16 GB of memory |
lean-check's image takes 15 to 30 minutes to build the first time. The run starts a lean-check node and a PQCF node on an internal Docker network, with no outside access:
git clone https://github.com/quanterall/pqcf.git
git clone https://github.com/quanterall/erlang-lean4.git
cd pqcf
docker build -t pqcf-dev .
(cd ../erlang-lean4 && docker build -t lean-check docker)
LEAN_CHECK_SRC=../erlang-lean4 DEMO=certify_published sh examples/lean/run.sh
You should see one line per result, then the summary; the times depend on your machine:
T7 gcd 1: 575 input terms, Lean source 177902 bytes -> valid in 66.4 s, axioms [Classical.choice, Quot.sound, propext]
...
T8 factor 5: 623 input terms, Lean source 94151 bytes -> valid in 29.0 s, axioms [...]
summary: 15 of 15 valid
Without DEMO=certify_published, the same script runs the three small certificates and the deliberately wrong one, in about 20 seconds: three lines valid, then the wrong solution rejected:
-> invalid, errors
unsolved goals
⊢ False
Tested from fresh clones of both repositories on 25 November 2026, twice, by the team that wrote it and independently by us: 15 of 15 valid both times, 28 to 104 seconds per certificate; the team's run produced the same Lean sources, byte for byte, as the published one. How to reproduce the results, step by step →