← Mon, Nov 23 digest

Yes, 17M lines of Lean is a lot

read article ↗ hn thread ↗

A data-driven analysis shows that AI-generated Lean proofs spanning millions of lines dwarf human-written math libraries by orders of magnitude.

summary is enough The short blog post efficiently visualizes Lean codebase sizes, though the comment thread provides much more substance on formal verification and AI verbosity.

summary

Recent high-profile AI math proofs, such as those for the Riemann hypothesis and Fermat's Last Theorem, have spanned millions of lines of Lean code. This analysis compares these monstrous codebases against human-written Mathlib entries and other Reservoir repositories. The data shows that AI-assisted proofs are hundreds of times longer than human equivalents due to massive verbosity and the need to formalize missing foundational theories. Commenters debate whether such unreadable, machine-compiled proofs undermine mathematical understanding or if the kernel's rigorous verification makes human audit unnecessary.

key points

  1. Human-written entries in Mathlib come nowhere near 17 million lines, typically staying well under 100k lines.
  2. AI-generated projects like Anthropic's Fermat's Last Theorem reach 27 million lines, making them roughly 450 times longer than ongoing human efforts.
  3. A large portion of these massive line counts stems from AI re-proving or explicitly establishing foundational dependencies that lack existing Lean libraries.

who should read it

Formal verification researchers, mathematicians, and engineers tracking practical applications of LLMs in automated reasoning.

discussion mixed

consensus

Commenters generally agree that the massive line counts reflect AI's current weakness in information compression and generating elegant, concise code.

pushback

Some push back by noting that Lean acts like a compiler where high-level statements naturally expand into thousands of verified primitive steps, making raw line counts a poor proxy for mathematical complexity.

best comment by _flag ↗

There seem to be a lot comments in this thread about how the amount of lines of code is indicative of the proof's incomprehensibility, or suggesting that codegolfing would help make it easier to understand. This is a misunderstanding.

Lean is roughly analogous to compiled math. Just like your complier might turn a few simple statements in a high-level language into thousands of assembly instructions, the process of formalising a natural language mathematical proof can turn sentences into thousands of lines of code. One does not try to understand this code, but instead tries to understand the …

It clarifies that Lean code is analogous to compiled assembly rather than human-readable proofs, explaining why massive line counts do not inherently invalidate the underlying mathematics.

Generated by an LLM from the article and thread. Check the sources before relying on it.