HomeArticle

Just now, the code for proving the Riemann Hypothesis has been drastically reduced by 99.5%! Only 76,000 lines remain.

量子位2026-11-26 09:51
Claude did it again.

Only 76,000 lines left!!

Just now, the 17.4 million-line Riemann Hypothesis proof that went viral across the entire internet has ushered in an epic-level massive slimming down.

The total code volume has been cut by a staggering 99.56%.

The original proof, consisting of 175,188 files, took a full 21 hours to compile on a high-spec AWS machine;

But the new version now only requires an ordinary machine with 12 cores and 24GB RAM, and can be fully built from scratch in 1 to 2 hours with existing Mathlib caches.

It's saved! It's totally saved!!

Then I checked the repository author —

How is this done by Anthropic again??

Hi everyone, over the past few days I have been working full steam ahead with several colleagues at Anthropic to develop this streamlined version of the proof. We have successfully reduced its length by roughly two orders of magnitude, from around 15 million lines to approximately 76,000 lines.

The person behind this effort is Luke Sernau, a researcher at Anthropic, and this streamlining was completed jointly by him, his colleagues and Claude.

Slimming Down Seemed Unrealizable

A few days ago, mathematician Levent Alpöge collaborated with Anthropic's AI model Claude to release a 17.4 million-line formal proof of the Riemann Hypothesis (RH) and Generalized Riemann Hypothesis (GRH) written in the Lean language, which is 7 times the size of Lean's official mathematical library (Mathlib) and shocked the entire mathematics and AI communities.

But the problem is, this huge proof that reads like a cryptic tome has more than 175,000 files, and only one of them contains comments.

The first reaction of the community was to try to understand and verify it. A GitHub project named rh-trim was quickly established, with the goal of checking, mapping and shrinking this huge proof.

The results showed that multiple independent kernels including Tenet written in C#, nanoda written in Rust, and tenet-jvm written in Java all successfully processed the entire proof, and further analysis revealed its internal structure:

The vast majority of the content is foundational work. The final argument only requires 6.6% of the entire proof. The rest of the parts are building the tools it needs, many of which are mature mathematical theories that have never existed in the Lean mathematical library.

However, when the community tried to "lose weight" for it, they encountered difficulties. After deleting all "dead code" that was not referenced by the final theorem through automated tools, the rh-trim project found that the maximum reduction in code volume was only about 8%, and this reduced version never compiled successfully.

Everyone was almost desperate at one point: it was impossible to clean up all the redundant content just by code cleanup.

But now, the center of the storm — Anthropic — has personally stepped in to refactor this huge mountain of code.

Drastically Cut Down the Riemann Hypothesis Proof

While hundreds of contributors in the community were working tirelessly to fix the issues left by Claude, grh-lean was officially released.

It carried out a complete rewrite and refactoring of Alpöge's original proof, and released two versions at one go.

Readable Version (grh/)

It has a clearer structure, a large number of human-readable documents and navigation guides, with about 300,000 lines of code (477,000 lines in total) distributed in 801 files.

Compact Version (grh-compact/)

It is written specifically for the minimum code volume, with only about 76,000 lines of pure code (about 95,000 non-empty lines including comments, 113,000 lines in total) distributed in 792 files.

What does 76,000 lines mean?

If converted roughly according to the ratio of "14.7 million lines corresponding to 250,000 pages of papers" in the original version, the 76,000-line compact version means that a human-readable mathematical argument of less than 1300 pages is close at hand.

The entire proof process does not use any sorry (the placeholder for unfinished proof in Lean), and only relies on the three most standard axioms of Lean: propext, Classical.choice and Quot.sound.

After compilation, the team not only replayed all modules with Lean's own kernel, but also used the official verification tool Comparator (v4.35.0) and multiple independent checkers such as nanoda, con-leche, con-ron for cross-validation, and all of them passed smoothly.

According to the disclosure of the project README, all the Lean code and documents of this project are written by Claude (AI), and human researchers and Anthropic colleagues are mainly responsible for providing directions and suggestions.

It's amazing that Anthropic has taken care of both the proof generation and the digestion work completely 😭.

