Technology1 min read

Yes, 17M lines of Lean is a lot

By · Published by Everything Blog

In short

Recent metrics show human-written codebases in Mathlib fail to reach the massive scales seen in recent automated outputs. In contrast, package indices reveal an emerging class of computer-assisted efforts that regularly hit tens of millions of lines. For instance, Anthropic expanded a human effort of roughly 60,000 lines into a 27-million-line automated repository for Fermat's Last Theorem.

Key points

  • Human mathematical formalizers produce codebases that are vastly smaller than recent auto…: Human mathematical formalizers produce codebases that are vastly smaller than recent automated efforts.
  • Artificial intelligence agents can expand human mathematical proofs by hundreds of times…: Artificial intelligence agents can expand human mathematical proofs by hundreds of times their original length.
  • Massive multi-million-line codebases represent an established pattern among script-built…: Massive multi-million-line codebases represent an established pattern among script-built and machine-assisted Lean packages.

Sources checked by our analysis pipeline: 1

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.

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!:

88m: Qiuzhen-CFSG/CFSG this appears to be…

Technology