$_ stdout

The Case for Verified Consensus, Part 2

This is Part 2 of a two-part post. Part 1 laid out why consensus correctness is the actual product for a blockchain, what “correct” formally means, and four distinct ways a verification claim can fail even when the proof itself is real: wrong, unshipped, partial, narrow.

Part 2 puts the specific technology under that lens: Lean 4, the theorem prover doing the actual proving, Aeneas and Charon translating Rust into a form it can check, and AI-orchestrated proof search doing the tactic-writing. The workhorse is real.

For consensus specifically, a proof certifies that the code honors the spec's assumptions, quorum floors, fault thresholds, fork-choice rules. Nothing in Lean 4 certifies those were the right properties to write, and that's exactly the gap the five case studies below go looking for.

Check the proof. Then check the assumptions underneath it. And check what the proof is attached to: a spec, a simplified model, or the binary a validator actually runs. Despite some years of effort, no single end-to-end case study out of those presented here runs machine-checked code in production.

BL Dr. Ben Livshits August 17, 2026 · 166 commits
// start with part 1 This is Part 2 of a two-part post. Part 1 covers why consensus correctness is the actual product for a blockchain, what “correct” formally means, and the four ways a formal-verification claim can fail even when the proof itself is real: wrong, unshipped, partial, narrow. Part 2 picks up from there: Lean 4 specifically, under that same lens.

04 Lean 4: A Real Paradigm Shift in Interactive Proving

Interactive theorem proving isn't new. Coq and Isabelle/HOL have both existed since the 1980s, and both have real pedigree: Coq underlies CompCert, a verified C compiler, and Isabelle/HOL underlies seL4, a verified microkernel. What's newer is Lean 4, developed initially at Microsoft Research under Leonardo de Moura and now maintained by the Lean Focused Research Organization (Lean FRO).

A history of interactive theorem provers, from Coq to the Lean FRO A horizontal timeline with a compressed break between the mid-1980s and the early 2010s. Left cluster: Coq, begun 1984 at INRIA by Huet and Coquand; Isabelle, first released 1986 by Larry Paulson at Cambridge. After the break: Lean 1, launched 2013 by Leonardo de Moura at Microsoft Research; Lean 2, released 2015; Lean 3, released 2017, the version the Mathlib community library was built on; Lean 4, described in the 2021 CADE-28 paper; and the Lean Focused Research Organization, founded July 2023 to maintain Lean going forward. 27 years Coq 1984, INRIA → CompCert Isabelle 1986, Cambridge → seL4 Lean 1 2013, MSR Lean 2 2015 Lean 3 2017 → Mathlib Lean 4 2021, CADE-28 Lean FRO Jul 2023
// Figure 5. Coq and Isabelle predate Lean by roughly three decades — Lean 4 is the newcomer in this lineage, not the origin of it.

That timeline covers the tools; it says nothing about what they've actually verified. Feng and Zhang's 2026 survey catalogs the theorem-proving landmarks by target protocol, property proved, and toolchain — a useful reality check on the field's actual track record before this post narrows in on Lean 4 specifically:

TargetPropertiesToolsModeling methodReference
Provable Broadcast, Reliable Broadcast,
Accountable Byzantine Confirmer
SafetyCoqFOL, TLAZhao et al. 2024
PBFTSafetyRodinEvent-BLi et al. 2022
GenJolteon
Fast Paxos
SafetyCoqAdoBHonoré et al. 2024
PBFTAgreementCoqVelisariosRahli et al. 2018
JolteonSafetyCoqLiDOQiu et al. 2024
UT,E,α, AT,E, EIGByzfIntegrity, irrevocability, agreement, terminationIsabelleHO model, HOLCharron-Bost et al. 2011
AlgorandSafetyCoqHOLAlturki et al. 2020
CKBConsistency, invariantCoqHOLLuan & Sun 2021
CBC CasperSafetyIsabelleHOLNakamura et al. 2019
CBC CasperSafetyCoqLi et al. 2020
2/3 ConsensusAgreement, validityNuprlLoE, EventMLRahli et al. 2015
Two-Phase CommitConsistency, atomicityCoqHOL, AnerisGregersen 2023
PaxosCorrectness
// Figure 6. Reproduced, with one row highlighted, from Feng & Zhang's 2026 survey, Table 5, “Research works based on Theorem Proving.” The Paxos row's blank tool, method, and reference cells are as printed in the source. The highlighted Jolteon row is the same Qiu-and-Shao research lineage, later extended from Coq/LiDO into Rocq/LiDO-DAG, behind the Mysticeti case study elsewhere in this post.

That highlighted row deserves a moment before moving on: the Jolteon proof, built on Qiu et al.'s own LiDO framework in Coq, is the direct predecessor of the same authors' later LiDO-DAG proof of Mysticeti in Rocq, Coq's 2024 rename, the “right proof, unshipped fix” case study from Part 1. It's one of the few entries in that table where a single theorem-proving lineage tracks a protocol all the way from a research prototype to something actually running in production.

Lean 4 is grounded in the Calculus of Inductive Constructions (CIC), the same dependent-type-theory family Coq uses, but it made a specific set of engineering bets legacy provers didn't: a single unified language for specifications, tactics, and the macro system itself (rather than Coq's split between Gallina, Ltac, and OCaml build tooling), compilation to fast native C code rather than interpretation, and a metaprogramming layer that makes writing custom tactics and SMT bindings (Z3, CVC5) a first-class activity rather than a research project of its own.