The most frustrated group are those developers who are using AI to try to streamline the proof at home. A netizen named jychang vented his frustration in the comment area:

I have completed about 70% of the proof, which currently has 35,000 lines of Lean code. But Anthropic took a step ahead of me.

Why? Because I can't access Claude, I can only use GPT-6.2 Sol 😭.

I did all the work entirely with GPT-6.2 Sol, using the $100 ChatGPT subscription plan, and only used one Agent, no sub-Agents, because sub-Agents consume too much of the weekly quota.

But Anthropic engineers, who have massive quotas, fast mode access, and can create any number of sub-Agents freely, got ahead of me.

Well, it's really helpless.

The outside community spent so much time and resources, but only made tiny progress in reduction every time; while Anthropic only needs to approve a budget expenditure to achieve such results...

It is worth mentioning that, different from Alpöge's original version which did not provide a license, grh-lean is open sourced under the Apache 2.0 license.

This means that the community can now freely use, modify and distribute this formal proof text, which is the most important proof related to the Riemann Hypothesis so far.

However, the author also specially emphasized that the current version of the proof has only passed machine verification, no mathematician has read through it completely, and there is no supporting mathematical paper yet.

Methodology Fully Disclosed

So, how on earth did they achieve the compression from 17.4 million lines to 76,000 lines?

Facing the curiosity of the community, the author Luke Sernau briefly revealed the trick:

Unfortunately I can't reveal too much about the specific method, but I got a very long, flattened proof by unrolling all definitions, looked for places that could be simplified in it, and then rolled them back up for packaging, which achieved good results.

In this way, I can perform simplification across module boundaries. However, some parts do require completely different new arguments, such as completely removing the parts related to the Vandiver conjecture.

Simply put, it is "flatten first, eliminate redundancies across boundaries, then encapsulate", plus "partial replacement of core logic".

In the original more than 170,000 files, a large number of theorems and definitions are nested in different layers of modules. If you only prune by file, both AI and humans will be blocked by the module boundaries.

The method adopted by Sernau and Claude is to first unroll all these wrapped definitions into a long and flat derivation chain, so that redundant steps that were originally separated by several files are directly exposed, realizing cross-border merging and simplification, and then re-abstract and encapsulate at last.

In addition, it is "taking shortcuts" on the mathematical path.

Just like what Sernau mentioned about "removing Vandiver", for some overly cumbersome or detoured mathematical sub-steps in the original version, the new version directly adopts a completely different new argument method, and a lot of background materials are also completely rewritten after being transplanted from the original version.

Who Is Luke Sernau?

Luke Sernau, the leader of this epic streamlining work, is a researcher at Anthropic.

Public information shows that before joining Anthropic, Sernau worked as a senior software engineer and researcher at Google and Google DeepMind.

Interestingly, he is exactly the author of the famous 2023 internal Google leaked document We Have No Moat, And Neither Does OpenAI.

In that document, Sernau pointed out that the real competition comes from the open source community, and open source models will iterate at an extremely fast speed and lower cost, and eventually catch up with or even surpass large closed source models in capabilities.

Sernau studied in the Department of Mathematics at the University of Notre Dame for his undergraduate degree.

After graduation, he worked at Facebook (Meta) for four years (2014–2018), during which he led the Facebook Seattle intern program and conducted more than 200 technical interviews, and later founded the programmer education institution BetterEngineering.org.

In 2019, Sernau joined Google as a senior software engineer, and since 2024 he has served as a Staff Researcher at Google DeepMind, leading multiple AI research teams, with research directions spanning large model Scaling Laws.

In August 2025, Sernau left Google and officially joined Anthropic one month later.

Now, he has also delivered an important answer sheet at Anthropic —

The 17.4 million-line cryptic tome has been cut down to 76,000 lines, and a clear version with 300,000 lines of reading guides is also provided.

The ball has been kicked back to the feet of human mathematicians.

(ps: Hey, could Teacher Deng Yu try to read it now 👀)

GitHub: https://github.com/lsernau/grh-lean 

Click "Like", "Share" and "Favorite" in one click

Welcome to leave your thoughts in the comment area!

— THE END —

Jay from QbitAI | Official WeChat Account QbitAI