formal verification
Also known as: proof assistant.
Checking every logical step of a mathematical proof by a small computer kernel against explicit axioms, paired with statement-equivalence checks ensuring the proved theorem matches the intended conjecture.
Level 1 — First-Principles
In traditional mathematics, a referee reads a paper and checks whether each step follows from earlier theorems without hidden gaps. For a proof spanning thousands of pages or hundreds of thousands of machine-generated lemmas, human line-by-line checking cannot catch every subtle omission. Formal verification translates both the statement and every deduction into a strict symbolic language checked by a proof assistant (here, Lean 4). A small trusted core program—the kernel—verifies every single inference rule back to a tiny list of foundational axioms.
Checking the steps, however, solves only half the trust problem. If a proof proves a statement with a subtle typo—for instance, accidentally dropping cases from the global function extending sorry, custom axioms) appear, checks that the submitted statements match the frozen challenge declarations type-for-type, and replays the proof term through independent external kernels.
Limits of the intuition
Comparing a proof assistant to a software test suite or syntax checker understates its logical rigor (it checks all infinitely many cases via universal quantification, not sampled inputs), while calling it "absolute certainty" overstates what any single artifact proves on its own. Two external audits remain essential: confirming that the formal definitions match standard mathematics (the statement-equivalence role of formal-conjectures and Comparator), and actually executing the kernel check rather than relying on static text inspection alone.
Level 2 — Undergrad Bridge
Lean 4 implements a dependent type theory (the Calculus of Inductive Constructions with quotient types and classical choice). Under the Curry–Howard correspondence, a proposition is a type P : Prop and a proof is a term t : P. The Lean kernel verifies t : P using only three standard axioms permitted by Mathlib:
propext(propositional extensionality),Quot.sound(soundness of quotient types),Classical.choice(the axiom of choice).
A challenge-vs-solution Comparator workflow splits trust into two isolated environments:
- Challenge module (root
Challenge.lean, importing onlyStatementswhich imports only Mathlib): states the five target theorems withby sorryand is frozen against edits. - Solution module (
src/Main.lean): imports the proof library (New.Main) and supplies actual proofs for the exact same declaration names.
(Upstream's parallel formal-conjectures challenge/solution pair—comparator/FormalConjecturesChallenge.lean and comparator/FormalConjecturesSolution.lean—is archived on alpoge@c900e67c2 pending re-integration on condensed main.)
Comparator checks that every target theorem in the solution has the exact same elaborated type as in the challenge (with no hijacked typeclass instances or shadowed names), uses only the three permitted axioms (propext, Quot.sound, Classical.choice), and replays the exported proof term through an independent external kernel ("enable_nanoda": true in comparator.json).
Level 3 — Formal Lean Contract
Stage 00 anchors the challenge entry point in:
00_statement/challenge.lean#riemannHypothesis(upstream rootChallenge.lean:7-8), checked againstMainviacomparator.json("enable_nanoda": true):leantheorem riemannHypothesis : RiemannHypothesis := by sorry
The parallel formal-conjectures target (comparator/FormalConjecturesChallenge.lean and comparator/formal-conjectures.json) is archived on upstream alpoge@c900e67c2 pending re-integration on condensed main.
Honest verification status (audit/verification-status.json): Local Lean compilation and kernel replay in this repository are currently unverified-locally. See the page's live verification banner (audit/verification-status.json) for the currently pinned upstream snapshot (leanprover/lean4:v4.37.0-rc1, Mathlib rev 31ce06eaadf4a200c0e1407c5f10953cf606b8f8), entry-file static token scanning (0 forbidden tokens across solution files, 5 expected sorry tokens in root Challenge.lean), and SHA-256 digests of comparator.json and upstream's proof guides (GUIDE.md, INDEX.md).
Where this analogy breaks
Comparing formal verification to running a compiler or spell-checker misses two crucial boundaries: a kernel checks logical validity given the definitions and axioms, so it cannot catch a subtly weakened theorem statement unless an independent comparator checks the statement—and a repository's proof is only locally verified once you actually build and check it with the kernel.
Formal Lean Anchors
theorem riemannHypothesis — Upstream source (Challenge.lean L7-L8)
theorem riemannHypothesis : RiemannHypothesis := by
sorry -- [EXTRACTED_STUB upstream=Challenge.lean:7-8 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=2 body_sha256=9c73f768c6b902af55b2843988f629261dd4578a5cd1d557b1db1ff4ef22ed0b]Related Concepts
- Riemann zeta function — The meromorphic function ζ(s) extending ∑ n⁻ˢ to all of ℂ ∖ {1}, linking prime numbers via its Euler product to zeros in the complex plane.
- Dirichlet L-function — The meromorphic continuation of ∑ χ(n) n⁻ˢ associated to a Dirichlet character χ, generalizing ζ(s) to track primes across residue classes modulo N.
Referenced By
- Stage: Formal Statement Contracts (
Statements.lean) - Stage: Full Proof Journey & Alpöge's 20-Step Map
- Stage: Independent Statement Equivalence (
FormalConjecturesStatement&FormalConjecturesChallenge) - Stage: Stage 00 — Formal Statements & Challenge Contracts
- Stage: The Five Entry Theorems (
Main.lean&Challenge.lean)
Authoritative Sources
- The Lean 4 Theorem Prover and Programming Language (paper) — L. de Moura and S. Ullrich, CADE 28, Springer LNCS 12699 (2021), pp. 625–635.
- The Lean Mathematical Library (paper) — The mathlib Community, Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs (CPP 2020), pp. 367–381.
- Formal Conjectures Repository (reference) — Google DeepMind, formal-conjectures (
github.com/google-deepmind/formal-conjectures, pinned commit d8d031d4998c78575159ccab9a7a9e95ce043883).
Page Glossary
- Riemann zeta function
- The meromorphic function ζ(s) extending ∑ n⁻ˢ to all of ℂ ∖ {1}, linking prime numbers via its Euler product to zeros in the complex plane.
- Dirichlet L-function
- The meromorphic continuation of ∑ χ(n) n⁻ˢ associated to a Dirichlet character χ, generalizing ζ(s) to track primes across residue classes modulo N.