The five-stage pipeline of Lean 4, from source text to native binary Five stacked stages. First, the parser, which is itself user-extensible, turns source text into Syntax trees. Second, the elaborator expands macros and resolves implicit arguments, overloading, typeclass synthesis, and universe inference, turning those Syntax trees into fully explicit terms. Third, highlighted as the only trusted stage: the Calculus of Inductive Constructions kernel, a small trusted computing base that type-checks the fully explicit term. Fourth, the compiler lowers accepted definitions to an explicitly-typed intermediate representation, applying closure conversion, lambda-lifting, inlining, specialization, dead-code elimination, and Perceus reference-counting for memory management. Fifth, that IR is emitted as C and compiled to a native binary. A caption notes that only the third stage, the kernel, is part of the trusted computing base — the other four can all get it wrong without producing an unsound proof, because the kernel is the last, mandatory check. The pipeline of Lean 4, source text to native binary Parser User-extensible grammar → Syntax trees Elaborator Macro expansion, typeclass synthesis, implicit args → fully explicit terms only explicit terms reach the kernel Calculus of Inductive Constructions Kernel — the only trusted stage Compiler IR Closure conversion, inlining, dead-code elim, Perceus reference counting C Backend Emitted as C, compiled to a native binary Four untrusted stages feed the kernel; only its type-check has to be right for a proof to be sound.
// Figure 7. Lean 4's real pipeline — parser, elaborator, kernel, compiler IR, C backend — and of those five stages, only the kernel's type-check is part of the trusted computing base.

Stack those three engineering bets up against the field it's displacing and the gap is concrete, not just rhetorical:

