How to Verify LLM-Generated Mathematical Proofs: Formal Verification Pipeline and Checklist

    This article explores how to organize, verify, and review mathematical proofs generated by large language models. It outlines the boundaries of mathematical conclusions, details a formal verification pipeline covering draft review, formal encoding, kernel checking, static analysis, and independent review, and provides a comprehensive static checklist using Lean 4 to ensure the correctness and alignment of formalized proofs.

    1. Defining the Boundaries of Facts

    This article takes a community-circulated rumor as a starting point: a formalized mathematics repository of an AI team briefly featured a commit claiming to have completed the formal proof of θ(pc)=0. Currently, the complete record, author identity, and submission time of this commit cannot be verified, nor has it been independently confirmed. This article does not judge the authenticity of this event, treats the commit not as evidence, and does not endorse it as an achievement. Instead, it uses this scenario to discuss a general question: if a large language model (LLM) provides a mathematical proof, how should we organize, verify, and review it?

    2. Boundaries of the Mathematical Conclusion Itself

    In bond percolation, each edge is independently kept open with probability p. The critical probability pc is a threshold: when p is less than pc, an infinite connected cluster almost surely does not exist; when p is greater than pc, an infinite connected cluster almost surely exists. θ(p) represents the probability that the origin belongs to an infinite connected cluster, and θ(pc)=0 means that at the critical point, the origin almost surely does not belong to an infinite cluster.

    According to currently available public literature, pc=1/2 in two-dimensional bond percolation was determined by Kesten in 1980, and θ(pc)=0 holds in the two-dimensional case. In high-dimensional cases, the work of Hara and Slave proved that θ(pc)=0 holds for d≥19. For three-dimensional and intermediate dimensions, there is no universally accepted complete proof in public literature. This judgment may change with new literature, so you should check the latest papers and their publication dates before citing.

    There are two boundaries to note here. First, bond percolation and site percolation are different models, and their conclusions cannot be applied to each other. Second, lattice structures, directed edges, or other variants may alter the conclusions. Therefore, “θ(pc)=0” must be stated alongside a specific model; otherwise, the subject of discussion is unclear.

    3. The Formal Verification Pipeline

    A complete verification pipeline includes five stages: proof draft, formal encoding, kernel checking, static analysis, and independent review. Each stage confirms different aspects. The table below lists the applicable scope of the main objects.

    Check Object What It Can Confirm What It Cannot Confirm
    Natural language proof Whether the idea is clear and the structure is readable Whether every derivation step is rigorous
    Formal proof passing the kernel Every derivation step conforms to the rules of the proof language, and the dependent axioms can be listed Whether the encoding of definitions and statements corresponds to the original problem
    No sorry, no extra axioms The proof skipped no steps and introduced no new assumptions Whether the chosen axiom system itself is appropriate
    Independent review Whether definitions and statements are confirmed by a second person or independent team It cannot replace mathematical judgment itself

    Taking Lean 4 as an example, formalization implementation typically involves addressing the following key points:

    1. Model Modeling. Integer lattices, edge sets, and product probability measures all require precise definitions. If bond percolation is mistakenly written as site percolation, a different problem is being proved. You need to search and confirm whether Mathlib already has reusable related definitions.
    2. Events and Measures. θ(p) corresponds to the probability of the event “the origin belongs to an infinite connected cluster.” The probability measure on infinite lattices needs to be constructed using tools like the Kolmogorov extension theorem.
    3. Well-Definedness of pc. You must first prove that the relevant event is monotonic with respect to p, typically done using coupling methods. Only then can pc be defined as sup{p : θ(p)=0}, and proven to be a finite and uniquely determined value.
    4. Finite Lattice to Limit. Many proofs first discuss the problem on a finite box and then take the limit. The exchange of limit and probability requires separate argumentation, which is a common difficulty in formalization.

    The kernel only accepts derivations that satisfy type rules. As long as there is no deviation in the encoding of definitions and statements, a proof passing the kernel is correct within the axiom system it relies on. However, passing the kernel does not equate to mathematical truth. It only guarantees that the derivation is consistent with the written definitions.

    4. Static Analysis Checklist

    The following checks do not require reading the entire proof and are suitable for quick execution before submission.

    • Search for placeholders and assumptions. Search for sorry, admit, and axiom in the project directory. Command example: grep -rn "sorry\|admit\|axiom" ./. Each occurrence must be explained, confirming whether it is intentionally kept.
    • Audit dependent axioms. Add #print axioms theorem_name after the target theorem. Standard axioms include propext, Classical.choice, and Quot.sound. If sorryAx appears in the output, it indicates the proof depends on unfinished parts.
    • Definition Alignment. Check item by item the lattice dimension, edge set, bond or site model, probability measure, definition of θ(p), and definition of pc. Whether the model parameters are consistent with the original problem is the most error-prone area.
    • Statement Comparison. Translate the theorem statement back into natural language and compare it sentence by sentence with the original problem. Pay special attention to the direction of limits, inequality signs, and the order of quantifiers.
    • Version Locking. Record lean-toolchain, dependency versions, and commit hashes. Run lake build to confirm the project can be fully constructed, and repeat it in a clean environment.
    • External Dependency Audit. Check whether the dependency libraries contain sorry. If there are unfinished results in the dependencies, the conclusion of the target theorem is also incomplete.

    Here is a minimal example to understand the effect of sorry and axiom auditing:

    1. theorem demo_add_comm (a b : ℕ) : a + b = b + a := Nat.add_comm a b
    2. #print axioms demo_add_comm
    3. theorem demo_unfinished (a : ℕ) : a + 0 = a := by
    4. sorry
    5. #print axioms demo_unfinished

    The second theorem will generate a warning “uses sorry”, and its axiom output will include sorryAx. Such warnings cannot be ignored.

    5. Independent Review Closed Loop

    Static analysis can only detect mechanical issues. The review also requires manual completion of the following steps:

    • A second person reads the theorem statement and definitions without looking at the proof, judging whether the model aligns with the original problem.
    • Another person or team independently writes a formalized version of the same statement, and then compares whether the two statements are equivalent.
    • Compare the conclusion with known literature. If the formalized result contradicts known theorems, you should first suspect an encoding error rather than doubting the known result.
    • Write the repository version, commit hash, run commands, and outputs into the review report, and explicitly state the applicable boundaries of the conclusion, such as “holds under the specified model and specified axiom system.”

    For proofs generated by large language models, special attention must be paid to the scenario where definitions are quietly rewritten. The model might alter definitions or weaken statements just to make the proof pass. The kernel cannot detect such issues; they can only be identified through definition alignment and independent review.

    6. Execution Order and Rationale

    It is recommended to execute in the following order: first perform definition alignment, then conduct sorry and axiom checks, followed by kernel construction, then axiom auditing, then independent review, and finally cross-checking with literature. Definition alignment is placed first because if the definitions are wrong, all subsequent passes become meaningless.

    The rumor discussed in this article cannot be verified; therefore, all conclusions herein should be based on public literature and reproducible check results. Before complete records and independent reviews are available, any claim of “having been formally proved” can only serve as a lead awaiting verification.