1700 万行 Lean 证明规模究竟有多大

原标题:Yes, 17M lines of Lean is a lot
42AI 研判分

针对黎曼猜想证明据称长达 1700 万行 Lean 代码的说法,作者用 Mathlib 中 259 个著名定理的证明长度和 Reservoir 上全部 Lean 包的规模做横向对比,结论是这一体量确实远超现有任何形式化数学工程。Mathlib 整体约 240 万行,仅三个包超过 1700 万行,说明该证明规模在形式化验证领域属于极端量级。

报道正文

本文目录2 个章节

The recent proof of the Riemann hypothesis came with a statistic attached: the proof is 17 million lines of Lean. Beyond the philosophical questions of what it means to have a proof longer than any human could comprehend, I’m left with a simpler question: is that as large as it sounds?

To investigate, I hunted for collections of Lean proofs online. I found two and charted the lengths of their proofs.

(All charts have a log x axis, which makes 17m lines look a lot closer to 1m and 100k than it really is.)

Famous theorems in Mathlib

Mathlib maintains a collection of famous proofs. There are over 1k but only 259 have Lean associated, which I chart here.

These are all human generated, and as we can see, they come nowhere close to 17m.

Histogram of 259 famous theorems in Mathlib by the Lean lines they depend on: nearly all fall between 100k and 1.2m lines, below the 2.4m lines of all of Mathlib and far below the claimed Riemann proof at 17m

Every Lean package on Reservoir

Reservoir indexes every published Lean package, 938 of which have Lean code on GitHub. This one has a lot more data, including AI assisted proofs. We even have a few that are over 16m!:

  1. 88m: Qiuzhen-CFSG/CFSG this appears to be an AI built proof that is still a work in progress.
  2. 36m: CBirkbeck/LeanBridge, a project linking the LMFDB database of number theory objects to Mathlib. This isn’t really a proof: about 98% of its Lean is files generated by scripts that check the database’s numbers one by one. The hand-written part is closer to 500k lines.
  3. 27m: anthropics/fermats-last-theorem is another Anthropic special: a complete proof of Fermat’s Last Theorem, published on GitHub in September. Its README says “the Lean sources were produced by AI agents building on human-written open-source Lean”, including the human FLT project led by Kevin Buzzard, which is about 60k lines and still in progress. The AI version is roughly 450 times longer.

Histogram of 938 Lean packages on Reservoir by estimated lines: the median package is about 4k lines, all of Mathlib is 2.4m, and only three packages (88m, 36m and 27m) are larger than the claimed Riemann proof at 17m

So yes, 17m lines is a lot.