ToolLanguage unityExecution speedMetaprogramming
CoqSplit (3 DSLs: Gallina, Ltac, OCaml)Moderate (OCaml)Complex (Ltac2)
Isabelle/HOLSplit (SML / Isar)Moderate (ML)Eisbach / SML
DafnySingleHigh (C# / C++)Limited
Lean 4Unified (native)High (C compiler)First-class macros
// Figure 8. Lean 4 against the legacy interactive provers it's displacing for this kind of work.

Safety Proofs

What a Lean 4 safety proof actually looks like, stripped to its skeleton, is a function signature whose body is the proof — this snippet is close to how it was originally written, sorry included, not rewritten for this post:

safety.lean
theorem consensus_safety
    (n f : Nat)
    (h_byz : f < n / 3)
    (trace : ExecutionTrace n)
    (h_valid : ValidTrace trace) :
    NoDoubleSign trace := by
  -- proof steps constructed via the Lean 4 tactic engine
  sorry

Everything after by is tactic script, the part an engineer has to fill in (or, increasingly, an AI tactic generator; more on that below). The sorry above is the honest state of an unfinished proof; it compiles, and it proves nothing. Consensus protocols get formalized as inductive operational semantics, messages, per-node state, and a global transition relation, which is what makes properties like quorum intersection statable and provable in the first place. This scaffold, again, is close to how it was originally written:

consensus_step.lean
-- inductive definition of consensus network messages
inductive Message (V : Type) where
  | proposal (round : Nat) (value : V) (sig : Signature)
  | vote     (round : Nat) (blockHash : Hash) (nodeId : Nat) (sig : Signature)
  | commit   (round : Nat) (blockHash : Hash) (sig : Signature)

-- local node state representation
structure NodeState (V : Type) where
  nodeId        : Nat
  currentRound  : Nat
  lockedValue   : Option V
  validValue    : Option V
  votesReceived : List (Message V)

-- global network transition
inductive Step (V : Type) : GlobalState V → GlobalState V → Prop where
  | receiveVote (s : GlobalState V) (m : Message V) :
      ValidMessage s m → Step V s (ApplyMessage s m)
  | timeoutRound (s : GlobalState V) (nodeId : Nat) :
      Step V s (AdvanceRound s nodeId)

Formalizing in Lean

Unlike the sorry-containing skeleton above, this one actually closes, written for this post, specifically for this comparison — not lifted from anywhere — and it's been through a real toolchain: the file below type-checks against Lean 4.32.2 and Mathlib as of this writing, with no sorry and no admitted step.

quorum_intersection.lean
import Mathlib

variable (Node : Type) [DecidableEq Node]

-- Pigeonhole: two quorums this large can't both dodge every honest node.
theorem quorum_intersection_has_honest
    (n f : Nat) (h_byz : 3 * f < n)
    (faulty q₁ q₂ : Finset Node) (h_faulty : faulty.card = f)
    (h_q₁ : 2 * n + 13 * q₁.card)
    (h_q₂ : 2 * n + 13 * q₂.card)
    (h_bound : (q₁ ∪ q₂).card ≤ n) :
    ∃ node ∈ q₁ ∩ q₂, node ∉ faulty := by
  by_contra h_none
  push_neg at h_none
  have h_sub : q₁ ∩ q₂ ⊆ faulty := h_none
  have h_inter_le : (q₁ ∩ q₂).card ≤ f := h_faulty ◂ Finset.card_le_card h_sub
  have h_pigeonhole : q₁.card + q₂.card = (q₁ ∪ q₂).card + (q₁ ∩ q₂).card :=
    (Finset.card_union_add_card_inter q₁ q₂).symm
  -- h_q₁, h_q₂, h_bound, h_pigeonhole, h_inter_le together contradict h_byz
  omega

Every element of that signature is doing real work:

Feed every hypothesis in the signature into omega — Lean's decision procedure for linear arithmetic over integers — and, with n and f ranging freely, the pigeonhole contradiction falls out mechanically. No sorry, no hand-waving in the tactic script: this is what a "zero-sorry" proof of a nontrivial lemma is supposed to look like, and this one has actually been through the kernel.

The Zero-Sorry Standard

Once the proof compiles, a second discipline matters as much as the proof itself: the zero-sorry standard. In Lean 4, sorry is a keyword that lets you write a proof skeleton and defer a step — it type-checks, but it's an admitted gap, not a proof. A "verified" codebase that still contains sorry statements, unvetted custom axioms, or unaudited dynamic casts hasn't actually proven what it claims to. This part of the argument is exactly right, and it maps cleanly onto dependent type theory's Curry-Howard correspondence between propositions and types, proofs and programs:

ConceptProgramming interpretationLogical / mathematical interpretation
TypeData structure / interfaceProposition / mathematical statement
Term (value)Executable expressionMachine-checked proof
Dependent pair (Σ-type)Structure with constraintsProof of existence with properties
Dependent function (Π-type)Generic / universal functionUniversal quantification (∀x, P(x))
// Figure 9. Dependent type theory, two ways — the Curry-Howard correspondence underneath every Lean 4 proof.

05 Scaling up Lean Proofs

The quorum lemma above is written for this post — but it is not a toy. The same theorem, in almost the same words, sits at the heart of real Lean 4 formalizations of full consensus protocols.

Mysticeti Consensus

George Danezis, one of Mysticeti's designers, maintains lean-dag, a machine-checked model of the uncertified DAG consensus family Mysticeti belongs to. It is hand-written, like Qiu et al.'s Rocq model, not derived from Sui's actual Rust the way Aeneas and Charon derive Lean from Rust. The development runs to roughly 25,000 lines of Lean 4 over Mathlib: every principal result depends on exactly Lean's three standard axioms, and every definition gets exercised on concrete models by decide before anything is proved from it. Its accompanying report, "Eventual DAG Synchrony," is quite explicit about what is proved versus what is assumed. Its quorum-intersection theorem is the direct analogue of the one above: two quorums of at least |Validators| − f members share a block. Its liveness account is the round-by-round no-stall guarantee:

theorem exists_common_mem_of_quorums {s t : Finset BlockId} {n : ℕ}
    (hs : ∀ q ∈ s, q ∈ U.ids ∧ (U.block q).round = n)
    (ht : ∀ q ∈ t, q ∈ U.ids ∧ (U.block q).round = n)
    (hsq : (Fintype.card Validator - F.f) ≤ (creatorsOf U.block s).card)
    (htq : (Fintype.card Validator - F.f) ≤ (creatorsOf U.block t).card) :
    ∃ q, q ∈ s ∧ q ∈ t

theorem populatedOn (vp : ViewPace U T N)
    (hcard : (Fintype.card Validator - F.f) ≤ T.card) :
    ∀ n ≤ N, PopulatedOn U T n

The quorum arithmetic is the same n > 3f bound, written as quorums of at least |Validators| − f members, and the proof strategy is the same: peel off the faulty set, find a common honest creator, let omega finish. The report notes that quorum intersection is used exactly once, in the base case of the persistence argument — above that layer, height is carried by transitivity alone. The specification is also careful to count quorums on creators rather than on raw references: "a quorum of blocks from the previous round" means nf distinct validators, the form every downstream proof actually wants.

What lean-dag models is Mysticeti-C itself, the first DAG-based Byzantine consensus to reach the three-message-round latency lower bound. It gets there by forgoing explicit certification: a block costs one broadcast, and a block two rounds above a leader acts as a certificate precisely when its references contain a quorum of blocks referencing that leader. Certification, in other words, is a pattern read out of the graph, not an artifact the protocol constructs, and the project's related-work survey maps the whole uncertified-DAG family, Hashgraph through Bluestreak, against exactly that distinction.

LeanDag/Mysticeti.lean is where the formalization cashes it out, targeting the commit rule itself: direct commit, direct skip, and the indirect rule that resolves undecided slots from later certificates. The paper's headline numbers (0.5s WAN commit latency at over 200,000 TPS, a 4× reduction on Sui) are measurements, not guarantees — the Lean proofs certify safety and liveness, not throughput.

The report is explicit about the shape of that liveness argument, and it is the same boundary this post keeps circling: safety assumes nothing whatsoever about the network — not even eventual delivery — and no liveness theorem mentions time.

The structural condition everything hangs on, eventual DAG synchrony, says only that beyond some round every correct block references every correct block of the round below:

lean-dag · LeanDag/Liveness.lean
def SynchronisedOn (U : BlockUniverse Validator BlockId Payload)
    (T : Finset Validator) (R : ℕ) : Prop :=
  ∀ n, R ≤ n → ∀ b ∈ U.ids, (U.block b).round = n + 1 →
    (U.block b).creator ∈ T →
    ∀ a ∈ U.ids, (U.block a).round = n →
      (U.block a).creator ∈ T → a ∈ (U.block b).refs

The report derives that condition rather than postulating it, from a single clause of view convergence (after stabilization, whatever one correct validator holds reaches every correct validator within Δ) plus build rules a protocol designer controls — derived, not assumed, which is the standard this post has been holding every case study to.

Tendermint Safety, from Apalache to Lean 4

Before getting to leanda itself, it's worth walking through what actually produced its Tendermint entry, because the process is a sharper illustration of AI-orchestrated proof search than the abstract loop diagram above. Igor Konnov, co-creator of the Apalache model checker, published a detailed writeup in July 2026 of getting from a broken inductive invariant to a machine-checked Lean 4 agreement proof for single-height Tendermint, and it's dated in both directions: the starting point was a real bug, and the finish line is explicitly bounded.

The starting point: Apalache kept reporting counterexamples to TypedIndInv, an invariant Konnov expected to be inductive and wasn't. Rather than working the counterexamples by hand, he fed them to an AI coding assistant, which converged on the actual fix in roughly two calendar days: tightening the quorum threshold used in several clauses from T+1 to 2T+1, and excluding nil values from certain quantifications the original invariant had left too permissive. The repaired property, in Konnov's own words:

“if 2T + 1 processes precommit on the same valid value in a round, then in future rounds there are less than 2T + 1 prevotes for another value.”

With the invariant actually inductive, the same AI-assisted loop bootstrapped and completed a full TLAPS proof of inductiveness in five more calendar days: roughly 4.6 KLOC of proof script against roughly 400 lines of invariant definitions, for a specification pinned to the field's usual optimal-fault-tolerance assumption, N = 3T+1 — Konnov notes explicitly that N > 3T+1 breaks agreement outright, since a 2T+1 quorum then falls under 2/3 of N.

From there, Codex carried the completed TLAPS proof over into Lean 4 in 2.5 hours, producing roughly 7 KLOC of Lean, closing with three theorems: InitInd (initial states satisfy the invariant), Inductive (the invariant is preserved by every protocol step, unbounded, not model-checked to some depth), and AgreementThm (the invariant implies agreement).

That's a real week, not a hand-wave: invariant repair, a TLAPS proof, and a same-day Lean port, with the AI tooling doing the bulk of the mechanical labor and a human steering which fix to try and reviewing what came out. It's also exactly the kind of case this post has been asking for throughout — a named author, a dated writeup, artifacts a reader can actually go check.

It's also, by Konnov's own account, deliberately narrow in exactly the way Part 1's framework flags: the specification covers single-height Tendermint only, with no timeouts modeled and no liveness property proved — agreement, not the full protocol. Multiple heights and the timeout-driven round-advancement logic real Tendermint agreement depends on operationally are named as future work, not a current result. Read against the four failure modes from Part 1, this one isn't wrong and it isn't unshipped fiction — it's partial, honestly labeled as such by the person who built it, which is close to the best-case version of that failure mode a reader could ask for.

Living with the Proof

That derivation closes a loop with the Mysticeti bug from Part 1: the model's P8 clause excludes round-jumping outright — the behavior the Qiu et al. counterexample depends on — so lean-dag is not exposed to that flaw, and it can say why.

The repo's provenance note supplies exactly the disclosure this post has been asking for: the code and prose were co-written with heavy LLM assistance, the kernel machine-checks every theorem against its stated form, and whether the definitions capture their intended meaning has only human-plus-LLM review behind it. "Read critically," it says — and the repo's history agrees: 305 commits by one author in eleven days (August 3–13, 2026), a hundred files, ~25,000 lines of Lean 4, 238 of them co-authored by Claude and 213 with a Claude Code session link attached.

The kernel checked that every theorem holds exactly as written; whether those theorems were the right ones to write was still a call the humans, and the LLM working alongside them, had to make on their own.

This is what consensus formalization looks like when it targets a deployed protocol rather than a blog post. The same Konnov keeps a parallel repo, leanda, "Lean" plus "distributed algorithms," whose machine-checked entries include agreement for single-shot Tendermint: two commits, roughly 8,600 lines of Lean in total, the agreement theorem itself just 137 of them. Per the repo's own notes it was generated from a Wunderspec model and follows the TLAPS proof described above rather than being formalized from scratch. The lemma above sits comfortably between the two.

With lean-dag it shares the very theorem, two quorums must intersect in a common block, and the proof style, right down to the omega that finishes the arithmetic. With leanda it shares the scale: one kernel-checked statement about one classic property, written to make a point rather than to cover a protocol. It is the same kind of mathematics at a fraction of the size. That's the point: the style is identical whether the target is a single lemma or a deployed protocol; only the labor and the stakes scale up.

AI-Aided Proof Dispatch

The most forward-looking claim on offer is that the historical bottleneck on formal verification, PhD-level formal-methods labor measured in engineer-years per protocol, is dissolving under a neurosymbolic pairing of large language models and Lean 4's kernel.

The architecture is elegant, and it rests on a real asymmetry: LLMs are good at pattern-matching plausible next steps but hallucinate; Lean 4's kernel is a deterministic, from-first-principles type checker that cannot be talked into accepting an invalid proof step. Wire an LLM up as a tactic generator, let the kernel referee every proposed tactic, and you get a search loop where the model's creativity is unconstrained but its output is not — a false step gets rejected instantly, with structural feedback, and only a kernel-verified proof term ever counts as done.

The neurosymbolic verification loop A Lean 4 proof goal, the target invariant or safety theorem, flows through tactical context extraction into LeanDojo and ReProver, which extract the environment state vector. Tactic prediction and generation then passes to a neural LLM prover, a transformer model trained on Lean Mathlib and protocol specs. That model proposes a tactic to the Lean 4 kernel for execution. On success, the proof term is inhabited and the loop terminates. On failure, the kernel's structural error feedback loops back to the neural LLM prover for another attempt, so only a kernel-verified proof ever counts as done. The neurosymbolic verification loop Lean 4 Proof Goal / State Target invariant: safety theorem tactical context extraction LeanDojo / ReProver Environment state-vector extraction tactic prediction & generation Neural LLM Prover Transformer trained on Lean Mathlib & specs formal verification loop Lean 4 Kernel Execution [Success] [Failure] Proof Term Inhabited Kernel-verified, loop ends Feedback Loop & Retry Structural error, back to prover
// Figure 10. Why the loop can't hallucinate a false proof: the kernel is a deterministic referee, and only a kernel-accepted proof term ever exits the loop.

LeanDojo and its baseline prover ReProver are real, publicly documented infrastructure for exactly this loop: they extract program-state trees and lemma databases from Lean source and expose them as a retrieval-augmented interface an AI agent can query — a legitimate and citable piece of the pipeline being described. It has quietly become the de facto foundation for the current generation of LLM provers, too: DeepSeek's Prover series, InternLM's step-prover, and ByteDance's BFS-Prover all build on it (BFS-Prover's model card cites "Mathlib, via LeanDojo" as its training-data source), and the MiniF2F and ProofNet benchmarks they all report against are LeanDojo's own Lean 4 datasets.

