Formal Verification: Establishing Trust in AI-Generated Proofs at 17 Million Lines

    In late 2025, a claim emerged that a formal proof of the Riemann Hypothesis had been produced with AI assistance and then verified by machine—across 175,187 modules, roughly 17 million lines of code, with a 61.6GB proof artifact accepted by independent checkers. This article explains how formal verification systems can check proofs far beyond what any human could read line by line. It covers the small-kernel design that makes machine checking trustworthy, the role of independent re-verification across three levels of confidence (derivation, statement, and consensus), the shifting trust model from reviewing authors to reviewing artifacts, the engineering challenges of large-scale verification, and the governance safeguards needed when AI takes part in proof generation.

    Introduction: Scale Beyond Human Eyes, Trust Handed to Machines

    In 1859, the German mathematician Bernhard Riemann raised the Riemann Hypothesis in a paper on the distribution of prime numbers. It asserts that all non-trivial zeros of the Riemann zeta function lie on the line where the real part equals 1/2. For more than 160 years, it has remained one of the deepest unsolved problems in number theory.

    In 2000, an international mathematics research institution listed the Riemann Hypothesis among seven “Millennium Prize Problems,” each carrying a $1 million reward. Its revised rules in 2018 state that a solution must be published in a qualifying academic venue, remain there for at least two years, and receive broad recognition from the mathematical community before a formal evaluation is triggered.

    According to public information, on November 20, 2025, a mathematician announced a formalized proof of the Riemann Hypothesis generated in collaboration with AI. On November 21, an open-source formal proof community publicly declared that it had completed verification of the entire proof and expressed strong confidence in its correctness. The reported figures:

    • The proof consists of 175,187 modules, amounting to roughly 17 million lines of code;
    • Independent verification records published by researchers at a university show that all modules compiled successfully, with about 61.6GB of exported raw proof data;
    • An independently implemented checker, running on 80 threads for 27 minutes and 42 seconds, accepted the complete proof, and other independent checkers reached the same result.

    Whatever the final verdict on this proof, these numbers point to a reality: in an era when AI can produce proofs in bulk, humans can no longer review every line it writes. Why can this proof be checked by a machine? And how reliable is a machine’s verdict? This article analyzes the issue on three levels—the principles of formal verification, the mechanisms of independent re-verification, and the engineering challenges of large-scale verification—and extends the discussion to how trust can be established in AI-assisted research.


    1. How Can a Machine Check a Proof of Millions of Lines

    A formal proof system is not AI and has no capacity for autonomous exploration. It is a programming language, together with its supporting tooling, for writing mathematical propositions and derivations as machine-readable code. Its characteristics can be summarized in three points: propositions are written as precise “types,” derivations are written as “programs,” and every program must pass type checking to count.

    1.1 Core Principle: A Small Kernel with a Thin Boundary

    Such systems are typically composed of three parts:

    • Frontend: parses the source code and executes the tactic commands written by users or generated by AI;
    • Tactics layer: provides automation that hands a set of goals to some procedure to be solved;
    • Kernel: the core component ultimately responsible for type checking. It is the only part that is trusted by default, and is therefore called the trusted computing base.

    The key design is “proof term reduction”:

    1. The work of the frontend and the tactics layer is reduced to explicit proof terms, so that every step of the derivation can be traced down to the underlying axioms;
    2. The kernel independently type-checks the final proof terms, without relying on whether the tactics are “clever” or trusting a tactic’s self-reported success;
    3. A defect in the frontend can at most let the system accept some script formulations that should not be allowed, but the final artifact must still pass the same set of kernel rules; only a fault in the kernel itself could let an invalid proof slip through.

    As a result, the rest of the system can be made complex, automated, and even driven by AI with confidence. As long as the tactics cannot bypass the kernel, a faulty tactic can only cause a proof to fail—and a failure never turns into an “incorrect conclusion.”

    1.2 Propositions as Types, Proofs as Programs

    The kernel can judge “mathematical correctness” because of the correspondence between propositions and proofs: a proposition can be regarded as a type, a proof is a term of that type, and a proposition holding is equivalent to “a term of that type can be constructed.” The kernel’s job is to check the type of each term one by one, confirming that every step of the derivation follows from the existing axioms and rules.

    Illustrative code:

    1. -- The type of the goal is the theorem statement itself; the required hypotheses are already part of the type
    2. theorem RH :
    3. ∀ s : ℂ, ζ s = 0 ∧ 0 < Re s ∧ Re s < 1 → Re s = 1 / 2
    4. -- The proof term must supply the derivation step by step; if the kernel rejects a rule at any step, the type check will not pass
    5. theorem RH : (the type above) := by
    6. intro s h_zero h_strip
    7. -- Built here from a large collection of already-formalized lemmas
    8. exact critical_line_of_zeros s h_zero h_strip
    9. #print axioms RH -- Audit: list every axiom the theorem actually depends on

    Under this model, an “incorrect proof” does not exist in some subtle form—it simply shows up as a type-checking failure. This fundamentally changes the way review works: instead of reading through each derivation by hand, the reviewer writes the judgment criteria as a program and lets the computer execute it repeatedly.

    1.3 The Boundaries of Formal Proof Systems

    The kernel also has its boundaries:

    1. Verification is relative. Every conclusion rests on foundational logical rules and axioms. Assumptions that are not universally accepted, such as the axiom of choice, are usually treated as “trusted axioms,” and every theorem is annotated with the axioms it actually depends on, so users can decide whether to accept them.
    2. Objects such as real numbers are modeled. Real numbers in a formal system are typically artificially constructed algebraic structures, and whether the modeling faithfully corresponds to the classical definitions requires human review. Whether a theorem statement accurately expresses the original conjecture likewise requires human judgment.
    3. The kernel depends on its underlying implementation. The type checker itself is implemented in a programming language and, in principle, still carries the risk of implementation defects. This is precisely the value of independent checkers.

    2. Independent Re-Verification: A Second Line of Defense for Trust

    In this verification effort, “independence” appears at two levels, and they answer different questions.

    2.1 Module Level: Everything Compiles

    All 175,187 modules compiled successfully, meaning the entire proof passed the kernel’s check of the formal system as a whole. This is the basic prerequisite for the proof to hold, and it also shows that large-scale formal development is engineering-feasible: a proof can be split into tens of thousands of modules and built up incrementally by many people, across multiple rounds, or even in human-machine collaboration, with each module passing its checks independently once its dependencies are satisfied.

    2.2 Tool Level: Multiple Checkers Reaching the Same Result

    Once a proof compiles, the system can export “raw proof data.” This data contains core information such as the types, terms, and axiom dependencies involved in the proof and, in principle, does not depend on any tactic or high-level command. A checker is responsible only for reading this low-level data and re-executing the type check according to a minimal set of rules.

    When several independently implemented checkers—written in different languages and strategies, with different failure modes—reach the same conclusion, it means:

    • Mutual cross-validation: a defect in one implementation is unlikely to “let through” the same proof in exactly the same way across multiple implementations;
    • Verification does not depend on the original author: the verification process does not require the original mathematician or AI to be present; anyone can reproduce the same conclusion on existing hardware;
    • Scale is not an obstacle: verification is a deterministic algorithm. Questions that are hard to exhaust in reading a paper—such as “does a typo on page 90,000 affect the conclusion?”—receive a clear yes or no under machine checking.

    A machine can prove “the derivation holds under this statement,” but it cannot automatically guarantee that “this statement is the Riemann Hypothesis.” The figure in the prompt illustrates this: knowing that finitely many zeros lie on the critical line does not establish that all zeros do. Therefore, every condition in the statement must correspond strictly to the original conjecture, for example:

    • Does the premise accurately characterize “non-trivial zeros”?
    • Is the conclusion exactly “real part equal to 1/2”?
    • Is there an overly strong premise added, or a necessary condition omitted?

    This step can only be done by mathematicians familiar with the field, and it should be the step that receives the most attention in independent verification.

    2.4 Three Levels of Confidence

    Level Question answered Who does it Nature
    Derivation Is each step of reasoning valid Kernel + independent checkers Machine-determined, repeatable
    Statement Does the theorem faithfully express the original problem Domain experts Human judgment, cannot be automated
    Consensus Is its mathematical meaning understood and accepted by the community Peer review + institutional procedures A long-term social process

    This public verification mainly completed the first level and began to touch the second. This also explains its place in the overall process: it is not an “official endorsement” of the proof, but a transformation of the derivation review—traditionally the most effort-intensive task for experts—into a task that a computer can execute repeatedly and that anyone can re-check.


    3. The Division of Labor Between Generation and Verification: A Shift in the Trust Model

    Traditional mathematical review follows a manual chain: public argument, expert reading, discovery of gaps, publication, peer review, and finally the formation of consensus. The premise of this workflow is that the scale of a proof stays within what humans can read to the end.

    Once AI generates proofs at the scale of millions of lines, this premise is broken. The remedy is not “read faster” but to shift the source of trust:

    • From “reviewing the author” to “reviewing the artifact”: not asking who wrote it, but whether the artifact can pass a repeatable check;
    • From “reading through derivations” to “verifying evidence”: humans handle the problem statement, the approach, and the axioms under review, while the machine exhausts every step of the derivation;
    • From “one-time peer review” to “re-runnable at any time”: verification results no longer depend on the chance of a particular review.

    What needs to be clear-eyed about is that this path covers only “correctness of the derivation.” Whether the proof has mathematical value and whether the method can transfer to other problems is still a matter for human judgment.


    4. The Engineering Challenges Behind Millions-of-Lines Verification

    4.1 Structured Decomposition into Machine-Processable Work Units

    17 million lines of code spread across 175,187 modules necessarily depend on a high degree of modularization. The modules form a directed acyclic graph through their dependencies: only after a module that is depended upon passes its check can the modules depending on it begin to compile. This brings three engineering advantages:

    • Parallelization: modules with no dependencies on each other can be compiled simultaneously;
    • Cache reuse: after a single module is updated, only it and its downstream modules need to be re-checked;
    • Failure isolation: an error is located to a specific module, with no need to rerun from the beginning.

    Illustrative scheduling logic:

    1. # Illustrative: organizing large-scale proof checking by dependency
    2. def verify_modules(modules):
    3. remaining = set(modules)
    4. while remaining:
    5. ready = [m for m in remaining if deps(m) <= checked]
    6. if not ready:
    7. raise RuntimeError("Dependency cycle or missing dependency; manual inspection needed")
    8. with parallel_pool(max_workers=N):
    9. results = map(check_module, ready)
    10. failed = {m: r for m, r in zip(ready, results) if not r.ok}
    11. if failed:
    12. report(failed) # Failed modules are recorded independently; they don't affect the parts that passed
    13. checked |= set(ready)
    14. remaining -= set(ready)

    4.2 Large Verification Data Volume: Storage and Distribution Matter Equally

    The roughly 61.6GB of raw proof data raises two practical problems:

    • Distribution: checkers do not need to depend on the original development environment; they need only the proof data and a small checker;
    • Integrity: the data must not be corrupted during transmission and storage. Computing a content hash per module and publishing it alongside the data lets the recipient verify integrity at any time.

    4.3 Compute Resource Planning Requires Empirical Data

    The 80 threads and 27 minutes and 42 seconds that accepted the complete proof also hint at the compute demand of verification. Whether it is fast enough depends on the verification goal, and cannot be judged from a single measurement:

    • Everyday development: verify as you write; the key is lowering the latency of incremental checks;
    • Continuous integration: check the affected scope before a merge, which requires strategic scheduling;
    • Release-level review: an independent review of the complete proof, with the highest compute demand.

    In practice, parts with dense dependencies and large-scale computation often cost far more to check than ordinary code, so capacity planning needs to be based on historical data.

    4.4 Verification Pipelines in the Cloud

    If a team needs to share and repeatedly run this kind of verification, cloud resources are usually a better fit. The core idea is to manage verification as a standard batch job:

    • Object storage: centrally storing proof data, dependency snapshots, and verification logs;
    • Container services: packaging a uniform checker environment to ensure each review is reproducible;
    • Batch compute: allocating compute on demand, supporting large-scale parallelism and failure retries;
    • Logging, monitoring, and alerting: tracking the status of each module and raising alerts when resources are abnormal or a task stalls for too long.

    Cloud providers such as Baidu AI Cloud offer general-purpose cloud products of the above types. A concrete solution should be chosen based on data scale, verification frequency, and team collaboration patterns, rather than simply chasing peak compute.


    5. When AI Is Involved, What Else Needs Oversight

    AI can take on many roles in formal proofs: searching for proof ideas, writing automation tactics, translating existing arguments into formal language, and diagnosing the cause of failures. All of this can greatly boost efficiency, but it also introduces new failure modes.

    5.1 Common Failure Modes

    1. Circular reasoning: the AI defines a “lemma” and asserts that it holds, then uses it to prove the target—seemingly reasonable, but in fact assuming the conclusion. The kernel’s or checker’s dependency checks will reject this.
    2. Injecting new axioms: declaring extra axioms to make a derivation that would otherwise be hard “work.” The machine will formally accept it, but the conclusion is no longer a theorem of the theory under study.
    3. Skipping derivation via native computation: some systems allow calling external computational programs to decide a proposition, with the process falling outside the kernel’s rules. For large-scale computation this is not necessarily a defect, but one must be aware of it and place limits on it.
    4. Rewriting definitions or statements: modifying definitions in the base library, or attaching extra premises to the target statement, to make the proof easier.
    5. Faking a “kernel failure”: constructing a proof that theoretically cannot pass the kernel’s check, to make the system falsely report a failure—attacking the verification process itself.

    Among these, circular reasoning and axiom injection are the most insidious: both can pass the check, yet the problem lies in the object being checked.

    5.2 Governance Measures

    • Axiom whitelist: after verification, list every axiom the theorem depends on, and allow only the basic logical axioms together with assumptions the team has explicitly accepted;
    • Prohibit unfounded declarations: any newly added axiom or key definition must have a record of manual review and a stated rationale;
    • Lock dependency versions: fix the base library and content hashes, so that any change requires explicit review, preventing definitions from being quietly rewritten;
    • Restrict native computation: set a whitelist and scope of applicability for procedures that call external computation;
    • Prohibit kernel failure: reject any configuration that attempts to disable or bypass the kernel check;
    • Separate the generator from the verifier: the party using AI to generate or search for proofs should not also control the verification environment.

    5.3 Illustrative Governance Pipeline

    1. pipeline "ai-assisted proof verification":
    2. inputs:
    3. target # The target statement
    4. candidates # Candidate proofs generated by AI or humans
    5. axioms_ok # Whitelist of trusted axioms approved by the team
    6. for candidate in candidates:
    7. # 1) Structural check: does the dependency graph contain a cycle, and are new declarations registered
    8. graph = build_dependency_graph(candidate)
    9. reject if has_cycle(graph)
    10. # 2) Formal check: invoke the official kernel to type-check step by step
    11. result = kernel_check(candidate)
    12. if result.failed:
    13. log_failure(result)
    14. continue
    15. # 3) Trust audit: are the axioms actually used within the whitelist
    16. used = list_axioms(candidate)
    17. reject if used - axioms_ok != {}
    18. # 4) Independent review: run the raw data check in an environment that did not take part in generation
    19. export_proof(candidate, artifact)
    20. independent_verify(artifact) # Failure blocks the merge
    21. publish(artifact, result) # Attach the verification log and checksum

    Conclusion

    Back to the original question: how can a formal verification system check a proof of 17 million lines? Because it turns the question “is the proof correct?”—which is essentially a matter of human judgment—into a type check that the kernel can mechanically execute at every step. Its reliability comes from the mutual support of a small kernel, independent implementations, and axiom auditing.

    This idea of “generation is generation, verification is verification” applies equally to everyday practice in AI-assisted software development: rather than arguing over whether AI-generated code “can be trusted,” it is better to let type systems, static analysis, testing, sandboxed execution, and formal methods form a verification gate that lets an untrusted generation process produce trusted results.

    Against the backdrop of AI increasingly participating in research and engineering, what deserves attention is not how long the content AI writes is, but whether we can establish clear trust boundaries for that content: machines check derivations, humans understand ideas, and institutions certify conclusions. Each doing its part is the foundation of trust in an era of large-scale automation.