Large Language Models in Formal Mathematics: How Multi-Agent Collaboration Reshapes Proof Engineering
Formal mathematics offers a demanding test of AI agents: long-running work whose results must pass machine verification. This article examines a reported 30-hour formalization of Fermat’s Last Theorem, explains the planning, execution, and verification mechanisms behind collaborative proof systems, and explores what verification-driven workflows mean for developers, enterprise evaluations, and human–AI collaboration.
1. Formal Proof as a New Capability Benchmark
A recent flagship model announcement from a frontier AI lab included a striking claim: in a collaborative agent workflow, the model completed a formal proof of Fermat’s Last Theorem in roughly 30 hours.
The significance of this claim is not simply that a model can solve a difficult mathematics problem. It concerns an area that conventional model evaluations have struggled to measure: long-horizon knowledge work that requires large-scale coordination and produces rigorously verifiable results.
Over the past few years, large language model evaluations have broadly moved through three stages: conversational and question-answering benchmarks, code generation and multistep reasoning benchmarks, and, more recently, real-world engineering tasks. Formal mathematical proof represents an especially demanding version of the third stage. A system must maintain logical consistency across thousands—or potentially hundreds of thousands—of steps, with every step subject to a formal checker. An invalid inference cannot pass merely because it sounds convincing.
Similar capability claims have emerged in other areas, including designing working hardware prototypes from scratch, addressing open scientific problems, and completing large-scale legacy system migrations. These tasks share three characteristics: clear objectives, a closed verification loop, and extended execution horizons. Together, they point toward the next competitive frontier for AI agents.
2. What Is a Formal Proof, and Why Does It Matter?
2.1 How Formal Verification Works
Most mathematical proofs are written in natural language and rely on readers’ interpretation and peer review. A formal proof instead expresses both the theorem and its proof in a precise formal language, allowing an interactive theorem prover to check the reasoning.
The process resembles compilation under unusually strict rules:
Theorem statement → Break down the proof goalsEach proof step → Generate a machine-checkable proof termProof term → Type-check it in the kernelAll checks pass → Accept the theorem, with trust concentrated in a small kernel
This approach reflects the de Bruijn criterion: a proof produced by a complex system should be independently checkable by a comparatively small checker. Whether a human, an automated tool, or a language model generates the proof, its acceptance depends on kernel verification rather than confidence in the generator.
That makes formal proof particularly valuable for AI: it provides an objective acceptance mechanism for generated reasoning. The guarantee applies to the formal statement actually checked, making the definition of that statement and its assumptions important.
2.2 Why Fermat’s Last Theorem Is Difficult to Formalize
Fermat’s Last Theorem has a simple statement: for an integer exponent (n > 2), the equation (x^n + y^n = z^n) has no positive integer solutions.
Its complete mathematical proof, developed in the 1990s, depends deeply on elliptic curves, modular forms, Galois representations, and other branches of modern mathematics. Formalizing it therefore involves much more than translating a short argument:
- Long dependency chains: A substantial body of prerequisite theory must be formalized first. A missing dependency can block the main theorem.
- Gaps in library coverage: Public mathematical libraries built over years by formalization communities may not contain every required lemma.
- Translation as research: Turning a prose proof into machine-checkable steps often requires redesigning intermediate lemmas. That work can amount to a research project in its own right.
If the reported 30-hour result holds up, its importance would not be that a model recalled a known answer. It would be that an agent system could plan the work, fill dependency gaps, and complete a machine-verified workflow. That would represent a change in execution capability rather than merely an increase in retrieved knowledge.
3. How Multiple Agents Collaborate on Long-Horizon Proofs
A common architecture for this type of work is a multi-agent loop with three layers: planning, execution, and verification. The following pseudocode illustrates the pattern rather than a specific implementation behind the reported result:
def prove_theorem(goal):lemmas = decompose(goal) # Planning agent: split the goal into lemmasfor lemma in lemmas:proof = Nonewhile not verified(proof):proof = worker_agent(lemma, context=failed_history)if proof is None:lemmas += refine_decomposition(lemma) # Backtrack and subdivideemit(proof) # Preserve the result after verificationassemble_and_verify(goal) # Assemble and verify the final proof
Three engineering mechanisms are central to this approach.
3.1 Tree-Structured Proof Search
The system recursively breaks a large theorem into manageable lemmas. Different agents can work on separate branches in parallel.
This resembles how mathematicians divide complex projects, while also creating a structure suited to distributed compute scheduling. Progress on individual branches becomes reusable input for the larger proof.
3.2 A Verifier-Driven Feedback Loop
Each attempt receives feedback from the formal checker: acceptance or rejection, together with diagnostic information about failures. The system feeds those diagnostics back into subsequent attempts so that workers can revise their approach rather than repeatedly make the same mistake.
This compiler-like feedback loop is an important form of inference-time scaling. Additional computation can be spent on proposing, checking, and correcting candidates against an objective target, rather than simply generating a longer response.
3.3 Long-Horizon Context Management
A proof involving hundreds of thousands of steps cannot fit into a single context window. The system therefore needs an external proof ledger containing:
- Summaries of established lemmas;
- Records of unsuccessful approaches;
- The current state of unresolved proof goals.
Persistent storage and vector retrieval can help maintain this evolving knowledge base. The purpose is to preserve useful progress and make relevant information available without requiring every agent to carry the entire project history in context.
4. Three Lessons for Developers and Enterprises
4.1 Design for Verifiability First
Verification-first task design is becoming an important practice in agent engineering.
Whether the task involves writing software, cleaning data, or carrying out operational procedures, objective acceptance signals—such as test suites, type checks, or formal specifications—can improve the reliability of automation. They allow an agent to distinguish progress from plausible-looking output.
Tasks without a clear verification loop still require closer human supervision and collaboration.
4.2 Evaluate Projects, Not Just Individual Answers
The next generation of evaluations is moving closer to real engineering projects: work that runs for days, allows repeated attempts, and is judged by the final deliverable.
Enterprises should therefore complement single-turn benchmark scores with long-horizon acceptance tests grounded in their own workflows. A model’s ability to answer an isolated question does not, by itself, establish its ability to complete a sustained project.
4.3 Treat Vendor Claims Critically
Published performance figures often come from vendor-designed evaluations. Their interpretation depends on several questions:
- Has the result been independently reproduced?
- How much of the proof depends on existing community libraries?
- What exactly counts as completing the task?
- Where are the boundaries between supplied infrastructure and agent-generated work?
Developers can use model services and development toolchains to run end-to-end evaluations on their own tasks. The objective is to build firsthand evidence rather than accept launch figures at face value.
5. Limits and Outlook
Even with advances in formalization, models still primarily act as proof engineers: they execute routes shaped by mathematical insight, fill in missing lemmas, and manage verification work.
Formulating valuable new conjectures and deciding which intermediate results are worth pursuing still depend heavily on human mathematical judgment and intuition. A likely direction is deeper specialization in human–AI collaboration: mathematicians guide the structure and research direction, while agents handle large volumes of supporting proofs, checks, and library maintenance.
The broader significance is the verification-driven workflow. When machine checking can reject invalid proof steps and validate completed artifacts, trust in AI-generated work can be grounded in an engineering process rather than the apparent confidence of a response.
That trust remains tied to the formal statement, assumptions, and checker. Within those boundaries, however, formal mathematics illustrates a promising path for serious AI-assisted intellectual work—one that may extend to software, hardware, and other scientific workflows. That trend is more consequential than any single benchmark score.