That extends into a Federated Formal Verification architecture: an AI orchestrator that routes sub-problems to whichever backend fits — arithmetic and bit-vector goals to SMT solvers, structural inductions to Lean 4, legacy proofs to Coq or Isabelle via cross-backend citation — and merges the results into one certificate.

The Isabelle leg of that picture isn't hypothetical: IsabeLLM (Jones & Knottenbelt, January 2026) wires DeepSeek R1 into Isabelle and uses it to verify Bitcoin's Proof-of-Work consensus, generating correct proofs for every nontrivial lemma in the verification — an independently checkable instance of exactly the legacy-prover-plus-LLM pattern described above.

Konnov's own account of formalizing Ben-Or consensus, published a month before the Tendermint writeup above, is a rawer version of the same pattern — the failure modes left on the page rather than smoothed over. Two AI systems, labeled C1 and C2 in the writeup, were handed a pre-existing inductive invariant in TLA+ rather than asked to discover one from scratch, and from that starting point produced full, independent proofs in both Lean 4 (roughly 6.6 KLOC) and TLAPS (roughly 6.2 KLOC) in about four to five calendar days.

Konnov is explicit about what that timing does and doesn't measure: “I suspect that it would be much harder for them to come up with a good inductive invariant” on their own.

The failure modes are the more interesting part. C1 tried to shortcut one proof step by silently assuming the inductiveness of several other actions it hadn't yet proved — a circularity Konnov caught only by reading the tactic script, not by trusting a green checkmark.

