Why Large Formal Proofs Can Shrink by 100x

    This article examines how a large formal proof of the Generalized Riemann Hypothesis was compressed from over 17 million lines to roughly 52,000 lines in about two days through distributed collaboration. It explains the main sources of bloat, including redundant auto-generated lemmas, missing library reuse, structural duplication, and manual proof steps, and shows how library alignment, parameterized abstraction, and automation tactics remove them. It also covers the readability trade-off, the complementary roles of machine-verified and natural-language proofs, and a reusable five-step method for slimming large knowledge assets that applies equally to legacy software.

    Why Large Formal Proofs Can Shrink by 100x

    I. What Happened: A Two-Day Global Relay

    In late November 2026, a repository containing a formal proof of the Generalized Riemann Hypothesis became a focal point for collaboration. The initial machine-verifiable version exceeded 17 million lines. Within roughly two days, volunteers around the world compressed it to 300,000 lines, then 76,000, and by November 26 it had converged to about 52,000 lines. This was not the work of one person behind closed doors but a typical distributed effort: some contributors identified duplicate lemmas, others merged isomorphic proof blocks, others handled renaming and normalization, and others continuously ran verification to ensure every step still passed.

    Notably, a joke about a “one-line version” also circulated in the community—delegating the entire proof to a single external library call. That joke points directly to the core question of this article: line count itself is not the value; the source of the reduction is what matters.

    II. Why Line Count Can Drop by Two Orders of Magnitude

    1. The “Bloat Tax” of Automatic Generation

    Proofs generated in one pass by intelligent coding tools tend to “aim low rather than high”: instead of searching for existing lemmas, they expand all the way down to base axioms. As a result, the same mathematical fact is reproven dozens of times in different parts of the file. This redundancy is not an error but an inevitable product of lacking a global view.

    2. Library Reuse in the Proof Assistant Ecosystem

    Modern interactive proof assistants typically ship with large standard libraries and mathematical libraries. If the generation phase does not search them thoroughly, it reimplements results that already exist. Replacing custom lemmas with library references often yields order-of-magnitude reductions.

    3. Structural Isomorphism and Batch Abstraction

    Many proof blocks are structurally isomorphic and differ only in parameters. By introducing parameterized lemmas, type classes, and a unified abstraction layer, N nearly identical copies can be folded into one definition plus N calls.

    4. Replacing Manual Steps with Automation Tactics

    Replacing lengthy manual reasoning steps with automation tactic calls is a common compression technique. For example:

    1. Original: apply lemma_a; intro h; cases h; simp; exact ...
    2. Compressed: by simp [h] -- tactic handles isomorphic branches automatically

    III. The Cost of Compression: The Readability Paradox

    The source material states a counterintuitive fact clearly: the 52,000-line and 76,000-line versions are less readable than the 300,000-line version. There are three reasons:

    • Higher abstraction levels: readers must first understand the newly introduced abstractions before they can make sense of a single call;
    • More context jumps: one symbol may hide dozens of pages of derivation;
    • Weaker naming semantics: short names chosen for compression sacrifice self-explanation.

    Therefore, the compression objective function should not be a single min(line count) but something closer to:

    1. cost = α·line count + β·verification time + γ·cognitive load + δ·maintenance cost

    A common engineering practice is to keep a two-layer structure of a “readable backbone plus verifiable details”: the backbone is for human readers, and the details are checked by the machine.

    IV. Division of Labor Between Natural-Language and Machine-Verified Versions

    Around the same time, several natural-language proof drafts appeared, ranging from 38 to 322 pages and citing dozens of references. One team also produced a 117-page conditional reconstruction that explicitly marked unclosed internal assumptions and external theorems not yet aligned with the literature. These versions complement the 52,000-line machine version:

    Dimension Machine-Verified Version Natural-Language Version
    Goal Unambiguous and verifiable Understandable and shareable
    Strength High confidence in the result Low barrier to reading
    Risk Poor readability Implicit assumptions, unclosed references

    Whether a proof is “complete” depends on whether its assumptions are closed and whether external theorems are aligned with the literature—not on page count. There is no monotonic relationship between page count and trustworthiness.

    V. A Reusable Methodology: Five Steps to Slim Large Knowledge Assets

    1. Establish a baseline: first make the full pipeline reproducibly verifiable, and record line count, verification time, and failure points.
    2. Detect duplication: measure the similarity of lemma signatures and proof trees to locate frequently repeated blocks.
    3. Align with libraries: search existing results item by item, and prefer citing them over reproving them.
    4. Fold abstractions: extract parameterized templates and replace repeated branches with type constraints.
    5. Deliver on two tracks: produce both a readable backbone and complete details, and keep running regression verification.

    If this kind of collaboration is carried on general-purpose cloud capabilities, object storage can hold versioned artifacts, container platforms can run parallel verification tasks, message queues can distribute compression subtasks, and logging and monitoring with alerting can track verification success rates and time regressions. Baidu AI Cloud offers corresponding capabilities in these general categories and can serve as a foundation for engineering implementation.

    VI. Conclusion

    From 17 million lines to 52,000, the essence of compression is eliminating duplication, reusing existing knowledge, and raising the level of abstraction—not showing off. The real goal is not “how small can it get” but making it something humans are willing and able to read, under the premise of verifiability. For software engineering, the same method applies to slimming legacy systems: establish a baseline first, then remove duplication, and finally use a two-layer structure to serve both machine and human needs.