Formal Proofs and the Riemann Hypothesis: Beyond “Compilable” to Mathematically Sound

    A massive formal proof codebase claiming to prove the Riemann Hypothesis has ignited debate about what machine-checked proofs actually verify. This article explains why code that compiles or passes a proof assistant's checks may still fail to prove the intended mathematical statement, covering issues like vacuous predicates, definitional equality, and circular dependencies. It outlines a practical review framework to distinguish a valid formal proof from a merely compilable one.

    A Controversy Over “Machine Proofs”

    A large-scale formal mathematics codebase was recently made public, with its authors claiming it contains a complete proof of the Riemann Hypothesis. Unlike traditional mathematical papers, this material does not first provide a complete human-readable argument. Instead, it consists of formalized code, definitions, lemmas, and dependency graphs. The codebase reportedly contains tens of millions of lines across hundreds of thousands of files, attempting to translate a complex analytic number theory argument into a formal system that a proof assistant can verify step by step.

    Some institutions and researchers, after initial compilation and inspection, expressed reasonable confidence in its correctness. Supporters argue that formal proofs have a key strength: programs do not relax standards because of an author’s reputation, narrative style, or intuition. As long as the final theorem is strictly derived from existing axioms, definitions, and lemmas within the system, the proof has a repeatable verification foundation.

    Soon afterward, however, a separate audit report reached the opposite conclusion: the code may very well pass formal checking, yet it does not actually prove the Riemann Hypothesis in the usual sense. The crux of the dispute is not whether the proof assistant miscalculates, but rather whether the objects and propositions defined in the code accurately correspond to the original problem mathematicians intended to solve.

    This distinction is critical. A formal system can only verify what is written down. It cannot automatically judge whether what is written down is what the author claims it to be.

    What a Formal Proof Actually Checks

    A proof assistant’s basic working process can be summarized as follows:

    1. Define mathematical objects.
    2. Declare axioms, properties, or lemmas.
    3. Construct a proof term.
    4. Check that the proof term’s type matches the target proposition.
    5. Verify that all dependencies recursively unfold and ultimately hold.

    If the target proposition is:

    1. Proposition P

    then the system’s concern is whether the code can construct a proof object of type P. It typically does not automatically judge the following:

    • Whether P is an accurate translation of the original natural-language statement.
    • Whether necessary conditions were omitted in defining P.
    • Whether a given “object” truly has the meaning required by the mathematical context.
    • Whether an axiom is too strong and already implicitly contains the conclusion to be proven.
    • Whether the variables and parameters in the code correspond one-to-one with those in the paper.
    • Whether the definitions used maintain their original semantics throughout the proof.

    Thus, a formal system has strong local reliability, but it does not automatically provide global semantic review. A useful analogy is a compiler: a program compiling successfully only ensures that syntax, types, and certain static constraints are satisfied. It does not mean the program implements the product requirements, let alone that the business logic is correct. Proof assistants and compilers are similar in this respect—they are good at verifying formal structure, but they do not perform all semantic judgments on behalf of a human.

    Why “Empty Objects” Are a Serious Problem

    The most heavily discussed technical issue in the audit is a class of geometric objects or witness objects used to support assertions in the proof chain. A witness can be understood as follows: when a proposition claims that “there exists an object with a certain property,” the proof must provide a concrete object and verify that it satisfies the requirements.

    For example, mathematics might require proving:

    1. There exists an object w such that Property w holds

    A rigorous formal implementation should typically include two parts:

    1. Provide w
    2. Prove Property w

    If the code defines Property as a predicate that returns true for any input, then any object can be accepted as a valid witness. Abstractly, if the definition is equivalent to:

    1. Property := fun _ => True

    then the system will regard:

    1. Property candidate

    as trivially true.

    This does not mean the proof assistant has been broken or that the kernel has made a computational error. On the contrary, the system is faithfully executing the definitions written by the developer. The real problem is whether this Property still represents the geometric property required by the original mathematical problem.

    If the original requirement was that “the object satisfies boundary conditions, continuity, non-degeneracy, and specific topological relationships,” but the code only retains a trivial predicate, then the formal system has verified not the original mathematical statement, but a significantly weakened substitute.

    This kind of issue is especially dangerous in large formalization projects. The larger the codebase, the easier it is for local definitions to be buried deep in dependency chains. A top-level theorem may look complex, but if a key property has been reduced to a vacuous condition at a lower level, the entire proof chain suffers from a “formally complete, semantically empty” situation.

    rfl Holding Does Not Mean the Mathematical Fact Holds

    Another notable detail is that the code uses a mechanism similar to “reflexivity proofs” to directly establish certain equalities.

    In many formal systems, if both sides of an equation are identical after definitional expansion, then a proof can be completed using definitional equality. The logic is roughly:

    1. If the left-hand side and right-hand side are the same expression after unfolding,
    2. then "left = right" can hold directly.

    For example:

    1. definition height := 0

    If the code then asks to prove:

    1. height = 0

    the system can immediately accept it, because height unfolds to 0.

    But if the code first defines a variable as a constant, then redefines it as a complex expression, and finally uses definitional unfolding to prove:

    1. height = explicitFormula

    then this equality may only reflect “the definition in the code,” not an independently derived mathematical result.

    It is important to distinguish between two types of equalities:

    1. Definitional Equality

    This comes from substitution rules in the program or formal language. It essentially states that “this name is defined to be that expression.”

    2. Mathematical Equality

    This requires proving, via theorems, derivations, structural properties, or computation, that two distinct mathematical objects are indeed equal.

    If a relationship that should be established through mathematical reasoning is written directly into a definition, and then definitional unfolding is used to “prove” it, this can constitute circular reasoning. Formal systems typically do not report an error in such cases, because from their perspective the definition is legitimate and the equality indeed holds. But from the standpoint of mathematical argument, the key conclusion may merely have been encoded into the system at definition time.

    Why “It Compiles” Is Still Not Enough

    A large formal proof should pass at least three levels of review.

    Level One: Kernel Consistency Check

    This level checks whether the code is accepted by the proof system. It involves type checking, dependency verification, termination checking, and whether proof terms satisfy kernel rules. This is the most basic and mechanical layer.

    Level Two: Proposition Correspondence Check

    This level confirms whether the top-level proposition in the code is equivalent to the target proposition in natural language. Each item should be verified:

    • Whether quantifier ranges match.
    • Whether “exists” actually provides a valid object.
    • Whether all boundary conditions are preserved.
    • Whether concepts like limits, continuity, and measurability are correctly encoded.
    • Whether a universal statement was accidentally weakened to an existential one.
    • Whether key premises or restrictions were omitted.

    Level Three: Dependency and Non-Circularity Review

    Even if the top-level proposition is correct, one must still check the lemmas and definitions it depends on. Key concerns include:

    • Whether the target conclusion was introduced indirectly as an axiom or assumption.
    • Whether same-name definitions were overwritten.
    • Whether tautological predicates replaced real properties.
    • Whether opaque modules hide critical steps.
    • Whether temporary assumptions valid only in test environments were used.
    • Whether computational conventions were mistaken for mathematical derivations.

    A convincing formal proof should not merely show that “the final check passed.” It should also provide a clear dependency graph, explanations of critical definitions, and an independently reviewable core path.

    Why Large Codebases Are More Prone to Semantic Loopholes

    Code scale does not equal proof strength. On the contrary, the larger the engineering effort, the more governance mechanisms are needed.

    First, a large number of modules increases the risk of semantic drift. The same term may be given slightly different definitions in different files, eventually causing the top-level theorem to diverge from the original paper’s concepts.

    Second, auto-generated code may obscure important details. Automation tools can quickly produce numerous auxiliary lemmas, but the actual relationships between these lemmas still require manual inspection. The faster the generation, the more likely it is to produce “structurally complete but semantically wrong” results.

    Third, default configurations and hidden assumptions can affect conclusions. Some formalization environments allow developers to introduce additional axioms, unverified modules, or external opaque proofs. If reviewers only see the compilation result without examining the system configuration, they cannot determine whether the proof relies on permissible foundations.

    Therefore, when reviewing a large formal proof, one should not simply count files, lines of code, or the number of checks passed. These metrics at most reflect engineering scale, not mathematical validity.

    A More Reliable Review Methodology

    For disputes like this one, the following review process can be adopted.

    1. State the Original Mathematical Proposition

    First, write out the target proposition in natural language and conventional mathematical notation. Confirm the domain of definition, quantifiers, restrictions, and equivalent transformations. Without this baseline, one cannot judge whether the formalized code faithfully represents the original problem.

    2. Trace Backward from the Top-Level Theorem

    Do not start by reading the file directory. Instead, start from the final theorem or main conclusion and recursively trace its proof dependencies, forming the leanest possible critical path.

    3. Inspect All Custom Predicates

    Focus on predicates that return true for every input, default values, placeholder objects, empty types, unconstrained parameters, and overly permissive interfaces. Anything whose name suggests a complex mathematical property but whose actual definition is extremely simple should be flagged as a high-risk node.

    4. Distinguish Definitional Unfolding from Independent Proof

    For every key equality, mark whether it comes from definitional equality, computational reduction, or an independent theorem. If a key conclusion depends primarily on definitional unfolding, one must further confirm that the definition did not pre-encode the conclusion itself.

    5. Independently Rebuild Core Lemmas

    For the few critical steps that determine whether the conclusion holds, re-formalize them in an isolated environment wherever possible. This avoids interference from auxiliary definitions, default assumptions, or hidden dependencies in the original project.

    6. Conduct Both Mathematical and Engineering Audits

    The mathematical audit judges whether the proposition is correct. The engineering audit checks version control, configuration, dependencies, build processes, and reproducibility. Both are essential.

    Lessons from This Controversy

    Formal mathematics has not lost its value. On the contrary, it provides unprecedented repeatable verification capability for complex proofs and can significantly reduce risks from typos, skipped steps, and conceptual mixing in traditional papers.

    However, formalization is not a process where natural language is handed to a machine and truth emerges automatically. It requires researchers to first complete accurate modeling, and then have the system check the derivation. If the modeling phase weakens conditions, or writes the target property as a tautology, then the stricter the machine, the more stably it will verify the wrong target.

    Therefore, when evaluating a machine-assisted proof, one should answer three questions at the same time:

    1. Does the code pass the formal system’s checks?
    2. Is the proposition proven in the code the same as the mathematical proposition originally claimed?
    3. Do the key definitions and assumptions avoid pre-encoding the conclusion into the system?

    Only when all three questions are answered affirmatively can one cautiously call it a valid formal proof. Otherwise, a significant gap remains between “compilable,” “checkable,” and “resolved.”