Lean Now Ships with Verified Kernels
- ID: 8e2af0b3
- 原文链接: https://leodemoura.github.io/blog/2026-10-15-lean-now-ships-with-verified-kernels/
- 作者: Leonardo de Moura
- 日期: 2026-10-15
- 分类: coding
- 来源类型: article
- 标签: lean, formal-verification, ai-agents, kernel, security
- 质量评分: 4/5
- 抓取时间: 2026-10-18T15:42:42Z
中文导读
AI agent 已经能高效找出 Lean proof kernel 的漏洞(8 月 1 日、8 月 24 日两份 postmortem),Leonardo de Moura 给出 v4.35.0 的结构性防御:lake check 把开发导出后交给 leanchecker(去掉外围设施的官方内核)在沙箱里重验;新增 nanoda、lean4lean、con-leche、con-ron 四个独立内核,lake check --paranoid 全部重验一遍,外加硬化内存分配器构建的官方内核变体,把内存损坏变成受检中止而非静默错误。con-leche 是首个用 Lean 写成并证明一致的内核,由 Claude(Fable 与 Opus)在 Lean FRO Joachim Breitner 重度监督下实现:全 Mathlib 指令数为官方内核 0.69 倍、8 线程约 100 秒;再用 AI 翻译成 Rust 并以 Aeneas 证明精化得到 con-ron,双内核同验抵御编译器/运行时残留 bug。
为什么值得关注
agent 能找到攻击面,就用独立实现重验加沙箱兜底:Lean 的多内核防御不依赖形式方法栈,跑 agent 写仓库的团队可直接套用
关键信息
- 作者: Leonardo de Moura(Lean FRO 首席架构师、AWS Distinguished Scientist)
- 发布: 2026-10-15,Lean v4.35.0
- 背景: 2026-08-01 与 2026-08-24 两份 postmortem 记录 AI agent 找到 proof kernel 漏洞
- lake check: 导出开发 → leanchecker(去外围官方内核)沙箱重验;--paranoid 跑 nanoda/lean4lean/con-leche/con-ron 四内核 + 硬化分配器内核变体
- con-leche: 首个用 Lean 写成并证明一致的内核,Claude(Fable/Opus)实现、Joachim Breitner 监督;全 Mathlib 指令数 0.69x、8 线程约 100 秒
- con-ron: AI 翻译 con-leche 到 Rust 并用 Aeneas 证明精化,双内核同验覆盖编译器/运行时残留 bug
- 扩展性: Anthropic FLT >13M LoC、Tau Ceti >3M LoC、社区提案 1B+ LoC,外部内核需要二进制导出与增量检查
English Source
AI agents are very effective at finding vulnerabilities in our software. This includes the kernel (the proof checker) of the Lean proof assistant. See our two recent postmortems (August 1, August 24). We are strengthening the official kernel, adding new kernels, and building new tools that simplify rechecking your Lean developments with external kernels. Lean v4.35.0 comes with the lake check command. This command exports your development and rechecks it with leanchecker, the official Lean kernel without all the baggage around it. The whole process runs inside a sandbox. You can disable the sandbox using lake check --inadvisably-no-sandbox. Lean now ships with four additional kernels: nanoda, lean4lean, con-leche, and con-ron. You can recheck your development with all of them using the command lake check --paranoid. In this mode, we also run a variant of the official kernel built with a hardened memory allocator, which turns memory corruption into a checked abort instead of a silently wrong answer.
Con-leche is the first kernel for Lean written in Lean and proven consistent. It was implemented and proven consistent by Claude (Fable and Opus), under heavy supervision by Joachim Breitner at the Lean FRO. "Consistent" here means that every environment con-leche accepts has a model in set theory, following Mario Carneiro's model of Lean's type theory. This approach eliminates a complete class of bugs: programming mistakes in the kernel implementation. It does so without a performance penalty. On the full Mathlib export, con-leche executes 0.69x the instructions of the official kernel and checks the whole library in about 100 seconds using eight threads (see PERF.md).
However, con-leche is not bulletproof, because there might be bugs in the compiler and runtime used to build it. To minimize this kind of risk, Joachim used AI to translate con-leche to Rust and then used Aeneas to prove that the Rust version refines con-leche's checking algorithm. Aeneas is a tool for verifying Rust code using Lean. This kernel is called con-ron. The key point is that, since con-leche has a formal consistency proof, any remaining unsoundness bugs are most likely in Lean's compiler or runtime (including the bignum library). It is very unlikely that the same bug also exists in the Rust compiler or runtime, so by checking a proof with both con-leche and con-ron, you gain a high level of protection against this class of bugs.
We also expect the verification of lean4lean to be completed in the next few months, and then we will have three verified kernels in our distribution. The lean4lean verification is also important because its implementation follows the official C++ kernel implementation very closely. Arthur Adjedj is working on the kernel renovation plan (see issue #14977). Joachim is reviewing the PRs, making sure con-leche implements the same changes, and patching its proof to ensure no new holes are introduced during the renovation.
Scalability is also a major concern now. Anthropic's FLT is over 13M LoC, Mathlib is 2.5M LoC, and Tau Ceti is already over 3M LoC and growing fast. The General Courtade-Kumar theorem repo is above 50M LoC. We are seeing the Lean community write proposals for math libraries in the 1B+ LoC range. The current approach for external kernels does not scale to developments of this size. We need binary export formats and incremental checking with external checkers. In the meantime, run lake check --paranoid on your own project. If the kernels disagree about one of your proofs, we want to hear about it at contact@lean-fro.org.
Obsidian Notes
- opencli web read rejected navigation; grounded via direct curl of the blog page (2026-10-18 evening run), text captured verbatim.
- Chinese summary, English summary, and one-liner anchored to the fetched source text; appended via pipeline_utils (AAIF daily-intake evening).