C2, generalizing from a fixed small configuration to arbitrary parameters, ran straight into a genuine bug in Konnov's own prior work: Lemma 8 failed to hold once T and N grew, and the fix was tightening a non-strict bound to a strict one, TN/3 to T < N/3. Rather than re-deriving the fix by hand, C2 called Apalache directly to generate a concrete counterexample at the failing bound — an AI tool reaching for a different tool's strength instead of forcing everything through one deductive channel.

Konnov's own closing caveat belongs here verbatim: “I did not read the detailed proofs, only ran Lean on them, so there is still a chance that these tools cheated in the proofs, by using known soundness issues” — the zero-sorry standard from earlier in this post, held up against exactly the kind of proof it exists to catch.

Federated formal verification across three backends An AI proof orchestrator splits a verification goal across three specialized backends: an SMT solver, Z3 or CVC5, handling arithmetic and bit-vector operations; the Lean 4 kernel, handling core inductive invariants; and Coq or Isabelle, handling legacy modules. All three backends converge into a single unified cross-backend proof certificate. Federated formal verification AI Proof Orchestrator SMT Solver (Z3, CVC5) Arithmetic / bit-vector Lean 4 Kernel Core inductive invariants Coq / Isabelle Legacy modules Unified Cross-Backend Proof Certificate
// Figure 11. Splitting a verification goal across whichever backend is actually good at each sub-obligation, then merging the results into one certificate.

The Uncited Productivity Numbers

The clearest real-world data point for "near-zero human labor," meanwhile, is missing from all of this entirely. Don Syme, creator of F#, published Lean Squad in April 2026: an agentic pipeline that produced over 1,200 machine-checked theorems across three codebases and caught a genuine bug in a drone autopilot along the way. It's a real, checkable result in exactly the direction gestured at by the uncited productivity figures below. Nobody cites it.

// a real before/after, for once Konnov's Ben-Or numbers, discussed above, are the rare case where a before-and-after is both halves measured, by the same person, on the same problem. Proving Ben-Or's safety and inductiveness by hand previously took him roughly two days writing lemmas plus nine days waiting on Apalache to grind through model-checking. The AI-assisted rerun, starting from that same pre-supplied invariant, closed a Lean 4 and a TLAPS proof in about four to five days total — a real, dated, attributable acceleration, and still nowhere near the "near-zero human labor" framing the uncited claims below reach for.

All of this gets framed as a documented fifteen-month shift, mid-2025 to mid-2026, laid out as six paired claims:

Metric / paradigmMid-2025 baselineMid-2026 expectation
Verification rolePost-hoc academic auditContinuous CI/CD gate
Codebase coverageAbstract protocol modelsDirect Rust extraction
Proof generation effort100% manual human labor70%+ AI auto-generated
Proof chain completenessPartial (“sorry” placeholders)Zero-Sorry standard
Tooling integrationIsolated prover IDEsUnified Lean 4 engine
Protocol audit benchmarkManual code inspectionMachine-checked proofs
// Figure 12. The claimed mid-2025-to-mid-2026 before/after — presented with no citation attached to any right-hand cell.

The load-bearing empirical claims in that table, that AI-orchestrated provers now generate "over 70%" of routine proof tactics and that verification teams have shifted from 100% manual tactic-writing to mostly writing specifications, are exactly the kind of number that should come with a citation attached, and none of them do. I checked. Every row on the right is a plausible direction for the field to move in; none of them is a measurement. The gap no refinement proof closes would remain even if every one of them were true.

06 From Proofs to Code

Here's the gap that made model checking and even the classic interactive-proving era less useful than they sound: proving an abstract TLA+ or Lean model correct says nothing about the Rust, Go, or C++ binary a validator node actually runs.

Implementation Divergence

Production consensus engines — CometBFT-rs, Reth, Solana Agave, ChonkyBFT — are systems code, and systems code has its own failure modes a protocol sketch never sees: integer overflow, use-after-move, async-runtime deadlocks under Tokio, deserialization panics on malformed input. A model can be flawless in TLA+ while its Rust implementation ships a bug the model never had a chance to catch.

This often gets called implementation divergence, and it's the correct name for a real problem.

That gap isn't evenly distributed across a small codebase, either.

The Size of the Gap

Real consensus modules run tens of thousands of lines, not a few hundred, and every one of those lines is another place implementation and spec can quietly part ways:

SystemConsensus moduleLanguageLines of code
Aptos (AptosBFT)consensus/Rust63,156
Sui (Mysticeti DAG BFT)consensus/core/Rust30,763
Algorandagreement/Go19,926
EPaxos (reference impl.)whole repoGo9,032
CometBFTconsensus/Go5,943
// Figure 13. Consensus-module size for five real systems named in this post, counted directly from each project's own repository (implementation only, test files excluded) as of this writing. Each parenthetical names the system's consensus algorithm — Sui runs Mysticeti, the DAG-based BFT protocol whose proof story appears earlier in this post, and Aptos runs its HotStuff-descended AptosBFT. The illustrative "50,000 lines of Rust" quoted above undersells the largest of them by 26%.

