12. Producing

Draft

What it takes

For twenty years a formal proof was expensive because people wrote every line of it, and the largest, half a million lines, took its team 12 years. In 2026 the writing became cheap: one theorem arrived in 13.4 million lines that a model wrote in 11 days, and the Lean text released on 20 November as a proof of the Riemann hypothesis is reported at 17 million. This part is about how proofs are produced at such sizes, by people and by machines. Both follow the same workflow because the architecture of the checker forces it. Lean's kernel, the small program of Section 6 that computes the type of a term, accepts a candidate proof term if and only if its type matches the stated proposition. So long as the kernel is sound (Section 13), the proofs themselves can be generated by anyone or anything, in any order, without human readers having to inspect millions of lines for logical gaps. By contrast, no program can check whether a formal statement captures the mathematical claim a human had in mind, so the top-level statements must be written first, kept short, and read by people. This is the fourth step of the series' argument, that "checked in Lean" is a chain of trust with named links, seen from the side of whoever makes the proof; Section 13 takes the side of whoever certifies it.

At this scale a proof must be built in pieces, and pieces written separately fit together only if the interfaces between them, the theorem and lemma statements, are fixed in advance (Section 12.2). Auditing the top-level statements tells a reader what was proved only if the project locks them down so the proof cannot quietly alter their meaning (Section 12.3). With the target statements frozen, filling in the proofs can be handed over to a trial-and-error loop where the writer is free to make mistakes because the checker rejects every flawed attempt (Section 12.4). Section 12.5 measures the artifacts published in November 2026, and Section 12.6 opens their source files to see what machine-written Lean looks like.

lines of code by year, as each source counts them (a logarithmic scale in the live figure)

year lines of code  written by             project
2005       60,000   people                 four-color theorem
2012      150,000   people                 odd order theorem
2014      500,000   people                 Kepler conjecture
2022    1,000,000   people                 Mathlib, the library, for scale
2025       35,600   people                 Carleson's theorem
2026   13,400,000   a model                Fermat's last theorem
2026      640,000   a model                Navier-Stokes problem
2026    1,525,868   people                 Mathlib at the proof's pin, counted here (2,340,927 lines in all)
2026   15,531,759   a person and a model   Riemann hypothesis, original archive, as reported (17,374,215 in all)
2026      299,902   a model                Riemann hypothesis, readable edition, counted here too (477,124 in all)
2026       76,149   people and a model     Riemann hypothesis, compact edition, as reported (112,827 in all)

original archive to readable edition: 52 times the lines of code
no count in the sources read: 6 projects, the liquid tensor experiment (2022) among them
(the live figure needs JavaScript and loads about 0.06 MB of data)
Landmark formalizations by year and size, the lines as each source counts them (lines of code where a source tells them from all lines). Green: the readable edition of the Lean proof of the Riemann hypothesis. Circles: written by people; squares: by a model; diamonds: by both. Outlined marks are figures taken from documents; filled ones were counted for this series from the text. Wash: the range of the proofs people wrote. A hairline joins the three editions of the one proof. Bottom lane: projects whose sources give no count. Point at a mark to read its source.

