LLM-Assisted Mathematical Proofs: From Formal Verification to Automated Theorem Derivation

    This article explains how large language models can assist with mathematical proofs through formal verification. It outlines a four-stage workflow: problem decomposition, draft proof generation, formal translation, and a verification feedback loop. It also covers common translation errors, engineering methods for hallucinations and large search spaces, and the current limits of these models.

    1. Background: Why Mathematical Proofs Need Machine Verification

    Mathematical research has long relied on peer review to ensure correctness. However, complex proofs often run to hundreds of pages, which makes manual review time-consuming and prone to missed errors. Since the twentieth century, the idea of formal verification has matured. Proofs are translated into formal languages that computers can check line by line, and a proof assistant automatically confirms that each step follows from the axioms and inference rules. A proof checked this way is machine-verifiable, and its reliability far exceeds that of manual review.

    In recent years, large language models have made breakthroughs in code generation and logical reasoning. This has given rise to a new direction. A model first interprets and breaks down a mathematical problem in natural language. It then helps researchers generate formal proof code, and a verifier completes a closed-loop check. This approach is called “AI-assisted formal mathematics,” and it is becoming a research hotspot at the intersection of mathematics and computer science.

    2. Why This Direction Matters

    1. Lowering the Barrier to Formalization

    The biggest obstacle to formal proofs is the workload. A proof that looks like a dozen lines on paper may take hundreds of lines in a formal language, and every lemma and implicit step must be stated explicitly. Once a model can translate from natural language into formal language, this barrier drops substantially. Mathematicians can then focus on core ideas.

    2. A Tool for Exploring Open Problems

    Beyond verifying known proofs, models can help during conjecture exploration. They can suggest proof ideas, construct counterexamples, and try different ways of decomposing lemmas. Researchers can quickly rule out dead ends, reducing the cost of trial and error from weeks to hours.

    3. Supporting Reproducible Research

    Formal proofs are inherently reproducible. Given an axiom system and a proof script, anyone can rerun the verification locally. This offers a more rigorous reproducibility mechanism than the appendices of a paper.

    3. Core Technical Path: From “Understanding Mathematics” to “Writing Verifiable Proofs”

    A typical AI-assisted proof workflow has four stages.

    Stage 1: Problem Understanding and Decomposition

    The model first parses an informal mathematical statement, which often mixes natural language and symbols, into a structured goal. This goal includes the known conditions, the proposition to prove, and the existing theorems that can be used. This step resembles the front end of a compiler. The key is to identify implicit premises accurately.

    An illustrative task description follows:

    1. Input: For any positive integer n, there exist n consecutive composite numbers.
    2. Decomposition:
    3. Goal: constructive proof
    4. Strategy: consider (n+1)! + 2, ..., (n+1)! + (n+1)
    5. To verify: each number has a nontrivial factor, and the number itself is larger than that factor

    Stage 2: Draft Proof Generation

    Based on the mathematical knowledge it has learned, the model generates a proof skeleton. It first states a high-level strategy, such as a constructive method, proof by contradiction, or induction. Then it fills in the details layer by layer. In practice, strategy choice often determines success. For existence statements, constructive approaches are worth trying first. For universal statements, induction is usually the better first choice.

    Stage 3: Formal Translation

    This is the most critical step in engineering. The draft proof must be translated into a script that the proof assistant accepts, and every definition and lemma must be precise and unambiguous. This step is error-prone. A step that is obviously true in natural language may require several lines of auxiliary derivation in a formal setting.

    Common translation errors include:

    • Definition mismatch: the model uses definitions that differ from the standard definitions in the verifier’s library;
    • Missing implicit steps: intermediate lemmas that must be stated explicitly in the formal setting are skipped;
    • Type errors: levels of numbers, sets, and functions are confused.

    Stage 4: Verification Feedback Loop

    The formal verifier checks the submitted script line by line and reports the location and cause of each error. These error messages go back to the model, which revises the script and resubmits it. This cycle repeats until every check passes. The full loop works as follows:

    1. Math statement → LLM generates proof draft → Translate into formal script
    2. ↑ ↓
    3. └────── Revise ←──── Verifier reports errors / passes

    This “generate, verify, revise” loop is the core of this paradigm. The model handles creative content, the verifier enforces strictness, and the two complement each other.

    4. Key Challenges and Engineering Practices

    1. Hallucinations and Verification Safeguards

    Models can produce reasoning steps that look plausible but are wrong. Several measures reduce this risk:

    • Consistency checking: sample multiple reasoning paths for the same problem and keep the result that most paths agree on;
    • Mandatory verification: treat no proof as a final conclusion until it passes the formal verification loop;
    • Citing verified results: for key lemmas, require the model to explicitly cite verified theorems already in the library instead of reproving them.

    2. Search Space Explosion

    Proofs of complex theorems often require trying many combinations of strategies. Common engineering methods include:

    • Lemma decomposition: split a large goal into a series of smaller goals and tackle them one at a time;
    • Heuristic ranking: prioritize proof strategies with high success rates based on past results;
    • Backtracking after failure: record the characteristics of failed paths to avoid repeating them.

    3. Infrastructure Support

    These workloads are iterative and bursty, which places considerable demands on underlying compute and engineering platforms. In practice, teams often rely on elastic cloud compute resources to run model inference and verification tasks. They use object storage to manage proof scripts and verification logs, and they use monitoring and alerting systems to track long-running jobs. Containerizing the verification pipeline also helps ensure reproducibility across different experimental environments.

    5. Capability Boundaries and Outlook

    Current models still have clear limits in mathematical proof:

    • Difficulty ceiling: For frontier problems that require entirely new mathematical ideas, models cannot yet make breakthroughs on their own. Their value lies mainly in assisting verification and exploration and in reducing the cost of formalization;
    • Weakness in long-horizon reasoning: Once a proof exceeds a certain length, the model’s ability to maintain global consistency declines. It must then rely more on external verification and structured decomposition;
    • Scarce formal data: High-quality formal proof data is far less abundant than natural language text, which limits how well translation can work.

    Looking ahead, formal mathematics libraries will keep growing, verification feedback loops will mature, and model reasoning will steadily improve. A collaboration model in which humans propose ideas and machines complete the rigorous formalization may become a standard workflow in mathematical research. For developers, this field also offers a strong practical setting for combining compiler principles, automated reasoning, and machine learning. Its methods also apply to broader engineering problems, such as code verification and protocol security proofs.