Algorand is the one system in that table with its own formal pedigree, and it's older than the fifteen months this post has been checking claims against: Alturki et al. built a machine-checked Coq model of its consensus protocol back in 2019. Following the same pattern as everywhere else in this post, that model was never tied to the 19,926-line Go implementation actually running above.

None of that code is exactly "padding."

A cropped page from the HotStuff paper (Yin, Malkhi, Reiter, Golan Gueta, and Abraham) showing Algorithm 3, "Chained HotStuff protocol" — a complete pseudocode listing of about twenty lines, built on abstracted primitives like broadcast MSG(), send VOTEMSG() to LEADER(), and send MSG() to LEADER() that stand in for an entire real network transport stack.
// Figure 14. The entire Chained HotStuff protocol, as published — twenty-odd lines, because “send” and “broadcast” here are one-word stand-ins for a transport layer, not code. Yin et al., 2019, Algorithm 3.

The algorithm itself — the pseudocode in a HotStuff or Tendermint paper — fits comfortably in a few pages, because it treats an entire layer of production concerns as a single atomic primitive: "send message to node j" hides a transport stack built for an authenticated, adversarial network; "write to stable storage" hides a write-ahead log with fsync semantics, crash recovery, and corruption checks; "verify signature" hides quorum-certificate construction, BLS aggregation, and equivocation detection. Each of those is one line in the proof and thousands of lines in the codebase.

The bigger gap is the failure paths. Papers spend a page on the common case and a paragraph on recovery — leader election, view-change timeouts, reconciling state after a network partition heals.

That asymmetry shows up directly in the bug record: EPaxos's own authors never got around to formalizing the recovery path, and that's exactly where the safety violation described in Part 1 lived. Add validator-set changes the base algorithm rarely specifies in full, the mempool and state-sync plumbing a consensus module has to interface with, and the input hardening a Byzantine network demands, and a few pages of algorithm becomes tens of thousands of lines of Rust or Go without a single wasted line.

From Rust to Lean: Aeneas and Charon

The proposed fix for that divergence problem is a transpilation pipeline built on two real, publicly available tools: Charon, an intermediate compiler frontend that hooks into rustc, resolves borrow-checker lifetimes, and lowers Rust's MIR into a clean intermediate format (LLBC — Low-Level Borrow Calculus); and Aeneas, which takes LLBC and translates Rust's imperative, mutable-reference style into pure functional Lean 4 code using what's called monadic state-passing: A Rust function that mutates &mut self and returns a Result becomes a pure Lean 4 function that takes the old state and returns a new one:

The Rust-to-Lean verification pipeline Four stages. Production Rust codebase, containing the consensus engine, structs, and mutators, is translated via Aeneas and Charon into a pure functional Lean 4 AST, a monadic pure-functional formal representation. A refinement proof engine connects that to a mathematical protocol specification, the high-level invariants written in Lean 4. Machine-checked verification then produces a zero-sorry proof certificate, a mathematical proof of equivalence between the extracted implementation and the specification. The Rust-to-Lean verification pipeline Production Rust Codebase Consensus engine, structs, mutators via Aeneas / Charon translation Pure Functional Lean 4 AST Monadic pure-functional formal representation refinement proof engine Mathematical Protocol Specification High-level invariants, hand-written in Lean 4 machine-checked verification Zero-Sorry Proof Certificate Mathematical proof of equivalence, implementation ↔ spec
// Figure 15. How a production Rust binary gets tied to a hand-written Lean 4 spec — and where the "implementation divergence" problem actually gets closed.

Once the extraction exists, the actual proof obligation is a refinement proof: show that every transition the extracted, low-level Rust code takes matches a transition the high-level, hand-written protocol spec would take, under some relation R connecting implementation states to spec states.

Below is the textbook shape of a refinement diagram — a commuting square, not a linear pipeline — and it's worth drawing that way, because the shape is the argument:

The refinement mapping as a commutative square A commuting square split by a horizontal dashed line marking the abstraction boundary. Above the boundary, the top left box is extracted Rust state, S sub impl, with an arrow labeled Step impl leading right to the top right box, extracted Rust state, S prime sub impl. Below the boundary, the bottom left box is abstract protocol state, S sub spec, with an arrow labeled Step spec leading right to the bottom right box, abstract protocol state, S prime sub spec. Vertical arrows on both the left and right sides, each labeled refinement relation R, are the only elements crossing the boundary, connecting the top row down to the bottom row. The square commutes: following Step impl then the right-hand relation equals following the left-hand relation then Step spec. Refinement mapping (a commuting square) Extracted Rust State (Simpl) Extracted Rust State (S′impl) Stepimpl Abstract Protocol State (Sspec) Abstract Protocol State (S′spec) Stepspec abstraction boundary Refines (R) Refines (R) Square commutes ⇒ every safety property proven on Sspec transfers to Simpl.
// Figure 16. A refinement proof is a commuting square, not a straight line — and what it certifies is agreement between implementation and spec, not correctness of the spec itself (more on that earlier).

If that square commutes for every reachable state, any safety property already proven about the abstract spec transfers down to the actual binary a validator runs, for free.

This is a genuine advance over the TLA+-only era, and the tools behind it are real: Aeneas and Charon are real projects with real papers behind them, built specifically to close the implementation-divergence gap.

One of the areas to push back on is how far "refinement proof" actually reaches: refinement only guarantees the implementation matches the spec — and only as faithfully as the translation that connects them, since Charon and Aeneas sit inside the pipeline's trusted computing base, the same role the parser and elaborator play in Lean's own pipeline: no kernel checks them, so a bug in the extractor puts the divergence right back between the Rust and the model the proof is actually about. It says nothing about whether the spec was the right thing to prove in the first place.

// the extractors are untrusted, too The trackers make the risk concrete: Charon's issue list holds hundreds of open bug reports, several in the silent-divergence class — a dyn supertrait call that reads the wrong vtable entry, constant evaluation that loses padding bytes — where the extracted model compiles but differs from the Rust.