The proofs that teams of people formalized between 2005 and 2025 run from 35,600 lines (Carleson's theorem) to 500,000 (the Kepler conjecture). The two largest marks of 2026 stand some thirty times above that range, while the readable edition, a rewriting of the 20 November release published five days later, falls right back inside the human range at 299,902 lines of code. Because each project counts lines by its own rules (Remark 12.1.2), the chart compares orders of magnitude rather than exact ratios.

Line counts measure bulk, not human effort, and the cost of writing formal proofs by hand was measured early. One might fear that as a textbook builds deeper definitions on earlier ones, formalizing each new chapter would require unpacking ever more layers of machinery, causing the formal text to blow up faster than the printed book. When N. G. de Bruijn's Automath project, begun in the late 1960s, formalized an entire textbook, Landau's Grundlagen der Analysis, he found instead that the formal version stayed roughly a constant multiple of the ordinary text from beginning to end. Freek Wiedijk turned that observation into a precise ratio, compressing both files so identifier lengths and whitespace would not skew the comparison.

Definition 12.1.1 (the de Bruijn factor). For a mathematical text and a formalization of it, the de Bruijn factor is the size of the formalization divided by the size of the informal text written in TeX, both files compressed with gzip.

A very important thing that can be concluded from all writing experiments is the constancy of the loss factor. The loss factor expresses what we loose in shortness when translating very meticulous "ordinary" mathematics into Automath. This factor may be quite big, something like 10 or 20, but it is constant: it does not increase if we go further in the book. It would not be too hard to push the constant factor down by efficient abbreviations.

Because of this quote, I defined the de Bruijn factor to be the quotient of the size of a formalization of a mathematical text and the size of its informal original. To make this specific, I made the following choices: The size of the informal text is the size of a TeX encoding. To be independent of arbitrary factors like lengths of identifiers and amount of whitespace, the files should be compared compressed with the Unix utility gzip.

—N. G. de Bruijn (1980), quoted and continued by Freek Wiedijk, "The de Bruijn factor". F. Wiedijk, "The de Bruijn factor", web page (cs.ru.nl/~freek/factor), its opening. The first paragraph is from N. G. de Bruijn, "A survey of the project AUTOMATH", in To H. B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, Academic Press, 1980, as the page quotes it (loose is the page's spelling); the second is Wiedijk's, whose two choices are a list on the page. His measured values run from 0.44 (a page of additive number theory) to 8.8 (a page of topological analysis), with Landau's book in Automath at 3.7, and he sums up: "Apparently people generally select texts for formalization that are matched to their system in difficulty such that the de Bruijn factor becomes around four."

A constant factor means that formalizing behaves like translation: labor grows linearly with the source text, requiring painstaking detail rather than new mathematics. Still, that constant overhead was steep. In 2005 Barendregt and Wiedijk estimated a full work-week to formalize one page of an undergraduate textbook, compared with half a workday to write the page in TeX.H. Barendregt and F. Wiedijk, "The challenge of computer mathematics", Philosophical Transactions of the Royal Society A 363, 2005, Section 4. The proof of the odd order theorem in Coq, another proof assistant, took a team six years. About 40,000 of its more than 150,000 lines translate the roughly 250 pages of its two main sources, four to five lines of script to a line of print; the libraries under them are "almost 80 percent of the total length", and "the most time-consuming part of the project involved getting the base and intermediate libraries right".G. Gonthier and 14 others, "A machine-checked proof of the odd order theorem", ITP 2013, Lecture Notes in Computer Science 7998, abstract and Section 6. The formal proof of the Kepler conjecture took about 12 years and, by Thomas Hales's own count, "about 20 human work-years" for about 500,000 lines.T. Hales, "What mathematicians should know about the Lean Theorem Prover: questions of reliability and AI", guest post on Terence Tao's blog, 9 October 2026, for the work-years and the lines; K. Buzzard, "What is the point of computers? A question for pure mathematicians", ICM 2022 (arXiv 2112.11598), Section 1.5, for the 12 years.

Then writing the lines stopped being the bottleneck. On 4 September 2026 Kevin Buzzard reported that an Anthropic model had formalized a proof of Fermat's last theorem in "over 13.4 million lines of code", written in "an 11 day period".K. Buzzard, "FLT: Anthropic has beaten me to it", Xena project blog, 4 September 2026. The machine he needed is told in his post of 12 November 2026, "…and the proof is checked in Lean", under its second question. Everything around the writing remained expensive. Simply compiling that repository required a borrowed machine with 96 cores and 500 gigabytes of memory, and by Buzzard's account the build took nearly 20 times as long as compiling all of Mathlib, Lean's library of mathematics (Section 11). On 15 October Leonardo de Moura, who started Lean, wrote of developments of 13 and of 50 million lines, of proposals for libraries of a billion, and of the external checkers examined in Section 13: "The current approach for external kernels does not scale to developments of this size."L. de Moura, "Lean Now Ships with Verified Kernels", blog post, 15 October 2026, last paragraph. And the two oldest human tasks remain untouched: someone still has to specify the right theorem, and someone still has to understand why the proof works (Section 14).

Before dividing one project's line count by another's, one has to ask whether both sources counted the same thing.

Remark 12.1.2 (a line count is a count of something). One source counts every line in a repository while another counts only lines of code, omitting blank lines and comments; one counts the proof script alone while another includes background libraries or auxiliary computer programs. Carleson's 35,600 leaves out blank lines and comments, the Kepler figure covers that proof's verified computer calculations alongside its script, and the odd order figure includes all the algebra libraries built underneath the theorem. Two counts can be divided meaningfully only when a single rule measures both; Remark 12.5.1 applies that discipline to the November 2026 editions.

Line counts measure the bulk of a finished repository, not how a team or a model writes hundreds of thousands of lines in pieces that fit together on the first try.

Statements first

Writing a long proof from the bottom up invites a classic trap: weeks spent proving helper lemmas whose exact hypotheses turn out to miss what the main theorem needs. In Lean, the entire dependency skeleton can instead be checked from the top down in 55 lines. To prove that no natural numbers \(a\) and \(b\) with \(b \neq 0\) satisfy \(a^2 = 2b^2\), state the main theorem alongside the five helper lemmas the argument will need, write sorry in place of every proof, and hand the file to Lean. Lean accepts the skeleton immediately. You can then fill in the six proofs one at a time, in any order.

A development in Lean written statement first: six statements, every proof a hole (sorry) to begin with, and
the holes closed one at a time, from the theorem down. Lean 4.35.0 accepted the file at each of the 7 stages.

the theorem, and under each statement the ones its proof uses     holes closed   0  1  2  3  4  5  6
sqrt_two_irrational                                                              o  #  #  #  #  #  .
  no_solution                                                                    o  o  #  #  #  #  .
    smaller                                                                      o  o  o  .  .  .  .
    halve                                                                        o  o  o  ox #  #  .
      even_of_even_sq                                                            o  o  o  o  o  #  .
        sq_mod_two                                                               o  o  o  o  o  o  .
Lean's warnings                                                                  6  5  4  3  2  1  0

o  a hole still open: the proof is sorry         #  a proof written; #print axioms still lists sorryAx under it
.  a proof written, no sorryAx                   x  a proof of halve that Lean refused: omega could not prove the goal

#print axioms on the theorem
  0 or 1 holes closed    'SqrtTwo.sqrt_two_irrational' depends on axioms: [sorryAx]
  2 to 5 holes closed    'SqrtTwo.sqrt_two_irrational' depends on axioms: [propext, sorryAx, Quot.sound]
  all 6 closed           'SqrtTwo.sqrt_two_irrational' depends on axioms: [propext, Quot.sound]
(the live figure needs JavaScript and loads about 0.04 MB: what Lean 4.35.0 said at each stage)
A proof that no natural numbers satisfy a² = 2b² with b not zero, written statement first and recorded from Lean 4.35.0 at seven stages. Green: a hole still open, a proof that is sorry. Dots: proofs written. Hatched: statements under which #print axioms lists sorryAx. The cross: a proof Lean refused. Step through the stages, or click a cell, to read a statement as the file had it and what Lean answered. Lean accepts every stage; only #print axioms tells which statements still rest on a hole, and for the theorem that is every stage but the last.

Lean accepted the file at all seven stages. What separates the unfinished development from the finished proof is not Lean's exit status on the file, which succeeds every time, but a single line from #print axioms, the command of Section 7.5 that lists every axiom a theorem relies on. Here the main theorem's own two-line deduction is written first, yet sorryAx remains listed underneath it until the sixth and final hole, a parity lemma four levels down, is closed.

A sorry acts as a typed promissory note. Lean still elaborates the theorem statement in full, turning its surface syntax into a complete typed expression (Section 9), and every subsequent lemma or theorem may invoke that statement as if it were already proved. That gives a project two decisive advantages. First, the machine verifies the global architecture from the top down before any low-level lemma is proved, so a plan whose pieces do not fit together fails on day one rather than after months of work. Second, closing each hole becomes an isolated task: whoever proves a lemma needs only its statement and imports, not the rest of the proof.

Allowing unfinished lemmas to type-check is safe only if an unclosed hole can never masquerade as a genuine proof. Lean guarantees that by implementing sorry not by disabling the kernel, but by invoking an explicit built-in axiom.

Definition 12.2.1 (a hole). A hole is a term written sorry. At whatever type is expected there, Lean elaborates it to an application of sorryAx, an axiom of its core library (the library that ships with Lean) that gives a term of every type.

/--
Auxiliary axiom used to implement the `sorry` term and tactic.

The `sorry` term/tactic expands to `sorryAx _ (synthetic := false)`.
It is intended for stubbing-out incomplete parts of a value or proof while still having a syntactically correct skeleton.
Lean will give a warning whenever a declaration uses `sorry`, so you aren't likely to miss it,
but you can check if a declaration depends on `sorry` either directly or indirectly by looking for `sorryAx` in the output
of the `#print axioms my_thm` command.

The `synthetic` flag is false when a `sorry` is written explicitly by the user, but it is
set to `true` when a tactic fails to prove a goal, or if there is a type error
in the expression. A synthetic `sorry` acts like a regular one, except that it
suppresses follow-up errors in order to prevent an error from causing a cascade
of other errors because the desired term was not constructed.
-/
@[extern "lean_sorry", never_extract]
axiom sorryAx (α : Sort u) (synthetic : Bool) : α

An axiom of type \(\Pi (\alpha : \mathrm{Sort}\ u).\, \mathrm{Bool} \to \alpha\) manufactures a term of every type \(\alpha\), False included, so anything resting on sorryAx is unproved. Making sorryAx an ordinary axiom constant rather than a special bypass inside the kernel is what keeps the mechanism sound: every proof term built from a hole carries sorryAx in its dependency graph, reducing the question of whether a theorem is finished to the axiom check of Section 7. The boolean flag synthetic records where the hole came from: false when a writer typed sorry deliberately, and true when Lean inserted one automatically after a tactic failed or an expression failed to type-check.In Lean 4.35.0, the elaborated term has one step more than the docstring shows. Under set_option pp.explicit true, the hole of def n : Nat := sorry prints as sorryAx (Lean.Name → Nat) false applied to a name encoding the hole's position in the file, instantiating the axiom at a function type from names. Plugging a broken proof with a synthetic hole lets Lean report the error and continue checking the rest of the file in the same pass, rather than letting one broken lemma cascade into spurious errors downstream. The automated repair loop of Section 12.4 relies directly on that recovery.

Because Lean compiles files containing holes without halting, anyone claiming a finished proof has to check explicitly that no holes remain.

Remark 12.2.2 (accepted is not finished). Running Lean on a file containing sorry returns exit code 0. Unfinished work shows up in three places instead: the compiler warning declaration uses `sorry` on each declaration containing an explicit hole; #print axioms, which lists sorryAx under any theorem resting on a hole directly or through a chain of lemmas; and, for a completed project, an external verification judge configured with the exact whitelist of axioms a proof may use (Section 12.3). As Section 7.5 showed, #print axioms in Lean 4.35.0 can omit an axiom when queried across an import boundary, so final certification walks the exported proof terms directly (Section 13).

Writing statements first assumes someone already sees how to split a proof into lemmas. At the scale of a research paper, human teams draft that decomposition for mathematicians before translating it into Lean. A blueprint breaks an informal proof into bite-sized lemmas, links each paragraph to its formal Lean statement, and plots their dependency graph automatically. Terence Tao described the workflow during the first week of formalizing the Polynomial Freiman-Ruzsa conjecture (PFR).

The project has been greatly assisted by the Blueprint tool of Patrick Massot, which allows one to write a human-readable “blueprint” of the proof that is linked to the Lean formalization; similar blueprints have been used for other projects, such as Scholze’s liquid tensor experiment. For the PFR project, the blueprint can be found here. One feature of the blueprint that I find particularly appealing is the dependency graph that is automatically generated from the blueprint, and can provide a rough snapshot of how far along the formalization has advanced.

—Terence Tao, "Formalizing the proof of PFR in Lean4 using Blueprint: a short tour" (2023). Blog post of 18 November 2023: the third, fourth and fifth of the seven sentences of its first paragraph. The first two announce the project, the first with a formula in it, and the last two lead to a picture of the graph. The word here was a link. Two projects that worked from a blueprint: the liquid tensor experiment, finished on 14 July 2022, a year and a half after Peter Scholze posed it ("Completion of the Liquid Tensor Experiment", Lean community blog, 15 July 2022), and Carleson's theorem, 13 months and 28 people (Becker, de Frutos-Fernández, Diedering, van Doorn, Gouëzel, Karunus and others, "Formalizing Carleson's theorem in Lean", arXiv 2609.31334, 2026).

Once the last sorry is eliminated, almost all of those intermediate lemma statements have served their purpose and drop out of the audit. While the project was under construction, each helper lemma's statement acted as an interface contract between whoever proved it and whoever invoked it; once the kernel has checked both sides, even an awkwardly phrased or overly specialized helper lemma is guaranteed both to hold and to imply the final theorem. To know what the finished project actually proved, a human auditor need only inspect the final theorem statements, the definitions they invoke, and the axioms allowed.

Definition 12.2.3 (the trusted surface). The trusted surface of a project is what a reader has to read in it to know what is claimed: the statements of its main theorems, the definitions of its own that those statements use, and the list of axioms its proofs are allowed.

The term shortens a phrase from the README of zeta23, which calls its statement file the trusted statement surface a reader audits; Section 12.3 places zeta23 alongside a larger repository. Neither intermediate lemmas nor proof scripts belong to the trusted surface. What the definition alone cannot show is how tiny that surface is next to a half-million-line proof, or what stops the proof files from tampering with the definitions underneath it.

A project up close

On 25 November 2026 the Lean proof released five days earlier was published again, rewritten as a shorter project: the readable edition. It is the one edition of the proof that this series reads, and Section 12.5 reports where it came from. Its source folder holds 803 Lean files with 477,124 lines. What the project claims stands in 54 lines of three files.

two projects, a rectangle to a file by its lines, at one scale
green: the trusted surface, to audit       hatched: the proof, need not be read

the readable edition      805 files   477,162 lines
  trusted surface           3 files        54 lines   0.011 % of the lines
  the proof               802 files   477,108 lines   for the kernel to check
zeta23                    328 files   103,081 lines
  trusted surface           4 files       386 lines   0.37 %
  the proof               324 files   102,695 lines

the trusted surface of the readable edition: Challenge.lean (20 lines),
src/Statements.lean (16), comparator.json (18); 5 theorems on 4 definitions.
The first theorem, as Challenge.lean states it:

  theorem riemannHypothesis : RiemannHypothesis := by
    sorry

zeta23 states 23 theorems on 23 definitions of its own
(the live figure needs JavaScript and loads about 0.4 MB of data)
Two projects, a rectangle to a file: the readable edition of the Lean proof of the Riemann hypothesis, and zeta23, by its repository “More than two thirds of the zeros of the Riemann zeta function are simple and on the critical line”. Both were read as text, nothing built. Green: the trusted surface, the statement files and the comparator configuration, which a reader audits to know what is claimed. Hatched: the proof, for the kernel to check. The listing is the first surface in full. Point at a rectangle to read its file. Mathlib and the kernel, on which the claim also rests, are outside both folders and not counted.

Those three files form a single specification contract. Simply reading the last file of a 477,000-line repository is not enough on its own: an earlier file imported by the proof could silently override a notation, register a non-standard type-class instance, or shadow a library name so that the final theorem line looks familiar while stating something trivial. Separating the target statements into a clean file that imports nothing from the proof allows an automated judge to verify that the proved theorems match the audited specification symbol for symbol.

Definition 12.3.1 (challenge and solution). A challenge is a Lean file that states theorems, each with sorry for its proof, and imports only what is trusted. A solution is a project that proves theorems of the same names. A configuration names the two, the theorems to compare and the axioms a proof may use. A judge accepts the solution when each theorem has the same statement on both sides, down to every definition the statement uses, when the kernels it is told to use accept the solution's proofs, and when those proofs use only the permitted axioms.

In Lean's ecosystem that judge is comparator; Section 13.5 examines what it guarantees and what it presupposes. Viewed from the producer's side, a challenge file is simply stage zero of a statement-first development preserved intact, with every sorry left open and the statements frozen against edits. In the readable edition, Challenge.lean is 20 lines and imports only the 16-line file src/Statements.lean, which in turn imports only Mathlib and introduces four helper definitions; comparator.json adds 18 lines of configuration. The first of the five theorems needs none of those four project definitions, because its type, RiemannHypothesis, comes straight from Mathlib (Section 11.5). The top file of the solution is equally terse.

/-- **The Riemann Hypothesis**, as stated in Mathlib. -/
theorem riemannHypothesis : RiemannHypothesis := New.zeta_zeros_on_line New.grh
-- ...
theorem LFunction_ne_zero_of_half_lt_re : DirichletLNonvanishingRightOfHalf := New.grh
-- ...
theorem LFunction_eq_zero_re : DirichletLZerosOnLine := New.zeros_on_line New.grh
-- ...

Each of the five proofs is a single line derived from one central theorem, New.grh, which asserts that no Dirichlet L-function vanishes at any complex number of real part greater than one half, apart from a pole at 1. Almost the entire source tree hangs behind New.grh: the module proving it transitively imports 800 of the project's other 802 files. The edition's README and reading guide describe the human auditor's job in the same terms: read Statements.lean, check the five theorem signatures, and inspect the axiom list printed by #print axioms. One subtlety separates that convenience script from a full external audit: the script imports the compiled proof before calling #print axioms, which is the cross-module setup where Lean 4.35.0 can omit an axiom hidden behind a constructor (Remark 7.5.4). Nothing suggests any axiom goes unreported here, yet a #print axioms printout is weaker evidence than having an external judge enforce the three-axiom whitelist in comparator.json directly on exported terms.

Because those 54 lines represent just 0.011 % of the repository, it is easy to mistake them for the entire trusted base.

Remark 12.3.2 (the surface is not all that is trusted). Including the challenge and configuration files, the project totals 805 files and 477,162 lines, of which the 54-line surface is 0.011 %. That fraction measures only the project-specific text a reader must audit. The statements themselves rest on Mathlib's definitions of the Riemann zeta function and Dirichlet L-functions, while the proof check rests on Lean's kernel; both live outside the project folder and outside this line count, and Section 13 measures their scale.

Nor does the trusted surface grow with the length of the proof; it tracks how much new vocabulary is needed to state the results. The August 2026 project zeta23, on simple zeros of the zeta function on the critical line, is less than a quarter as long at 103,081 lines across 328 files, yet asks its reader to audit 386 lines across four files because it states 23 theorems built on 23 custom definitions, whereas the readable edition states five theorems on four custom definitions and draws the rest directly from Mathlib. Its README spells out the division of trust.

What a skeptical reader has to trust: Mathlib's definitions of riemannZeta, DirichletCharacter.LFunction, analyticOrderAt, Set.ncard, finsum; the trusted file Challenge.lean (whose only import is Mathlib; its inlined definition layer is the content of ChallengeDeps.lean); the Lean kernel; and Comparator's own assumptions (its README). Nothing under Zeta23/ needs to be read to know what is proved.

—README of zeta23, "Reading notes for the statements" (2026). The folder zeta23 of github.com/anthropics/formal-math, read as text at its state of 30 November 2026. It formalizes L. Alpöge and R. Furman, "More than two thirds of the zeta zeros are simple and on the critical line", arXiv 2608.13637. By the same README all of its Lean was written by Claude, and the paper's authors "wrote no Lean by hand".

What stands behind the surface is engineering. By its numbers the readable edition is a large software project of an ordinary kind. Counted as text, it has 23,839 declarations by their opening keyword, 16,684 of them lemmas; 1,733 imports among its 803 modules, the longest chain 54 modules deep; and no file above 1,002 lines of code. Its README gives a build one to two hours on 12 cores and 24 gigabytes of memory.Counted from the text of the edition as published on 25 November 2026 (github.com/lsernau/grh-lean, folder grh/, commit 72fead1). A count by keyword misses the declarations that Lean generates. Nothing of the project was built or run for this series. It comes with a reading guide and its glossary of 46 entries, a table of contents with a title for every file, an index of results with their sources, and a list of citations that says which were compared with their sources.

That is the finished thing. How proofs get written, by a writer who may be wrong, is the other half of the method.

The loop with the checker

Once the target statements are fixed, proving them reduces to a feedback loop: propose a proof, hand it to Lean, read the diagnostics, and repair what failed. A human mathematician runs this loop interactively a line at a time, watching the remaining proof goal update after each tactic, the proof-building commands of Section 10. A language model can run the same loop a whole file at a time, submitting a complete draft and revising from compiler error messages. One end-to-end run was recorded for this series to observe on concrete attempts which mistakes Lean catches and which ones slip past it; Section 12.7 walks through the same loop by hand.

One model (Claude, claude-fable-5-2), one run, every attempt checked by Lean 4.35.0. Six sets under five rules: no rate over all.

set                                                  accepted  at attempt 1   not accepted                                    proofs equal the source's
A    short lemmas of the core library                40 of 40            40   0 attempts                                      15
B    statements that did not exist before            25 of 25            25   0 attempts                                      7
C    known statements with longer proofs             20 of 20            18   2 attempts                                      0
D    famous theorems, from the core library alone     6 of 12             2   4 attempts                                      no source proof; 6 not attempted
E    five of those six again, with no giving up        4 of 5             0   14 texts: 10 unfinished, 4 with an error from Lean
F    one of them once more, complete texts only        1 of 1             1   0 attempts

set D | set E | set F: number in the list, theorem, attempts | attempts when taken up again | and once more, lines of each text
  1  The Irrationality of the Square Root of 2 (read as: no fraction has square 2)  ●             |                  34
  3  The Denumerability of the Rational Numbers (read as: countable and infinite)   ●             |                  37
  7  Law of Quadratic Reciprocity                                                   not attempted | … … … … … … | ●  51 249 276 321 366 926 | 1,136
 10  Euler's Generalization of Fermat's Little Theorem                              ? ●           |                  126 153
 19  Four Squares Theorem                                                           not attempted | … … ? ? ●        73 103 394 403 435
 20  All Primes (1 mod 4) Equal the Sum of Two Squares                              not attempted | … ●              150 515
 23  Formula for Pythagorean Triples                                                ? ●           |                  125 129
 25  Schroeder-Bernstein Theorem                                                    ○ ●           |                  57 56
 31  Ramsey's Theorem                                                               not attempted | * ●              163 168
 33  Fermat's Last Theorem                                                          not attempted |
 39  Solutions to Pell's Equation (read as: existence only)                         not attempted | … × ●            203 468 508
 44  The Binomial Theorem                                                           ≠ ●           |                  110 114

● accepted by Lean   ? unknown identifier (4)   ≠ type mismatch (2)   ⊢ unsolved goals (1)   × tactic failed (1)   * another error from Lean (1)
… an unfinished text, sorry in it: not refused by Lean (10)   ○ refused by the harness, not by Lean (1)
not attempted: the model's judgment; Lean was never asked. In rounds one to three 6 of 97 attempts were not accepted,
five refused by Lean and one by the harness, each repaired at the next attempt.
(the live figure needs JavaScript and loads about 0.6 MB: the record of every attempt)
Every attempt of one model, each checked by Lean. Green: the attempts Lean accepted. Signs: attempts Lean rejected, by kind of error; three dots: a text sent unfinished, with sorry in it; hatched: not attempted. Bars: similarity to the source's proof in sets A to C, the length of a text in D to F. Sets E and F take up theorems of set D again, on their rows. Point at a mark to read its statement and Lean's answer. Sets A and C are public library text; the statements of D to F are the model's own readings, and Lean accepted each of their proofs again in a separate check.

Example 12.4.1 (a model in the loop). Between 01:49 and 04:27 in New York on 1 December 2026, a single model (Claude, from the same family as the model that wrote these posts) worked through 97 theorem-proving tasks in one pass under an automated test harness. For each task, the harness hands the model a theorem statement, passes each candidate proof script to Lean 4.35.0, and logs both the submission and Lean's reply. The model may submit up to six attempts per theorem, reading Lean's error messages between tries; an attempt counts as accepted when Lean reports no error and the proof uses no axiom outside the three standard axioms of Section 7. The 97 statements are grouped into six sets across five rounds, with each round's rules fixed before the round began. Set A consists of 40 theorems from Lean's core library (Lean without Mathlib) whose library proofs are at most three lines. Set B consists of the 25 theorems from the Euclid development in the introduction, written earlier that day by another instance of the same model. Set C consists of 20 core-library theorems whose reference proofs run 8 to 25 lines. Set D consists of twelve theorems from Wiedijk's list of 100,F. Wiedijk, "Formalizing 100 theorems" (cs.ru.nl/~freek/100). On 1 December 2026 the page counted all 100 as formalized in Lean, 99 in HOL Light, 95 in Isabelle and 80 in Rocq. specifically the first twelve expressible using Lean's core library alone and absent from both the core library and the Euclid file; for these, the model first wrote and froze the formal theorem statements before attempting any proof. Sets E and F revisit theorems from set D in two follow-up rounds.

On statements drawn from the core library or the Euclid file, the repair loop barely had to run. Lean accepted on the first try all 40 proofs in set A, all 25 in set B, and 18 of the 20 in set C, accepting the remaining two on the second try. Across sets A and C, the model proved 60 out of 60 theorems from a public library almost certainly present in its training data, matching the library's proof character for character on 15 of the 40 short lemmas in set A and 0 of the 20 longer ones in set C.

Set D is where genuine multi-lemma proofs had to be built from scratch. Here Lean accepted six proofs ranging from 34 to 153 lines for statements the model had formalized itself. The other six theorems were not attempted, which differs sharply from failing Lean's check: early in the round, the model judged those six too large on its own and marked them skipped without sending a single attempt to Lean, leaving 58 minutes of its time budget unused. Across rounds one through three, only 6 of 97 submitted attempts were rejected, five by Lean and one by the harness, and every one of the six was repaired on the very next try.

Round four returned to five of those six skipped theorems under a rule forbidding giving up; the sixth, Fermat's last theorem, was excluded by the rule and remains the sole theorem never attempted. Four of the five now went through: Lagrange's four-square theorem on the fifth attempt (435 lines); primes congruent to 1 modulo 4 as sums of two squares on the second attempt (515 lines); Ramsey's theorem on the second attempt (168 lines); and the existence of nontrivial solutions to Pell's equation on the third attempt (508 lines). Only quadratic reciprocity fell short, not through a mathematical error caught by Lean, but through attempt exhaustion: the model submitted six partial checkpoints ranging from 51 to 926 lines, each still containing sorry, and Lean reported zero errors on any of them before the six-attempt cap closed the task.

The model's own execution log from round four shows how that happened. During the round, the model wrote a local driver script to manage its work, so its logged "turn" numbers reflect only that script's internal bookkeeping. Halfway through the round it edited that driver script to add a command without saving the prior file, leaving only the model's own word that nothing else in the script changed. It also forfeited quadratic reciprocity by mismanaging both its attempt budget and the clock: after spending four of its six allowed submissions in the first five minutes as sorry checkpoints, it misread the remaining time by roughly four minutes and submitted its sixth attempt with one lemma still left as sorry when 11 minutes 33 seconds remained in the round. In a fifth round whose rule accepted complete, sorry-free files only, the model proved quadratic reciprocity on its first submission: 1,136 lines in all, comprising 70 helper declarations across 1,118 lines and an 18-line final proof via Gauss's lemma and Eisenstein's lattice-point count, which Lean checked in 4.0 seconds (measured once).

Across all five rounds, Lean rejected nine submitted files with an error. Classified by the first error in each file, four failed on a nonexistent library name (unknown identifier), two on type mismatches, one on an unsolved goal, one on a failed tactic, and one on another elaboration error. Ten additional submissions, all in round four, were incomplete sorry checkpoints rather than broken proofs, and one submission was rejected by the harness despite passing Lean without error.

Because sets D through F had no pre-existing core-library statements, the model formalized those twelve theorem statements itself. Here is how it froze quadratic reciprocity, with sorry standing in for the proof that later took 1,136 lines (Euclid.Prime is the primality predicate from the Euclid development):

/-- `a` is a square modulo `n`. -/
def IsSquareMod (a n : Nat) : Prop := ∃ x, x * x % n = a % n

theorem x1_88 (p q : Nat) (hp : Euclid.Prime p) (hq : Euclid.Prime q) (hp2 : p ≠ 2) (hq2 : q ≠ 2)
    (hpq : p ≠ q) : (IsSquareMod p q ↔ IsSquareMod q p) ↔ (p % 4 = 1 ∨ q % 4 = 1) := sorry

Stated without the Legendre symbol, this says that for distinct odd primes \(p\) and \(q\), \(p\) is a quadratic residue modulo \(q\) if and only if \(q\) is a quadratic residue modulo \(p\), except when both primes leave remainder 3 modulo 4, in which case modularity flips and exactly one of the two is a square modulo the other. An audit by a separate model instance with no role in the run inspected all twelve frozen statements and judged nine faithful to their traditional names and three weaker. Because Lean's core library lacks real numbers, theorem 1 (the irrationality of \(\sqrt{2}\)) was stated purely over natural numbers as no fraction has square 2. Theorem 3 (the denumerability of the rationals) was stated as countable and infinite, giving a surjection from the naturals onto the rationals and an injection the other way without constructing a bijection. Theorem 39 (solutions to Pell's equation) proved existence only rather than characterizing the full group of solutions. Lean accepted the proofs of all three without complaint, because each proof validly established the weaker proposition the model had written down.

As a final safeguard, all 11 accepted proofs across sets D, E, and F were reassembled from the logs and re-verified by Lean 4.35.0 against their frozen statements, passing 11 out of 11. In that check, Lean elaborates the frozen theorem statement before any of the model's helper lemmas enter the environment, and then checks that the model's proof inhabits that exact pre-elaborated type: a self-contained miniature of the challenge-and-solution pattern judged by Lean directly rather than by comparator. That ordering prevents a proof script from introducing custom notations, type-class instances, or shadowed names that alter what the theorem statement means; a keyword filter also rejects any submission containing axiom, set_option, or 13 other metaprogramming or option commands capable of bypassing the kernel, none of which appeared in the 11 files.

This log is an observational case study, not a benchmark. The model knew Wiedijk's list from pretraining, the round rules were adapted between rounds in response to earlier behavior rather than drawn independently, and no aggregate pass rate across the sets would be meaningful. Section 14.8 documents how the experiment was run. ◁

Every failure in this run that slipped past Lean lay outside the proof logic. The model's self-assessment was far too conservative, skipping six theorems and then proving five of them as soon as skipping was forbidden; its clumsy budgeting of checkpoints and wall-clock time cost it a theorem in round four; and three of its twelve self-written statements captured weaker claims than their names promised. On the other side of the ledger, not a single proof accepted by Lean had to be retracted.

A person and a model at the same loopa row to a station of the loop: at the left how a person passes it, at the right how the model of Example 12.4.1 did

  1. the statement

    stated first, and read The theorem and its lemmas are written before any proof, each with sorry. When the last hole is closed, the statement of the theorem and the definitions it uses are all that has to be read.

    its own reading, frozen The model stated twelve classical theorems itself and froze them before any proof. A review by a model that had no part in the experiment found nine faithful and three weaker than their names. Lean accepted a proof of each of the three.

    12.2
  2. one move

    a line at a time One tactic, then a look at the goal that is left, as in Section 10.

    a text at a time Helper lemmas and proof go to Lean together: texts of 34 to 1,136 lines.

    12.4
  3. Lean's answer

    the goal that is left After every line, the hypotheses at hand and what remains to be shown. A refusal comes with its place and its reason.

    messages for the whole text Every error with its place and its kind. Lean found an error in nine texts: four unknown identifiers, two type mismatches, one goal left unsolved, one failed tactic, one error of another kind.

    12.4
  4. a part not yet proved

    a hole Written sorry and closed later. #print axioms names sorryAx under every theorem that rests on it.

    a checkpoint Ten texts were sent with a part left as sorry, to have Lean check the rest. Lean found no error in any of them, and the rule counted each as an attempt.

    12.2
  5. the end

    the kernel accepts the term No warning, and no sorryAx among the axioms. Nobody's judgment is needed, the prover's own included.

    the kernel accepts, and again Every accepted proof of the twelve theorems was put together again from the record and accepted again by Lean for its frozen statement: 11 of 11.

    12.4

green: the one station that no checker reaches

One experimental log is an illustration, not a theorem. The general guarantee rests on what Lean's kernel checks, under explicit hypotheses.

Remark 12.4.2 (what the loop can and cannot break). Fix a target statement, meaning a type \(T\) together with all the definitions underneath it. If a sound kernel accepts a proof term \(t : T\), then \(T\) is formally derivable in Lean's type theory from the axioms referenced in \(t\), regardless of who or what produced \(t\) or how many broken drafts preceded it; whenever the kernel rejects an attempt, the environment stays unchanged. This applies the principle of Section 10.7, untrusted search paired with a trusted check, to entire proof files, provided every declaration passes through the kernel and the resulting axiom list is inspected. Short of a bug in the kernel itself, no volume of trial and error can push an underivable claim past that check. A malicious or careless script can, however, step around the kernel, for instance by declaring a custom axiom or inserting a declaration with kernel type-checking disabled; closing off those bypasses is why Section 13 replays exported proofs through external checkers. And the loop never questions \(T\) itself: the three weakened theorem statements sailed through every round untouched, and catching them required a reader inspecting the specification rather than another run of Lean.

People who receive a finished proof from a model meet the same division. In the project to formalize the solution of the sphere packing problem in dimension 8, provers of two companies had been filling sorrys since October 2025. In January 2026 one of them, Gauss of Math Inc, came back with the whole proof. The maintainers describe what they did next.

It would be a colossal understatement to say that we were shocked. When Math Inc stopped PRing their results to our repository, we got the impression that they had lost interest in our project. It turns out they had been developing a new version of Gauss---one significantly more powerful than the last one. And indeed, the result was nothing short of extraordinary. As soon as we had recovered from the shock, we set to work reviewing the Gauss code on a private repository. We checked to see that none of the definitions had been modified, we checked that it used nothing but the standard (classical) axioms of Lean, and we ran cursory checks for metaprogramming hacks. We brought in David Renshaw, the first official Innovation Engineer at the Institute for Computer-Aided Reasoning in Mathematics, who ran several manual checks of the code and put it through lean4checker. In parallel, even as we were verifying the dimension \(8\) code, Gauss astonishingly also came up with a sorry-free proof of the \(24\)-dimensional solution. Once we were satisfied that the code was legitimate, we agreed to make a joint announcement with Math Inc.

—Birkbeck, Hariharan and Lee, "The Sphere Packing Project, post 1: the story" (2026). Lean community blog, 2 March 2026, from the part of the story dated January 2026; the three hyphens are the page's. A PR is a pull request, a contribution offered to a shared project; lean4checker replays compiled files through Lean's kernel (Section 13).

Their checklist matches Definition 12.2.3 point for point: confirm that no definition was altered, verify that only Lean's standard axioms were used, scan for metaprogramming bypasses, and replay the compiled files through an external checker.

The checker makes a wrong proof harmless and leaves a wrong statement untouched. That is why a proof can be produced by the hundred thousand lines, by a person or by a model, and why the few lines that say what was proved still have to be written and read by someone.

The longest text of this section's record has 1,136 lines. The next question is what a text at the top of the chart of Section 12.1 is made of.

From fifteen million lines of code to three hundred thousand

The largest object of this part is known to this series only through documents about it. On 20 November 2026 Levent Alpöge released a remark of four pages and an archive of Lean files which, the remark says, formalize a proof of the Riemann hypothesis and of "the so-called Generalized Riemann Hypothesis"; the introduction reports the claim, and Section 13 what was checked. Five days later the argument was published again, rewritten, in two shorter editions, of which the readable edition is the one read here. Whether the hypothesis is thereby proved this part does not say, either way. It reports what was produced.

four sizes to one scale, in lines of code (squares in the live figure)

the original archive         15,531,759   175,187 files   as reported, not measured here
Mathlib at the proof's pin    1,525,868     8,624 files   counted here
the readable edition            299,902       803 files   counted here; the archive has 52 times as many
the compact edition              76,149       794 files   as reported

the readable edition enlarged, a rectangle to a file, under the chapters of its own contents

src/New   the set-up and the steps of the argument            306 files   122,391 lines of code   41 %
  1 The theorem and its reduction 3,527     2 Derivatives of theta functions 7,669
  3 Upper bound: a composite lift 21,744    4 Spanning: a second moment 39,368
  5 Lower bound: the determinant 13,759     6 Lower bound: one lift 10,681
  7 Lower bound: congruences 22,283         8 Supplement 3,328     9 The last file 32
src/Lib   results classed as known, missing from Mathlib      495 files   177,492 lines of code   59 %
  16 subjects, the largest: The Weil representation and theta lifts 20,644,
  Moduli of abelian varieties 18,884, General lemmas 16,983
(the live figure needs JavaScript and loads about 0.7 MB of data)
The readable edition of the Lean proof of the Riemann hypothesis among four sizes to one scale, and enlarged: a rectangle to a file by its lines of code, under the chapters of its own table of contents. Green: src/New, the set-up and the steps of the argument, numbered in its order; the name, its guide says, makes “no claim of novelty”. Wash: src/Lib, results it classes as known and missing from Mathlib. Outlined squares: sizes reported by a page of checks on 27 November 2026; those editions were not read here. The framed file is the one on the card. Click a chapter to open it.

Three fifths of the readable edition, 177,492 of its 299,902 lines of code, consists not of the new proof strategy itself, according to the project's own classification, but of background library material in Lib: results treated as standard in the literature yet absent from Mathlib, including parts of class field theory, Shimura varieties, and p-adic Hodge theory, written out with full proofs. The argument proper, in New, occupies 122,391 lines of code, of which the chapter stating the main theorem and reducing it to an analytic bound takes 3,527 lines, and the main inequality itself occupies a 65-line file.

Of the archive of 20 November the documents report this much. It has 175,187 files and 17,374,215 lines, of which 15,531,759 are code, and no comments.A. Sutherland, "Verification files for the shorter Lean proof of RH and of GRH for Dirichlet L-functions" (math.mit.edu/~drew/shortgrh, last updated 27 November 2026), Summary, which counts all three editions alike; RH and GRH are the Riemann hypothesis and its generalization. The sentence on unused statements is from M. Rubinstein, "An independent check of the Lean proof of RH and GRH" (mrubinst.github.io/grh-lean-verification, with a log that runs to 21 November 2026), the row on the dependency closure of the main theorem. One of those who built it traced what the main theorem rests on and found that "many statements in the 175,187 files are parallel or earlier formulations that it never uses". Its author's remark dates the work, in a timeline that it says Claude compiled, from 6 October to 16 November 2026, and explains why no paper came with the files.

This puts us in the rather extraordinary situation this age has made possible, in which I am presenting the world with a complete argument before having mastered a massive neighbourhood around its mathematics. It being obviously inappropriate to attempt to post some massive unreadable travesty of "slop"2, I decided to only present Lean.

—Levent Alpöge, remark of 20 November 2026. Untitled, four pages, alpo.ge/remark.pdf, page 2. Its footnote 2 begins "I of course amused myself, and hit 250, 000+ pages"; on 23 November its author wrote on X: "250,000+ pages was a joke guys!"

The de Bruijn factor divides the size of a formalization by the size of the paper proof it translates, so here the ratio has no denominator: there is no informal paper, because the Lean code came first and came alone. Only a mechanical checker makes that reversal credible: an author can present an argument traversing mathematical territory he has not personally mastered without weakening what the kernel certifies. What a certified artifact without an informal paper gives a human reader is the question of Section 14.

Without an underlying paper to measure against, the original archive can still be compared directly against its rewritten edition, subject to Remark 12.1.2.

Remark 12.5.1 (two counts, never mixed). One verification page measures both the original archive and the readable edition under both counting rules. Measured in non-blank, non-comment lines of code, the archive has 15,531,759 and the readable edition has 299,902, a ratio of 52 to 1. Measured in total lines including comments and blanks, they have 17,374,215 and 477,124, a ratio of 36 to 1. Quoting 17 million lines alongside 300,000 lines mixes total lines with code-only lines, turning two clean ratios into a comparison of unlike things.

The quotient does not say how one text became the other. The rewriting of 25 November is, in the words of the README at the root of its repository, "a shorter version, produced in collaboration with my colleagues at Anthropic, and Claude". The readable edition's own README opens: "The proof is Levent Alpöge's, with Claude. The Lean text and the documents in this project were written by Claude (AI)." It is a rewriting and not a compression: "It follows that proof's method; many steps are proved by other arguments, and parts of it, mostly background material, were ported from there and then rewritten." Its guide says how the two folders are sorted, and what their names do not claim.

  • Lib holds results classed as known in the literature and missing from Mathlib, with the steps of their proofs. It imports nothing from New. New holds the set-up, the steps of the argument, and known results stated on the data. This sorting is a working classification. The section "Relation to the literature" in a file's head gives sources or related work, and INDEX.md collects them. REFERENCES.md lists the citations and says which were compared with their sources.
  • Both folders use the namespace New. The exceptions are Statements.lean, Main.lean, and some lemmas and definitions in Mathlib's namespaces. The names of the folder and of the namespace make no claim of novelty. Sub-namespaces need not follow folders.

—Reading guide of the readable edition, "Conventions" (2026). GUIDE.md in the folder grh/ of github.com/lsernau/grh-lean (commit 72fead1, 25 November 2026), the first two items of its fourth section.

Lib does not hold these theories as a textbook would: by the same guide it "proves parts of several standard theories, often in a weaker form that suffices here and with its own definitions". Even so, its share repeats the lesson of the odd order theorem, whose libraries were almost 80 percent of the text. In a large formalization the theorem is the small part. What a model changes is who pays for the large part.

So far the edition has been counted. What its lines look like, and for whom they are written, takes reading some of them.

What a machine-written proof looks like

Here is a lemma of the readable edition with its whole proof: the step from the half-plane to the critical line. Its hypothesis h is the statement that no Dirichlet L-function vanishes to the right of the line, the pole excepted.

lemma New.zeros_on_line : DirichletLZerosOnLine := by
  intro N _ χ s h_pos h_lt h_zero
  have hs0 : 1 - s ≠ 1 := by aesop
  have hs1 : s ≠ 1 := by aesop
  -- A zero `s` that is not a pole of the gamma factor gives the zero `1 - s` of `L(·, χ⁻¹)`;
  -- the gamma factor has no pole in `0 < re s` (Mathlib gives it the value `0` at a pole).
  have h_gamma : χ.gammaFactor s ≠ 0 := by
    grind [gammaFactor, Gammaℝ_ne_zero_of_re_pos, add_re, one_re]
  have h_zero' : LFunction χ⁻¹ (1 - s) = 0 :=
    (gammaFactor_eq_zero_or_LFunction_one_sub_eq_zero χ s h_pos.ne' hs1 h_zero).resolve_left h_gamma
  -- Neither zero lies to the right of `1 / 2`.
  have h_le : s.re ≤ 1 / 2 := le_of_not_gt fun hlt ↦ h N χ s hlt (.inr hs1) h_zero
  have h_le' : (1 - s).re ≤ 1 / 2 := le_of_not_gt fun hlt ↦ h N χ⁻¹ (1 - s) hlt (.inr hs0) h_zero'
  rw [sub_re, one_re] at h_le'
  linarith

A number theorist can read this proof directly. Any nontrivial zero \(s\) in the critical strip yields, via the functional equation, a partner zero \(1 - s\) for the L-function of the inverse character \(\chi^{-1}\); if neither zero has real part strictly greater than \(\tfrac12\), then \(\operatorname{Re} s\) must equal \(\tfrac12\). The inline comments state those mathematical steps in human order, while automated tactics from Section 10 (aesop, grind, and linarith) construct the low-level kernel proof terms underneath each step. One comment highlights a total-function convention from Section 7.6: because every function in Lean must return a value at every input rather than remaining undefined, Mathlib defines the gamma factor to evaluate to the junk value 0 at its poles. Since the gamma factor never legitimately vanishes on \(\operatorname{Re} s > 0\), proving χ.gammaFactor s ≠ 0 is how the formal proof establishes that \(s\) is not a pole.

Every file in the edition opens with a header comment summarizing what the module proves and how its results relate to published mathematics; here the header notes, "Known result: the passage from the half-plane to the critical line by the functional equation." Comments account for more than a quarter of the edition's total lines (132,625 out of 477,124), and Lean checks none of them: they are unverified prose written by the model, though the edition's bibliography of 228 citations records which references were checked against original sources, confirming exact locations for 66 of them.

How heavily a large formalization leans on engineering shows clearest in a 77-line file, src/Lib/Speed.lean, that proves almost nothing mathematical. Across hundreds of imported modules, Lean's type-class synthesis (Section 9.4) and simp rewriter (Section 10.3) accumulate thousands of candidate rules, causing automated tactics to bog down on dead-end side goals. Speed.lean prunes that search space:

/-- A synonym of `IsEmpty` about which `simp` knows nothing. -/
def New.IsVoid : Sort* → Prop := IsEmpty

/-- Many `simp` lemmas have a hypothesis `[IsEmpty α]`. When instance search does not find it,
`simp` tries to prove it. This lemma ends the attempt at once. -/
@[simp 1001]
lemma New.isEmpty_iff_isVoid (α : Sort*) : IsEmpty α ↔ IsVoid α := .rfl

Above these closing lines, Speed.lean lowers the search priority of 84 type-class instances so Lean tries them last, and removes 64 rewrite rules from the default simp set. The trick shown at the bottom stops a common time sink: many library simp rules carry a side condition [IsEmpty α], and whenever instance search fails to find one, simp recursively tries to prove that α is empty. Registering isEmpty_iff_isVoid at high priority (@[simp 1001]) immediately rewrites IsEmpty α into the custom synonym New.IsVoid α, about which simp has no lemmas at all, terminating the fruitless search in one step.

None of this changes logical truth; all of it manages search cost, alongside a project build setting that raises Lean's per-command computation budget, maxHeartbeats, to 4,000,000, twenty times the default. As the reading guide notes of these adjustments, "They add no axiom", and when Speed.lean was emptied as a test, every file still compiled on an earlier release, Lean v4.33.1. Crucially, the guide explains why tuning priorities inside the proof cannot distort the main theorem statements: reprioritizing instances could in principle alter which algebraic instance an internal helper lemma picks up, "but not the five theorems: their types are constants of Mathlib and of Statements.lean, which does not import the settings". Isolating the trusted surface upstream keeps it immune to search-tuning hacks inside the proof.

The reading guide is equally candid about what Lean's elaboration conventions hide from human eyes: "Coercions hide routine maps" (the type casts Lean inserts silently, Section 9.5), and "Some data are classes, so statements do not name them", meaning assumptions like primality or ring structures travel invisibly inside implicit type-class brackets rather than appearing as named hypotheses. Helper lemmas in a repository like this are written to please the elaborator first and human readers second.

Source line counts can even move in the opposite direction from the size of the underlying proof object. The compact edition was "written to be short, not to be easy to read", shrinking the source to 76,149 lines of code, roughly a quarter of the readable edition. Yet its kernel export, the flat file of fully elaborated lambda terms that external verifiers check in Section 13, is actually larger: 5.17 gigabytes compared with 4.49 gigabytes, because "An export records fully elaborated proof terms, not source text."Sutherland's page of checks for the two shorter editions, paragraph "Export sizes". Apart from the declarations of Mathlib and of Lean's libraries that "appear in both exports", the remainder is, in the compact edition, "fewer declarations, but larger proof terms on average". The words on how the compact edition was written are from its own README. No Lean of that edition was read for this series. Packing more work into terse automated tactic calls shrinks .lean files while generating much bulkier low-level proof terms, illustrating at gigabyte scale the gap from Section 9 between surface syntax and kernel terms.

When models write formal proofs, three practical realities shift for mathematicians. First, source length stops measuring mathematical depth: nothing forces a model to be concise, and even in the readable edition, as its README notes, "Several hundred of the more than 20,000 declarations are not used by the five theorems: they state results for their own sake, or serve automation." Second, the scarce engineering resource shifts from writing Lean scripts to compiling and externally verifying multi-gigabyte developments. Third, the two tasks no checker can automate sit at opposite ends of the pipeline: specifying the right theorem at the start, and understanding the proof at the end. On the day of publication, the repository's root README summed up that second task in the sentence quoted on page one of this series: the project had passed machine checks only, and no mathematician had read the proof through (Section 14). The first task, stating a claim cleanly and driving the repair loop until every hole disappears, can be experienced firsthand in twenty lines of Lean.

In Lean

A standalone file with no imports, OddSum.lean, shows the entire statement-first workflow in miniature. It begins by defining a recursive function for the sum of the first \(n\) odd numbers, stating both the algebraic helper lemma and the main theorem with sorry as their proofs, and asking Lean 4.35.0 which axioms each declaration depends on.

/-- 1 + 3 + ... + (2n - 1), the sum of the first n odd numbers. -/
def oddSum : Nat → Nat
  | 0 => 0
  | n + 1 => oddSum n + (2 * n + 1)

/-- The step of the induction: n² + (2n + 1) = (n + 1)². -/
theorem square_step (n : Nat) : n * n + (2 * n + 1) = (n + 1) * (n + 1) := sorry

/-- The sum of the first n odd numbers is n². -/
theorem oddSum_eq_square (n : Nat) : oddSum n = n * n := sorry

#print axioms square_step
#print axioms oddSum_eq_square
OddSum.lean:7:8: warning: declaration uses `sorry`
OddSum.lean:10:8: warning: declaration uses `sorry`
'square_step' depends on axioms: [sorryAx]
'oddSum_eq_square' depends on axioms: [sorryAx]

Close the theorem first, from the lemma that is still a hole.

theorem oddSum_eq_square (n : Nat) : oddSum n = n * n := by
  induction n with
  | zero => rfl
  | succ n ih => rw [oddSum, ih, square_step]

Lean accepts the induction proof, drops one sorry warning, and leaves both #print axioms lines unchanged because oddSum_eq_square still depends on the unproved helper lemma. Now we fill in square_step. A first attempt tries rewriting (rw) with Mathlib's name for expanding a square (add_mul_self_eq, from Mathlib/Algebra/Ring/Defs.lean), forgetting that our standalone file imports nothing from Mathlib.

theorem square_step (n : Nat) : n * n + (2 * n + 1) = (n + 1) * (n + 1) := by
  rw [add_mul_self_eq]
  omega
OddSum.lean:8:6: error(lean.unknownIdentifier): Unknown identifier `add_mul_self_eq`
OddSum.lean:7:75: error: unsolved goals
n : Nat
⊢ n * n + (2 * n + 1) = (n + 1) * (n + 1)
'square_step' depends on axioms: [sorryAx]
'oddSum_eq_square' depends on axioms: [sorryAx]

Lean names the missing identifier and prints the remaining proof goal. Just as important, it does not abort at the broken lemma: it plugs square_step with a synthetic hole of its own, finishes checking oddSum_eq_square below it, and continues to report [sorryAx] for both. A second attempt deletes the rw line and hands the polynomial identity straight to omega, the linear-arithmetic decision procedure of Section 10.5.

OddSum.lean:8:2: error: omega could not prove the goal:
a possible counterexample may satisfy the constraints
  c ≥ 0
  b ≥ 0
  a ≥ 0
  a - b - 2*c ≥ 2
where
 a := ↑(n + 1) * ↑(n + 1)
 b := ↑n * ↑n
 c := ↑n
'square_step' depends on axioms: [sorryAx]
'oddSum_eq_square' depends on axioms: [sorryAx]

The counterexample diagnostic pinpoints why omega got stuck: because omega understands only linear inequalities, it treats the nonlinear products \((n+1)(n+1)\) and \(n \cdot n\) as two unrelated fresh variables \(a\) and \(b\), for which \(a - b - 2c \ge 2\) is easily satisfiable. Expanding the multiplication first with core-library distributivity lemmas turns the goal into linear arithmetic that omega closes immediately.

theorem square_step (n : Nat) : n * n + (2 * n + 1) = (n + 1) * (n + 1) := by
  rw [Nat.add_mul, Nat.mul_add]
  omega
'square_step' depends on axioms: [propext, Quot.sound]
'oddSum_eq_square' depends on axioms: [propext, Quot.sound]

Neither warning nor sorryAx remains: what stays under both declarations are two of the three standard axioms of Section 7, brought in by the proof terms that rw and omega construct. This is the loop of Section 12.4 at the size of one lemma: two refusals, each with a message that named the fault, and an acceptance that needs nobody's judgment. What Lean did not say is whether oddSum is the sum that was meant. For that, read the three lines of its definition.

An acceptance that needs nobody's judgment still rests on a kernel, on a list of axioms and on the build that made the terms. What it establishes, and how far each can be trusted, is the question of Section 13.

← Back to all posts