The Scale–Readability Trade-Off in Compressing Formal Proofs

    As formalized mathematics grows to tens of millions of lines, the main challenge is often no longer whether a machine can check the proof, but whether people can understand its claims, verify that its dependencies are complete, and determine whether compression has merely moved complexity into external libraries. This article examines how proof size is reduced, why shorter formalizations can be harder to read, which metrics should replace raw line counts, and how teams can compress large proofs without weakening their trust boundaries.

    When large-scale formal mathematics reaches the “tens of millions of lines” range, the primary bottleneck is often no longer whether a machine can finish checking the proof. The harder questions are whether humans can understand what the proof claims, whether its dependencies are complete, and whether each reduction in size has simply hidden complexity inside an external library.

    Recent public discussions around formalized material related to the generalized Riemann hypothesis provide representative figures: a text of more than 17 million lines was reduced to roughly 300,000 lines, then approximately 76,000 lines, and later around 52,000 lines. At the same time, natural-language counterparts ranged from several hundred pages to several dozen pages. The shorter formalizations were reportedly harder to read.

    This should be treated as an engineering problem, not as a ranking in which fewer lines automatically means greater progress.

    1. Identify What Is Actually Being Compressed

    The “line count” of a formal proof usually combines at least four different kinds of text.

    The first is the problem statement and final theorem. This layer should be short, stable, and independently referenceable.

    The second is the proof body that connects axioms or foundational libraries to the theorem. It includes lemmas, inductions, estimates, and constructions.

    The third is automation code: tactics, rewrite rules, and search hints. These may allow the checker to accept a proof, but they do not necessarily explain the reasoning to a reader.

    The fourth is the dependency closure: general lemmas, analysis tools, and algebraic structures imported to make the proof check. Counting the entire closure inflates the apparent size through infrastructure. Counting only the handwritten layer understates the actual trusted computation.

    Before claiming that a proof can be “cut in half again,” teams must publish their counting rules:

    • Are comments and blank lines included?
    • Are generated files included?
    • Is the foundational library included?
    • Do external calls count as lines?
    • Are generated certificates counted separately?

    Without a clear definition, comparisons have little engineering value. A “one-line proof” that delegates everything to an external library usually moves the dependency closure beyond the call boundary. If that library is not checked by the same trusted kernel, or if its version and axioms are not frozen, the result is not compression. It is a transfer of proof obligations.

    2. Common Mechanisms for Reducing Line Count

    Without assuming any particular prover interface, the following techniques are broadly reusable.

    Extract Repeated Structures

    If the same estimate, sum interchange, or analytic continuation step is expanded in multiple places, promote it to a named lemma and document its assumptions. The reduction comes from reuse, not from deleting reasoning.

    Raise the Level of Abstraction

    A proof that calculates a specific function term by term can sometimes be rewritten for a class of objects satisfying a defined set of axioms. Once the abstraction is correct, later theorems become shorter.

    However, an abstraction that is too broad can make a proof harder to read. Readers may have to jump repeatedly between a generic theorem and the conditions required for a particular instantiation.

    Separate Computation from Argument

    Pure computation, numerical inequality bounds, and finite case enumeration are often suitable for replayable computational certificates. The proof text can then retain the proposition asserted by the certificate and explain how it connects to the main argument.

    The certificate must remain reproducible. A statement such as “verified by a program” is not a substitute for a checkable artifact.

    Constrain Automation

    Tactics can eliminate many obvious steps, but search depth and rewrite scope should be limited. Key points should retain human-readable intermediate propositions.

    Otherwise, the checker may accept the proof while reviewers cannot determine which estimate contains the substantive contribution.

    Remove Dead Branches and Historical Compatibility Layers

    Collaborative formalization projects often accumulate lemmas that were once useful but are no longer referenced. Dependency analysis should run regularly, but removal requires checking that the lemma is not independently cited by natural-language documentation or external notes.

    These techniques help explain reductions from tens of millions of lines to hundreds of thousands and then to tens of thousands. The first stage often removes duplication, generated redundancy, and unstable dependencies. Later stages may begin folding away local expansions that readers need in order to understand the proof.

    The scale alone is only an observation. It cannot replace an independent mathematical review of correctness.

    3. Why Shorter Proofs Are Often Harder to Read

    Poor readability is usually not caused by fewer blank lines. It is caused by moving information into the reader’s working memory.

    Folded Lemmas Have Larger Cognitive Preconditions

    A five-line theorem application may require the reader to remember ten invariants. The call site looks clean, but the cost reappears as context switching.

    Names Lose Mathematical Intuition

    To make a proof generic, identifiers may become abstract symbols. Domain landmarks such as zero-density estimates or mean-value bounds disappear. Reviewers then lose the intuition that helps them locate the most likely sources of error.

    Automation Hides the Proof’s Shape

    In a longer version, the structure may be visible: simplify first, derive an estimate next, then handle exceptional cases. After aggressive compression, only a combination of tactics remains. When the proof fails, it becomes difficult to isolate the failing step.

    Natural-Language Documentation and Formal Text Drift Apart

    A several-hundred-page explanation may be useful for teaching when it follows the proof tree step by step. A several-dozen-page version may be better as an overview, but it can omit exactly the boundary conditions that are most fragile in the formal proof.

    Both versions should coexist:

    • The long document provides teachable, step-by-step reasoning.
    • The short document provides a structural map.
    • The formalization provides the final machine-checkable obligations.

    If the explanatory material is shortened without updating its correspondence to the formal proof, readers may follow one story while the machine checks another object.

    Compression should therefore be treated as a multi-objective optimization problem, not as a search for the minimum line count. Under a fixed trusted kernel and fixed dependency versions, the goal should be to reduce the length of the auditable path while preserving the independent readability of key lemmas.

    4. Metrics That Matter More Than Line Count

    Teams should track several metrics together and include them in the change notes for each compression pass.

    Size

    Track:

    • Lines in the proof body
    • Lines in the dependency closure
    • The proportion of generated content
    • The proportion of repeated lemmas

    If the main body shrinks while the dependency closure grows, explain that change separately.

    Structure

    Track the depth and width of the theorem dependency graph, the maximum in-degree of individual lemmas, and the number of human-written lemmas on critical paths.

    A sudden increase in graph depth often indicates reduced readability.

    Checkability

    Track:

    • Full-check time
    • Incremental-check time
    • Failure-localization granularity

    A longer check may indicate that tactic search has replaced explicit proof steps.

    Reproducibility

    Each milestone should correspond to a natural-language statement. Reviewers who were not involved in compression should be able to select key lemmas at random and explain their assumptions and conclusions within a reasonable amount of time.

    Stability

    Freeze the versions of the axioms and foundational libraries. Verify that compression has not changed the logical strength of the theorem statement.

    The proof may become shorter, but the conclusion must not silently become stronger or its assumptions weaker.

    Trust Boundaries

    Identify any result that is not checked by the same kernel. If such a result is introduced, label it as an assumption rather than as a proved step.

    5. A Workflow for Collaborative Compression

    Compression of a very large proof works best as a repeated “freeze, extract, regress, and compare” cycle rather than as continuous manual deletion.

    Freeze the Statement

    Treat the final theorem, critical definitions, and permitted axioms as stable interfaces. Later compression should modify only the proof. Any interface change should receive separate review and require a full comparison of the documentation and formalization.

    Assign Ownership

    Divide the project by mathematical topic, such as analytic continuation, functional equations, explicit formulas, zero estimates, and error terms.

    Each module should have an owner. Cross-module lemmas should be added to a shared library before they are referenced. This prevents multiple contributors from independently implementing nearly identical estimates.

    Measure Before Compressing

    Keep minimal independently checkable examples for important lemmas, including special cases, numerical boundaries, and directions in which the proof previously failed.

    These examples are not proofs, but they help prevent interface damage during refactoring. They must continue to pass after compression.

    Record Why Content Was Removed

    Each large deletion should state whether it resulted from deduplication, abstraction, moving computation into a certificate, or reliance on a stronger library lemma.

    Unexplained deletions should be treated as risk.

    Maintain Two Documentation Tracks

    The formal text is the authority; natural language is the navigation layer. Whenever the line count changes substantially, update the correspondence:

    • Which section maps to which group of lemmas?
    • Which steps have been absorbed by automation?
    • Which steps remain the human-written core?

    The short documentation should explicitly state what it omits rather than suggesting that those steps never existed.

    Separate Review Cadences

    Compression review and mathematical-correctness review should be separate activities. The first focuses on structure and dependencies; the second checks whether analytical estimates have been faithfully formalized.

    When both are combined into one review, line-count improvements can overshadow substantive mathematical concerns.

    6. Practices for Companies and Research Teams

    The same issues arise in large formalizations and high-reliability specifications outside number theory. Generative tools can quickly produce very large proofs or specifications, but the resulting maintenance and audit costs remain.

    Treat Generated Output as a Draft

    Before generated material enters the main branch, apply dependency deduplication and freeze its interfaces. Otherwise, every regeneration may create parallel proofs that are difficult to merge.

    Set an Automation Budget

    Automation may handle equalities and obvious inequalities, while core estimates are required to retain explicit intermediate propositions.

    Making this a team rule prevents personal preferences from producing inconsistent proof styles.

    Treat External One-Line Calls as Red Flags

    Any change that delegates an entire argument to an unversioned external library should be rejected by default until the library’s theorem boundaries, axioms, and checking commands are documented.

    Version Certificates and Long-Form Documentation

    Storage and collaboration systems need only general capabilities:

    • Immutable versions
    • Difference comparison
    • Permission isolation
    • Build logs

    Readability should not depend on a proprietary format. More important is that the same commit contain the formal change, the natural-language change, and the checking logs, with their versions or hashes aligned.

    Define Exit Criteria

    For example:

    • The main proof body falls by the planned proportion.
    • The number of human-written lemmas on critical paths does not increase.
    • Full checking remains within the agreed time budget.
    • An independent reader can use the short documentation to locate the corresponding reasoning in the long version.

    If these criteria are not met, stop reducing line count and restore the explanations that were folded away.

    7. A Realistic Expectation for the Lower Bound

    The lower bound is not determined by slogans. It is determined by the proof obligations that must still carry information.

    For both readers and the checker to be convinced, the text must retain:

    • Definitions
    • Assumptions
    • Key constructions
    • Nontrivial estimates that cannot be obtained mechanically from the library
    • The way those estimates combine into the final theorem

    These elements can be written compactly, but they cannot be reduced to zero.

    The realistic room for further reduction lies mainly in repeated expansions, overly broad search, and unmaintained historical layers. It does not lie in replacing the proof body with stronger external results without bringing those results into the same trust boundary.

    The observations that a formalization can still be difficult to read at tens of thousands of lines while its natural-language explanation can be shortened further are not contradictory. Machine-oriented line count and human-oriented page count optimize different objectives.

    Formal text supports checking and regression. Natural-language text supports understanding and teaching. Forcing both goals into a single number produces an artifact that may be smaller but less transparent.

    Conclusion

    Compression of very large formal proofs should follow several concrete rules:

    • Publish the definition of the line count.
    • Separate the proof body from the dependency closure.
    • Use abstraction and deduplication rather than escaping to external results.
    • Use dependency depth, failure-localization quality, and documentation coverage to constrain every reduction.

    Reducing a proof from the tens of millions of lines to the tens of thousands can represent healthy engineering progress, provided that the theorem statement remains unchanged, the trust boundary does not move outward, and the critical steps can still be explained by humans.

    If any of these conditions fails, a smaller file is simply a harder-to-audit file.