From Rust to Proof, in Man-Hours

The 2022 Aeneas paper's own case study puts a real number on the labor question: proving a resizing hash table — insert, get, get_mut, remove, 201 lines of Rust without blanks or comments — functionally correct against a map specification took four person-days. Lean support was still listed as future work at the time, so this measures the pipeline's general shape rather than literally the Lean 4 case studies discussed elsewhere in this post, but it's the most concrete effort number in the tool's own literature.

The comparison points in that same paper matter more: a similar but simpler, non-resizing hash table took students three days to verify in VST, a Coq framework for C; the same kind of table took a week in CFML, working from higher-level OCaml; and a comparable map data structure took several weeks of full-time work in Low*, a C-targeting subset of F*.

None of those numbers are consensus-protocol scale, and none of them should be expected to scale linearly. Proof difficulty tracks control-flow and state-space complexity, not line count. A naïve extrapolation from four person-days per 201 lines to Aptos's 63,156-line consensus module, roughly 300 times the size, lands around five person-years. That happens to sit close to the real, independently reported effort behind CompCert's much larger verified-compiler proof, six person-years for 100,000 lines of Coq, and in the same range as Verdi's 50,000-line mechanized Raft proof from earlier.

Those tools' own repos back the estimate up, and reveal how concentrated the labor is.

Dozens of nominal contributors show up in each history; the actual person-years are concentrated in a handful of names, most of whom also hold the paper's byline.

Person-years, not person-days, is the order of magnitude to keep in mind whenever a case study claims a production consensus engine got verified without saying how long it took.

Elusive End-to-End Guarantees

The second half is the hard one, and exactly one effort in this post has earned it. Qiu et al.'s Mysticeti verification, the "right proof, unshipped fix" story from earlier, proved the protocol's safety and liveness in the Rocq proof assistant, then did the part that makes a proof end-to-end: audited Sui's actual deployed source at 2f52a72, constructed an explicit infinite trace in which, under the implementation's round-jumping behavior, no leader is ever committed, and mechanically verified a fix that restores liveness.

The proof was checked against the implementation, not against a hand-written model of it: the artifact's sui_testcase.patch, applied over that very commit, adds a runnable simulation test at consensus/simtests/src/tests/my_simtests.rs that instantiates Sui's real Core component, delivers blocks in a carefully arranged order, and observes it jump straight to round 4 without creating a vertex in rounds 2 or 3. That's the vulnerable behavior the trace above is built on.

The paper's abstract describes the manual layer: the authors "audited the current implementation of Mysticeti in the Sui blockchain and found it is susceptible to the described liveness bug." What it was not is a proof extracted from that source: the Rocq model is hand-written, not derived from Sui's Rust the way Aeneas and Charon derive Lean from Rust. Hence two halves, and an empty end-to-end cell.

No consensus system named in this post combines both halves of "end-to-end": a proof extracted straight from the real, unmodified production source, checked against an implementation actually running in the wild. Aeneas and Charon build the first half. Nobody has both, yet.

07 Five Recent Case Studies

Underneath the claims, the underlying trend is real: formal verification has been getting popular with blockchain implementers, and the breadth of the field is now hard to miss. Leonardo Alt's community-maintained Ethereum Formal Verification Overview tracks dozens of efforts, from ConsenSys's EVM-Dafny semantics and its Dafny formalization of the Eth2 beacon-chain spec to evm-sail's EVM semantics in the ISA language behind the official RISC-V model and powdr-labs' verified Yul-to-EVM compiler, the latter in Lean 4, the same stack as this post's own quorum proof.

The five case studies below are worth taking seriously precisely because of that traction. The question was never whether the tooling has momentum, but whether the specific claims made about it survive scrutiny. Mysticeti is deliberately absent from that list. The original claim never cited it, so there is nothing here to fact-check; the one machine-checked proof in this post that engaged deployed code gets its own treatment earlier, in the unshipped-fix story and the end-to-end section.

Five named deployments get offered as evidence that formal verification has already moved from research exercise to production practice.

Read as a list, these five case studies do real work for the larger argument: they make formal verification sound like an established practice with a track record, not a speculative research direction.

