When AI Helps Prove the Riemann Hypothesis: Can 17 Million Lines of Code Be Trusted?

    This article examines how a formal proof of the Riemann Hypothesis, delivered as roughly 17 million lines of code, shifts trust from human readability to machine verification. It explains why formal proofs are so long, introduces the concept of a trusted computing base (TCB), and provides a practical acceptance checklist and a layered trust model (L0–L4) that engineering teams can apply to audits, reproducibility, and dependency management.

    1. An Unusual Scenario: A Proof Longer Than Human Reading Bandwidth

    Rarely does mathematics produce a situation like this: a conjecture open for more than 160 years is pushed to its final stage by a combination of a human and AI coding tools, and the final deliverable is not a few hundred pages of prose but roughly 17 million lines of code.

    This creates an awkward reality: the number of people worldwide who could read the artifact from start to finish might not fill a single classroom. Human reading bandwidth is measured in dozens of pages per day; 17 million lines of code amount to centuries of manual review.

    The strange part is this: we cannot read it all, yet a machine can check even the last line cleanly. To understand why this is reasonable, we need to move the concept of a “proof” from paper into the world of engineering.

    2. The Key Shift: From Convincing Humans to Convincing Machines

    The essence of a traditional mathematical proof is a social contract: the author writes an argument, reviewers (the community) check it section by section, and once it is confirmed correct, it is accepted. Its credibility rests on being reviewable by humans.

    Formal proofs change the counterparty of that contract. A proof is no longer just a natural-language argument but a sequence of formal steps that can be checked mechanically, each starting from axioms, definitions, or previously proved lemmas and advancing according to explicit inference rules. The checker is not a human but a program with a very small footprint.

    Credibility is therefore split into two independent questions:

    • Whether the argument itself is correct (a mathematical problem, guaranteed by the formalization process);
    • Whether the checking program faithfully applies the rules (an engineering problem, guaranteed by the trusted computing base).

    The fact that humans cannot read 17 million lines does not affect a rigorous answer to the second question, while the first question has already been covered by line-by-line machine verification. That is the whole secret of “trusting what you cannot understand.”

    3. Why the Code Balloons to the Millions of Lines

    Many people’s first reaction is: how can a proof of a single conjecture reach 17 million lines? The reasons are quite down-to-earth and lie on the engineering side.

    1. The “verbosity tax” of formalization. A step that is “obviously true” on paper must be expanded into a large amount of basic inference in a machine. A single inequality or a single interchange of limits may require dozens to hundreds of lines.
    2. The transitive closure of library dependencies. A proof references existing formalized libraries for analysis, number theory, and complex analysis; dependencies depend on further dependencies, ultimately pulling in the entire foundation of mathematics.
    3. Artifacts generated by automation. Proof scripts, intermediate lemmas, and retry verification records generated in bulk by AI coding tools are themselves enormous in volume.
    4. Computation-assisted branches. Some lemmas rely on large-scale numerical interval verification or exhaustive search, requiring additional computational evidence and result files.

    Conclusion: line count is not a measure of difficulty but the result of “degree of formalization × breadth of dependencies.” Judging credibility by line count is like judging software quality by file size.

    4. Why the Machine Can Check Even the Last Line: The Trusted Computing Base

    Trust in this system does not rest on “who wrote it” but on “who checks it.” The core concept is the trusted computing base (TCB): the minimal part of the entire chain that must be trusted.

    A typical formal verification chain looks like this:

    1. Proof script (millions of lines)
    2. ↓ checked line by line by the proof assistant kernel
    3. Kernel + axiom set + loaded formal libraries
    4. ↓ generates an independently reviewable proof object
    5. Independent checker (small, auditable)
    6. ↓
    7. Result: theorem holds / some step does not hold

    There are three key points:

    • The kernel is small. The kernel of a mature proof assistant is typically only thousands to tens of thousands of lines, a scale that humans can fully audit within a reasonable time.
    • Few axioms, explicitly stated. Which axioms the entire result depends on must be listed explicitly; no extra assumptions can be smuggled in.
    • Reproducible. Rechecking the same artifact on any machine should yield the same result; the conclusion does not depend on any expert’s memory or reputation.

    Engineering adds another layer of hardening: convert the kernel’s output into an independent proof object, then recheck it with a small checker implemented separately. The probability that bugs in two implementations conceal the same error at the same time is extremely low.

    5. How to Confirm “the Proof Succeeded”: An Executable Acceptance Checklist

    Faced with a millions-of-lines artifact, the right approach is not to read it but to audit and reproduce it.

    1. Locate the conclusion statement. Find the formalized statement of the final theorem and verify word for word that it is exactly the original conjecture; the order of quantifiers, the domain of definition, and exclusion conditions must all match exactly.
    2. Export the axiom and dependency list. List all axioms and external lemmas the proof actually uses, and confirm that no assumption stronger than the original problem has been introduced.
    3. Check for “circular dependencies.” Confirm that the referenced lemmas were not derived backward from the conclusion being proved; this is the most common fatal problem in formalization projects.
    4. Rerun the check independently. Re-execute the checking process in a clean environment, recording versions, configuration, and elapsed time to ensure reproducibility.
    5. Audit the trusted computing base. Manually read through the kernel and the axiom list; this part must be genuinely understood by a human.
    6. Isolate the computation-assisted parts. For branches that depend on large-scale numerical verification, separately review the reliability of the interval algorithms and the error bounds.
    7. Retain evidence from the entire process. Archive scripts, logs, and intermediate artifacts together to form a traceable chain of evidence.

    A sample acceptance record structure:

    1. theorem: riemann_hypothesis_formal
    2. statement_hash: <digest of the final statement>
    3. axioms: [base logic axioms, completeness of real numbers, ...]
    4. external_lemmas: 0
    5. kernel_version: <version identifier>
    6. independent_checker: passed
    7. reproduce:
    8. environment: clean_container
    9. result: verified
    10. duration: <measured>
    11. tcb_reviewed_by: [audit record]

    6. A Layered Trust Model: Breaking “Belief” into Manageable Levels

    For engineering teams, the practical approach is to grade conclusions rather than make a binary true/false judgment.

    • L0 Unverified: only a natural-language argument, relying on peer review.
    • L1 Machine-checked: line-by-line kernel verification is complete and the axiom list has been exported.
    • L2 Independently rechecked: a second-implementation checker confirms it and the environment is reproducible.
    • L3 Trusted base audited: the kernel and axiom set have been fully reviewed by a human and archived.
    • L4 Long-term maintainable: the artifact continues to undergo regression verification as dependency library versions evolve.

    Most engineering conclusions are sufficient for use at L1; only high-risk scenarios involving security, finance, or compliance need to advance beyond L3. This tiered approach transfers directly to everyday development: formalized specifications for core libraries, critical paths in protocol implementations, and boundary checks in cryptographic modules all fit the same “small kernel + large artifact + reproducibility” structure.

    7. Practical Recommendations for Developers

    • Treat verifiability as a design metric. Producing machine-checkable invariants and assertions while writing code is more economical than adding tests after the fact.
    • Keep the trusted computing base small. Any “universal verifier” pushes up the cost of trust; a small kernel is the sustainable solution.
    • Make the dependency list explicit. Third-party formal libraries, generator versions, and checker versions must all be pinned; otherwise reproduction is impossible.
    • The evidence chain matters as much as the artifact. A proof without logs and intermediate results is, in engineering terms, undeliverable.
    • Run it as cloud engineering. Large-scale verification tasks typically need elastic compute capacity, with object storage to archive artifacts, logging services to retain audit records, and monitoring and alerting to track long-running task status; Baidu AI Cloud offers mature, general-purpose resources and governance options for these “long-running, reproducibility-heavy, audit-intensive” workloads.

    8. Conclusion

    Seventeen million lines of code bring not a cognitive crisis but an upgrade of the trust mechanism: humans do not need to read every line, only to understand the small kernel and confirm that the entire chain is reproducible, auditable, and free of circular dependencies.

    This is also the most practical lesson as AI coding tools enter basic science: the more important capability in the future is not generating more content but building a two-layer verification system that humans can audit and machines can exhaustively check.