AI-Assisted Formal Verification of a Mathematical Proof: Notes on Review Practice

    This article explains formal verification, a method for writing mathematical reasoning as code that a proof assistant can check. It uses a reported project that converted most of Harald Helfgott's proof of the weak Goldbach conjecture into checkable code with AI programming tools. The article covers how work was divided between people and AI, how errors surfaced, what a passing check does and does not guarantee, and where this approach fits in software engineering.

    Background

    The weak Goldbach conjecture, also called the ternary Goldbach conjecture, states that every odd number greater than 5 can be written as the sum of three primes. The idea dates back to a correspondence between Goldbach and Euler in 1742. In 2013, mathematician Harald Helfgott announced a complete proof. The original proof is long and contains many inequality estimates and numerical computations, which most readers find hard to check step by step.

    Recently, public reports described an independent developer who used AI programming tools to convert the main parts of this proof into formal code that a proof assistant can check. According to the report, the code is about 194,000 lines long, with auxiliary scripts and documentation. The report also says that the project’s public record lists more than ten places where the formal argument differs from the original text. All specific figures in this article come from the original report, and the author has not verified them independently. Readers should treat them as claims that still need checking.

    1. What Formal Verification Is

    Formal verification means writing mathematical reasoning as code that software can check. The software is called a proof assistant. Every lemma must have an explicit statement, and every step of a derivation must compile. A proof assistant does not accept steps such as “obviously true” or “left to the reader.”

    Proof assistants often use a placeholder. In systems such as Lean, it is written as sorry. It marks a statement that has not been proved yet, and the compiler issues a warning. The report says the project reached zero sorry, meaning every statement in the code has a complete proof. This shows that no proof was left blank. It does not show that the proved statements are the original mathematical proposition. Someone must separately check whether each statement faithfully matches the original text.

    2. How Work Is Divided Between People and AI

    A project like this can usually be split into three kinds of work.

    • Planning: People decide how to split the theorem, the order of the lemmas, and what each step must prove.
    • Transcription: AI drafts code from the original text, fills in local proofs, and fixes compilation errors.
    • Adjudication: The proof assistant decides whether the code passes, and people check whether the statements match the original text.

    Under this division, a reproducible workflow looks roughly like this:

    1. Fix and record the versions of the proof assistant and its dependency libraries.
    2. Organize the original text into a list of theorems, lemmas, and their dependencies.
    3. Write formal statements one by one, without rushing to prove them.
    4. For each statement, ask AI to generate a proof and submit it to the compiler.
    5. Search the code for placeholders to confirm that none were missed.
    6. Check the axioms the proofs depend on to confirm that no unreviewed assumptions were introduced.
    7. Record the cause of each compilation failure and the change that fixed it, so the history can be traced later.

    3. How Errors Were Found

    When a proof gets stuck during formalization, the cause usually falls into one of three categories. First, the original proof may be wrong. Second, the original text may not be precise enough, so the formal version must add conditions before it can continue. Third, the transcription may have introduced a misreading.

    The constant issue in the report is a typical example. According to the report, a constant in the original text was written as 0.5, while the correct value from calculation is about 0.81. Problems like this require a person to return to the original text and the calculations. Compiler results alone cannot resolve them.

    AI-generated repairs also need review. Code that compiles does not mean the repair is correct. A common risk is that a repair quietly weakens a statement so that the proof passes more easily, while the conclusion drifts away from the original theorem. Reviewers need to compare each repaired statement with the original and confirm that its strength has not decreased.

    4. What a Passing Formal Check Means

    A passing check shows that, within the logical system of the proof assistant and the statements written in it, the proofs in the code have no gaps. It guarantees that the code matches the statements.

    It does not guarantee several other things. First, it does not show that AI independently proved the mathematical proposition. The proof ideas came from joint work between people and AI, and the conclusion still needs to be tested by the mathematical community. Second, it does not show that the statements fully match the meaning of the original mathematics. That requires human review. Third, it does not show that the underlying libraries are free of errors, since foundational libraries can also contain mistakes or incomplete definitions. Fourth, it does not show that the corrected argument is the best available method.

    The “more than ten errors” in the report should therefore be read as problems flagged in the project record. They do not mean that all of these problems have been confirmed.

    5. Implications for Software Engineering

    The same method can be applied to software development, but its scope is limited. Modules with clear specifications, high correctness requirements, and relatively stable code suit it best. Examples include algorithm libraries, financial calculations, and protocol parsing. For interface code with vague requirements that change often, the return on investment is usually low.

    A team that wants to try this approach could plan around four points.

    • Suitable modules: Choose core modules with clear specifications and wide impact, such as amount calculation or permission checks.
    • Verification goals: Define properties first, such as an amount never being negative or a state transition never producing an illegal state, before attempting full proofs.
    • Human review points: People must review specification documents, property definitions, and AI-generated repairs.
    • Rollback on failure: Keep a version record for every change, so the team can return to the last passing state when verification fails.

    6. Limitations and Next Steps

    AI can still misread abstract mathematical structures. It may generate intermediate lemmas that look plausible but are false. It may also avoid difficult parts by relying on existing library functions that hide the problem. The report does not show that AI independently proposed a breakthrough proof idea. For open mathematical problems, human judgment still plays the leading role.

    Formal projects also carry substantial maintenance costs. Hundreds of thousands of lines of code may need adjustment as tool versions change, and the team needs members who can read and modify the proofs.

    Overall, this case shows how AI programming tools can help in formal verification. They can speed up transcription, help locate gaps, and propose candidate repairs. Each conclusion still needs confirmation from the proof assistant and from human review. Readers who want to try this method should start with a small theorem or a clearly defined software module, record every step, and then decide whether to scale up.