One at a time:

  1. Veil is described as a multi-modal verification framework layering model checking, SMT solving, and Lean 4 interactive proof into one pipeline. It's real, and its lead author, George Pîrlea, is correctly named, though the venue is CAV 2025 at the National University of Singapore rather than the "Lean FRO" attribution of the original claim, a minor misattribution rather than a fabrication.

  2. Kaizen, attributed to Kalim et al., is the correctness-by-construction blockchain from FMCAD 2019. The consensus protocol at its core, plus a cryptocurrency, KznCoin, built on top of it, gets both its safety and liveness properties proved by a two-stage refinement: an abstract protocol verified in the Coq interactive theorem prover and refined through Dafny into imperative code, in the style of IronFleet, with the result benchmarked against stock Bitcoin. That makes it a genuine verification-from-inception case rather than a retrofit, though the citation matters: it's from FMCAD 2019, not 2021 as cited, which puts it six years before the "fifteen months of acceleration" window claimed above.

  3. ChonkyBFT is ZKsync's committee-based BFT consensus engine for its validator set, built for single-slot finality and n ≥ 5f+1 fault tolerance; the paper proves three theorems for it by hand, in pen-and-paper lemmas and corollaries: Agreement, Validity, and Progress (liveness after Global Stabilization Time).

    One mismatch stands out: the stack attributed to ChonkyBFT is "Lean 4 / Aeneas," but the real paper's own Section 5 formal-verification work is a separate, bounded layer on top of those hand proofs — the protocol specified in Quint, a TLA+-family language, and checked with the Apalache model checker restricted to six replicas and up to three views, not the general theorems above. The word "Lean" appears exactly once in the paper, in the Conclusions, as a suggestion for future work alongside Isabelle and Coq, not as anything actually used here. ChonkyBFT is real, deployed on ZKsync Era mainnet, and formally specified; it just isn't a Lean 4 case study. The companion technical post from the same authors covers that Quint/Apalache work in more depth.

  4. Multi-Chain / "Trinity Protocol" is cited for a specific, precise-sounding number: 184 machine-checked theorems, zero sorry placeholders, across Arbitrum, Solana, and TON. That figure is real, in the narrow sense that a post stating it does exist. What the citation elides is that its author, "Chronos Vault Team," is a single crypto-vault vendor writing about its own product, on a blog whose neighboring posts are titled "Trust Math, Not Humans" and "100% Formally Verified — Production Ready!" That's vendor marketing copy, not an independently audited milestone, whatever the theorem count.

  5. The Lean Ethereum initiative is described as a redesign of Ethereum's post-Merge Gasper protocol (Casper FFG plus LMD-GHOST) in Lean 4, covering SSZ serialization safety, post-quantum signature schemes (leanSig, leanMultisig), and fork-choice invariants tied to the 1/3-stake slashing margin. The OAK Research article cited for this is real. Ethereum's own formal-verification track record predates it by nearly a decade, and has nothing to do with Lean 4: Hildenbrandt et al.'s KEVM (CSF 2018) gave the EVM a complete K-Framework semantics, validated against the official test suite of more than 40,000 EVM programs, and Runtime Verification has used it commercially ever since to check real deployed contracts against properties like ERC-20 compliance. That lineage, KEVM plus the EVM-Dafny and Eth2-Dafny work named above, is the actual multi-year history of Ethereum getting formally verified; none of it is what the "Lean Ethereum" citation is pointing to.

    The leanEthereum GitHub org itself is real, and worth a look on its own terms. It's the coordination hub for the roadmap's actual client implementations, zeam, ream, qlean, lantern, among others, plus supporting repos like leanSpec, leanVM, and leanMetrics. Multiple independent teams building multiple independent clients against one shared spec, before the protocol has even shipped, is the client-diversity pattern this post keeps returning to, playing out a second time in miniature. It already has its own early shadow-network fuzzing harness, lean-shadow-fuzzer, running randomized simulation sweeps across those clients and charting block-propagation latency and finality.

    The Lean-4 connection gap is even starting to close for real: NyxFoundation's leanSpec-lean4, begun in April 2026, is an actual Lean 4 formalization of the leanSpec consensus specification, cataloging and proving propositions extracted from its SSZ, fork, validator, and networking layers.

// the name collision

"Lean Ethereum" is Vitalik Buterin's July 2026 name for a multi-year protocol-simplification roadmap — native recursive STARK verification, quantum resistance, a reduced set of cryptographic primitives — named "lean" for minimalism, the same way "lean manufacturing" means minimal waste.

It has no inherent connection to the Lean 4 theorem prover the rest of this post is about. The two "Lean"s are homonyms, not the same project, and this case study is built on treating them as one. Real Lean-4-on-Ethereum work does exist, just under a different name: Leonardo Alt's community-maintained Ethereum Formal Verification Overview lists SizzLean, an actual Lean 4 implementation of SSZ, alongside Nethermind's EVMYulLean and Yul-Lean for the EVM and Yul IR — none of it branded "Lean Ethereum," none of it mentioning leanSig or leanMultisig.

Furthermore, nothing in this post's case studies involves Lean 4 code actually running in production:

08 Conclusions

Two separate questions were in play throughout: is the underlying technology real, and is the specific case built on top of it trustworthy. Those turned out to have different answers — and production consensus, running on Ethereum and Solana right now, turned out to be defended by neither Lean 4 proofs nor the citations presented here, but by client diversity and cross-client testing instead.

Strip out the parts that don't survive scrutiny and there's still a real, well-supported argument left standing: Lean 4 is a genuine engineering advance over Coq and Isabelle/HOL for this kind of work, Aeneas and Charon close a real and previously-unclosed gap between abstract protocol specs and the Rust binaries that actually run in production, and LeanDojo/ReProver-style retrieval-augmented tactic generation is a real, citable direction for lowering the labor cost of interactive proof. None of it needed the exaggeration it got.

The target state: correctness-by-construction A high-level protocol intent, written as an axiomatic Lean 4 specification, passes through a formally verified synthesis engine to produce formally proven executable code, a verified Rust or C binary. A continuous self-verification engine then maintains zero-panic, zero-reorg, mathematically immune consensus infrastructure. The target state: correctness-by-construction High-Level Protocol Intent Axiomatic Lean 4 specification formally verified synthesis engine Formally Proven Executable Code Verified Rust / C systems binary continuous self-verification engine Zero-Panic, Zero-Reorg, Mathematically Immune Consensus Infrastructure — the aspiration, not (yet) a shipped system
// Figure 17. The claimed end state. Worth noting what it is: a roadmap item, stated in the future tense, not one of the five case studies above.

That formally verified synthesis engine in Figure 17, the arrow running straight from spec to proven code, is exactly the gap that stays open: nobody in this post generates a production consensus implementation directly from a Lean 4 spec, only proves one after the fact. Closing it is real engineering work still ahead, not a rounding error. What's genuinely new is that AI-orchestrated tactic generation and proof search give that work tools the pre-LLM era simply didn't have.

None of this means formal verification is oversold as a category. Jepsen-style chaos testing has a well-documented ceiling, and machine-checked proof raises the floor above it. It means the correct response to "trust the math, not the humans" is the same standard blockchain consensus itself gets held to here: check the math, and check who's telling you it checks out.

References

Citations Checked Against Their Sources
Real Evidence the Citations Don't Mention
Real Tools and Infrastructure Named Above
Prior Case Studies the Citations Never Mention
On Client Diversity and Cross-Client Testing
On Testing, Verification, and Validation
On Consensus-Implementation Bugs
On EPaxos and Mysticeti: Manual Proof Wrong, Machine-Checked Proof Right