Why Rocq Is Better Than Lean for Program Verification

2026-08-01 · page · source ↗ · source summary

Joomy Korkut's detailed, code-backed argument for why Rocq (née Coq) remains a better fit than Lean for program verification — not math formalization, where Lean's momentum is real. The post makes its case across three axes: language-level support (coinductive types, nested inductives), program extraction (multiple backends vs. Lean's single runtime pipeline), and ecosystem depth (two decades of verification infrastructure that a weekend port can't replicate). The subtext is a question every tools person eventually faces: when does accumulated infrastructure outweigh the hype cycle?


Key quotes

"I am not trying to start a flame war here. If you are a more mature person than I am, feel free to mentally replace 'better' with 'a better fit for my work today' everywhere below."

The disclaimer that preempts the flame war the post is absolutely trying to start. Korkut knows exactly what he's doing — the original slide was provocatively titled — but the caveat is honest: this is a "fit for my work" argument, not a universal ranking. The distinction matters because his work (interaction trees, game trees, verified games extracted to C++) leans hard on features Lean doesn't have.

"Lean does not hand you a menu of alternate extraction backends, and the compilation pipeline it has offers no end-to-end correctness proof."

The most pointed critique of Lean's extraction story. Rocq offers OCaml, Haskell, Scheme, Rust, Elm, C++, Clight, and WebAssembly — plus a verified extraction pipeline. Lean gives you one runtime with impressive performance (lean-zip beats Rust's miniz_oxide!) but no verified pipeline and no readability. Korkut's framing: performance alone isn't the whole story; you also need to read the code, choose the target, or put it through a verified pipeline.

"With Lean, I have to give up one of these things or rebuild it on top of generic machinery. Rocq lets me declare codata, write a guarded producer, reason about it by observation, and extract direct lazy code."

The thesis of the coinduction section, backed by runnable counterexamples. Korkut tests QPFTypes — the closest Lean experiment to Rocq's CoInductive — against three ordinary Rocq patterns: parameterless types, mutual coinduction, and indexed families. All three fail. The Lean alternatives (Stream', Iter, Thunk, partial def) each solve one piece but lose either proof transparency, direct extraction, or the ability to model branching continuations (interaction trees). This is the section that will age fastest — Lean could fix any of these — but as of mid-2026, it's correct.

"You might skim that list and think, 'None of this is a big deal; I can vibe-port the piece I need to Lean over a weekend.' Maybe you can. But hold that thought for one more section."

The transition into the ecosystem argument. The list preceding this line — interaction trees, Iris, CFML, Perennial, VST, CompCert, Vellvm, Fiat Crypto, and a dozen more — represents accumulated person-centuries of verification engineering. Korkut's point isn't that any single item is irreplaceable; it's that the set is. Each one you port is a weekend you're not doing your actual work, and they keep accumulating while you port.

"'But the AI only knows the popular language' is an argument with a short shelf life, and it is not a reason for me to switch proof assistants."

A cleanly delivered rejoinder to the most common question Korkut gets. The 2024 argument — "AI writes better Lean because there's more training data" — made tactical sense when models were brittle. In 2026, models adapt to unfamiliar languages when given documentation. Rocq's 35-year corpus gives it a training-data advantage that compounds, and the argument's shelf life was always bounded by model capability.


Key themes


Critical analysis

The post is right about the facts, but the facts have a shelf life. Korkut is scrupulously fair: he links to Lean alternatives for every Rocq feature he discusses, acknowledges Iris-Lean's rapid development, and provides runnable counterexamples with pinned toolchain versions. This is not a hit piece. But it's a snapshot, and every snapshot is vulnerable to the next Lean release. The coinduction gap is real in July 2026; if Lean 4.33 adds kernel codata, the strongest section of the argument evaporates.

The ecosystem argument is the durable one, and it cuts both ways. Rocq's ecosystem advantage is real and measured in person-centuries. But ecosystems are path-dependent, not merit-based. The fact that CompCert is written in Rocq doesn't mean Rocq is better for writing verified compilers — it means INRIA picked Rocq in 2005 and nobody has been willing to fund a Lean rewrite. The ANSSI certification is similarly path-dependent: it certifies a toolchain, not a language. A Lean-based verified compiler could in principle qualify; it just hasn't been through the process. Korkut is right that this matters now, but wrong to present it as a permanent property of the languages.

The coinduction section is both the strongest and the most vulnerable. It's the strongest because it's the most concrete: runnable examples, pinned versions, checked failures. It's the most vulnerable because it's about a missing feature, and missing features get added. QPFTypes is explicitly a proof of concept; Lean FRO employs people working on this; the gap could close in a single release. The nested inductive gap is smaller and more likely to persist — both languages are conservative about what their kernels accept, and changing these checks is genuinely hard.

The AI section is the most interesting and least developed. Korkut dismisses the "AI prefers Lean" argument in two paragraphs, but he's right to dismiss it. The deeper question — which he doesn't explore — is whether AI changes the economics of the ecosystem argument itself. If AI can port a library from Rocq to Lean in a weekend, does the ecosystem advantage shrink? If AI can generate proofs in either language equally well, does the coinduction gap matter less because you can generate the workaround? The post's implicit answer is "no, because the qualified infrastructure doesn't port," but this is a claim that deserves more scrutiny.

What the post doesn't say is as important as what it does. Korkut never claims Rocq is a better language — only that it's a better fit for his work. The distinction matters because "his work" is unusually demanding: interaction trees, game trees, verified games extracted to C++ with Crane. Most program-verification users don't need coinductive types or multiple extraction backends. For them, Lean's mathlib, active community, and AI momentum might genuinely be more valuable than Rocq's ecosystem. The post is a defense of a specific research program, not a universal recommendation — and it's honest about that, if you read the caveats.

The regulatory acceptance section is a grenade thrown politely. ANSSI certification and CompCert's aircraft qualification aren't academic concerns — they're "your product can't ship without this" concerns. Korkut buries this at the end, almost as an afterthought, but for anyone building verified software in regulated industries, it's the whole argument. A tool that has passed regulatory review is a different category of thing from a tool that hasn't, and the gap isn't closed by better type theory.


Related pages


Sources: raw/why-rocq-is-better Last updated: 2026-08-01