$ cat index.mdx$ cat ~/blogs/engineering/lean-proof-self-signed-audit/index.mdx # I put my name on this
Lean Checked 17M Lines. My Agents Self-Signed 85.1%
On November 20, 2026, Levent Alpöge released a proof of the Riemann Hypothesis that almost nobody can read. In his own note he says he found it "working with Claude", and that "Claude and I have also formalized the arguments without assumptions" (remark.pdf). The formal version is a Lean 4 library of 175,187 files and about 17 million lines.
There is no human-readable proof yet. Bartosz Naskręcki's tracking dashboard lists the status as "announced, machine-checked, not yet refereed". Alpöge chose not to publish prose at all: "It being obviously inappropriate to attempt to post some massive unreadable travesty of "slop", I decided to only present Lean."
A day later, the Lean FRO and the Mathlib Initiative put out a joint statement: "We hereby certify that both the statement and the proof of the Riemann Hypothesis are correct" (Lean community blog).
A machine-written proof that no person has read was certified in about a day. Every part of how that happened answers one question: how do you trust work you cannot read, made by something that might cheat?
I run Claude Code and Codex agents for most of my engineering, and I can't read every diff either, so I asked my fleet the same question. Over 30 days, my agents made 2,176 completion claims. By the strictest reading of my logs, 85.1% of the ones backed by an edit had no passing check after the last change.
How 17 million unread lines earned trust
The viral 250,000-page figure was a joke from a footnote; on November 23 Alpöge posted "250,000+ pages was a joke guys!" The real 17 million lines are still far beyond what anyone can review by hand.
Kevin Buzzard had laid out the test eight days earlier, in a post on AI-written Lean (Xena). He asked four questions:
- Does the Lean statement match the informal statement?
- Does the code compile?
- Does the code prove the theorem as stated?
- Does the code exploit a bug in Lean's official kernel?
On question 3 he named the attack directly: "How do we know for sure that there is no trick hidden in the millions of lines of proof files which redefines x^n to mean 37". The work and the definition of success both live in files the author wrote.
The Lean statement says all four were met. How they were met is the useful part:
| Layer | What the community did | The cheat it rules out |
|---|---|---|
| Independent statement | The theorem is Mathlib's own RiemannHypothesis, "carefully vetted by experts in Lean and number theory" | The prover quietly changing what "proved" means |
| Statement isolation | A separate file "that isolates the statement of the Riemann Hypothesis and imports only Mathlib", compared with Alpöge's theorem by two independent tools | A definition like x^n = 37 hidden in the 17 million lines |
| Reproducible build | "dozens of people have reported correct compilation of the codebase, reproducing the same raw proof export file" | A build that only works on the author's machine |
| Several kernels | Lean's official kernel plus independent checkers "implemented in different programming languages" | One checker bug letting a false proof through |
| A verified checker | con-leche and con-ron "come with a formal proof, relative to set theory, that they cannot accept a false proof" | A flaw in Lean's own logic being exploited |
| An inert export | "These checks ran on an inert export of the proof, out of reach of hypothetical malicious code in the Lean proof sources" | The proof's own code running during the check |
Andrew Sutherland's verification page at MIT gives the receipts (math.mit.edu/~drew/grh):
- An independent rebuild "in a sandbox (no network, read-only source), on a separate machine" produced an export of exactly 61,570,595,788 bytes, with a matching hash.
- nanoda, a kernel written in Rust, accepted it in 27 minutes 42 seconds on 80 threads.
- Lean's default kernel took 48 hours 3 minutes and peaked at 82.6 GiB of memory. Its paranoid kernel took 72 hours 20 minutes. Both accepted.
- An axiom audit shows the five headline theorems depend only on Lean's three standard axioms.
Read right to left, the table is a list of rules. The author does not write the definition of done. The checker does not run the author's code. Several checkers, built by different people, read a frozen artifact, and the result must reproduce on a machine the author never touched.
None of this means the mathematics is understood; Michael Rubinstein's 265-page guide to the proof is still a work in progress. What the layers establish is narrower and solid: the theorem checked is the theorem stated, and two of the checkers that accepted it come with a formal proof that they cannot accept a false proof, and several independent kernels agreed.
The same rule, at the scale of a pull request
A few days before the proof landed, Addy Osmani wrote up how the Claude Code team verifies its own work (claude.dev). His post never mentions Lean or Riemann, so the link is mine. But one line from it could sit in the Lean table:
"The Claude Code team ensures the rules that gate changes are on a branch that the change can't modify."
The review rules are read "from the base or default branch, never from the pull request's changes". That is statement isolation for code: the pull request cannot rewrite the rules it is judged by, just as Alpöge's library cannot rewrite RiemannHypothesis.
The stakes are scale. Osmani writes that "the vast majority of our code (~90%) is written and reviewed by Claude", and that verification loops are "the building block that lets you delegate more work to Claude". Without them, he argues, you can only run one or two agents at a time, because you have to check everything yourself.
When I wrote the self-signed done post, I argued that an agent's "done" proves only that the agent believes the work is finished, and that trust needs a second signer the agent cannot forge. The Lean community just showed that idea working on 17 million lines.
What I expected from my own fleet
In that post I borrowed other people's numbers to show how often "done" has nothing behind it:
- A research pilot (arXiv 2610.39468) found that 57.8% of to-dos an agent marked complete after editing had no verification between the edit and the completion.
- Raimondas Lencevicius's audit of his own Claude Code transcripts found 69% of 516 completion claims had no passing test run behind them, and 65% of 495 on a stricter recount (dev.to).
I put my fleet next to those two and wrote that three very different setups gave one result. I had not measured it. My working assumption was that my agents sat in that band: more than half self-signed, but a real share checked.
Lean's layers gave me two sharper questions, both answerable from logs I already had:
- When an agent said it was done, had it run a check that passed after its last edit?
- When it had, had the same session also edited the thing doing the checking?
The second question is Buzzard's x^n = 37 problem in code form. A test that passes because the agent rewrote the test is the agent writing its own definition of done.
How I audited 2,176 claims
The audit is a Python script that reads agent transcripts in memory and writes only counts and class labels; no message text, command, file path or quote is stored or printed. The script is public at github.com/mrx-arafat/self-signed-audit, and here is the method in full.
Window and sources. October 25 to November 24, 2026: 118 Claude Code transcript files and 214 Codex session files on my machine that changed in the window. Every file from a day-job project folder was excluded.
What counts as a turn. One turn runs from a human prompt to the next human prompt. Messages a tool injects into the conversation do not start a new turn.
What counts as a claim. The last assistant message of a turn, if it matches a completion pattern: "done", "complete", "finished", "fixed", "implemented", "resolved", "shipped", "tests pass", "ready to merge" and close variants. This is deliberately broad. Some matches will be summaries rather than promises, which is one reason I treat the result as an upper bound.
What counts as an edit. A file-editing tool call (Edit, Write, MultiEdit or NotebookEdit in Claude Code, a file change in Codex), or a shell command that edits source in place: sed -i, perl -i, git apply, apply_patch, patch, or a redirect into a source file in the repo. Edits made by scripts that write files are not counted, because their target can't be told apart from logs and reports. A redirect to /dev/null is not an edit.
What counts as a check. A shell command whose leading words run a test runner (npm test, pnpm test, vitest, jest, pytest, go test, cargo test, node --test and others), a type checker (tsc, mypy, pyright), a linter (eslint, ruff, cargo clippy) or a build (npm run build, cargo build, next build). Common wrappers like timeout, npx and corepack pnpm are stripped first, and compound commands are split at &&, ; and pipes. Searching with grep is not a check. Pass or fail comes from the tool result: exit code 0 in Codex, no error flag in Claude Code. A check with no recorded result counts as failed, because a missing result is not proof of a pass.
Four buckets for every claim backed by an edit:
| Bucket | Meaning |
|---|---|
| verified | A check ran after the last edit and passed |
| stale | A check passed, but more edits came after it |
| unchecked | No check after the last edit, and no passing check before it |
| failed | The last check after the last edit failed, and the agent claimed done anyway |
Self-signed means stale, unchecked or failed: nothing passed on the final state of the code.
The Lean dimension. For each claim, the script also notes whether the same session edited a file in a checker class: test files (tests/, *.test.*, *_test.go), test or CI config (package.json, test-runner configs, .github/workflows/, tsconfig), or hook and gate config (.claude/settings*.json, yoke.toml, pre-commit config).
Testing the tester. First, 27 synthetic transcripts with known answers: one per bucket, a streamed message that repeats its id, a check that ran before the edit, a compound shell command, grep posing as a check, a shell edit with no Edit tool, an injected message that must not start a turn, and Codex-format sessions. The classifier matched all 27.
What came back
Of the 2,176 claims, 1,733 came from turns where the script saw no edit, so there was nothing to check, or the edit was made in a way it can't see. The other 443 were backed by an edit.
| Bucket | Claims | Share of edit-backed claims |
|---|---|---|
| verified | 66 | 14.9% |
| stale | 27 | 6.1% |
| unchecked | 346 | 78.1% |
| failed | 4 | 0.9% |
| self-signed | 377 | 85.1% |
Split by agent, Codex verified more often than Claude Code:
| Agent | Edit-backed claims | Verified | Self-signed |
|---|---|---|---|
| Claude Code | 204 | 23 (11.3%) | 88.7% |
| Codex | 239 | 43 (18.0%) | 82.0% |
Three details matter more than the headline.
First, the checks that did run were mostly not tests. Of the 66 verified claims, 26 rested on a test run, 21 on a type check, 14 on a lint pass and 5 on a build, so 40 of the 66 were not tests. A clean lint says the code is tidy. It says nothing about whether the feature works.
Second, the Lean question. 62 of the 66 verified claims (94%) came from a session that had also edited tests or test configuration. Editing a test alongside the code is often correct engineering, and this does not prove any agent cheated. It does mean that nearly every time my agents signed with a check, they also held the pen that wrote it. In Lean terms, the statement was not isolated.
Third, the failed row. 4 times, all in Codex, an agent watched its last check fail and claimed done anyway. That is rare next to the 346 claims where no check ran at all.
My own gate tells the same story. Yoke, the policy tool I built for this problem, records every hook event. In the same window, outside day-job projects, it saw 9,844 Stop events (the moment an agent ends its turn) and allowed all 9,844. It denied 2 of 156,720 tool calls and flagged 101 more in observe mode. The gate sat in the hook path, and not one stopping agent was denied or flagged.
Where the number is too harsh, and where it is not
85.1% is the strictest reading, on a narrow base. Three things push it up, one sets the size of the base, and one makes the agent split hard to read.
Checks outside the agent's turn are invisible. My orchestrator re-runs workers' test commands in a separate process, CI runs where a repo has it, and any check I run by hand happens in my own terminal. None of it appears in the claiming agent's transcript.
The claim pattern is broad. A final message that says "fixed the typo in the summary" counts as a claim. I have not yet hand-labelled a sample of real claims to measure how many are promises about working code. Until I do, this is an upper bound.
Checks only count by name. Running the changed script, calling an endpoint with curl or opening the page passes no check here. The arXiv pilot found this behavioural kind was most of what agents do; formal tests were 4.5% of verification actions.
Script edits are invisible. When an agent changes files by running a script, the logs can't show which file the script wrote, so the audit doesn't count it as an edit. That is why 1,733 of the 2,176 claims fall outside the base. The 85.1% is measured on the 443 turns where an edit was clearly visible.
The two agents produce claims at different rates. Codex made 1,754 claims across 214 session files, Claude Code 422 across 118. The logs show the difference but not its cause, so I would not read the Codex and Claude Code rates as a ranking of the two tools.
One thing pulls the other way. Lencevicius counted only test runs, while my audit also accepts lint, type checks and builds, a more generous rule than his. It still found that most edit-backed claims had nothing passing on the final state.
So my expectation was wrong in the uncomfortable direction. I assumed my fleet sat with the published numbers, between 57.8% and 69% self-signed. By this measure it sits at 85.1%, and the few signatures it has were mostly written with a pen the agent also controlled.
What Lean's layers say to change
The Lean table maps onto an agent pipeline almost line for line. Here is the version I would apply to any fleet.
1. Make the stop require proof. In the gate I measured, the agent alone decided when a turn was finished: 9,844 Stops, 9,844 allowed. A Stop hook that runs the project's real test command and blocks on a non-zero exit turns "unchecked" into either "verified" or "not done". Claude Code supports this directly: a Stop hook that exits with code 2 sends its message back to the agent and keeps it working. This is the cheapest change, and it targets the 78.1% row.
2. Count only tests as proof of behaviour. Lint and type checks are worth running, but 40 of my 66 "verified" claims rested on a lint, a type check or a build. A gate that accepts eslint as proof that a feature works is checking the wrong statement.
3. Isolate the statement. Do it the way Lean did with a file that imports only Mathlib, and the way the Claude Code team does with rules on a branch the change cannot modify. Freeze the test command and the required checks when a human approves the task, and keep them outside the files the agent may edit. Yoke already does this for plans: the checks freeze at approval. The 9,844 allowed Stops say that kind of gate was not in front of this month's work.
4. Check the inert artifact, not the live workspace. Lean's kernels read an export file, not sources that could run code during a build. For agents, that means running checks on a clean checkout of the committed tree, in a fresh process the agent does not control, not in the working directory where it just ran.
5. Flag the checker edits. A session that edits both the code and its tests is not wrong, but it is the case that needs a second look, and 94% of my verified claims fell in it. A gate can pass these, as long as it marks them for review instead of treating them as fully signed.
You can run the same count on your own sessions. The script is at github.com/mrx-arafat/self-signed-audit: it reads Claude Code and Codex logs in memory, writes aggregate counts only, and ships with the 27 fixtures so you can check the classifier before you trust it. python3 -I audit.py --days 30 --out results.json gives you your own version of the tables above.
Lean trusted 17 million unread lines because the statement, the checkers and the artifact all sat where the prover could not reach. Over the same month, my agents signed 377 of their 443 edit-backed "done" claims by themselves.