Lessons from an 11-Day Formal Proof of Fermat's Last Theorem by AI

    This article examines a recent engineering effort in which a multi-agent system completed an end-to-end formal verification of Fermat's Last Theorem in about 11 days. It explains why a 129-page paper and 13 million lines of formal code solve different problems, how dependency management holds a long proof chain together, and what the resulting multi-agent architecture means for building trustworthy enterprise systems through explicit, verifiable, and traceable methods.

    1. What Happened: An End-to-End Formal Verification Loop

    A cloud provider recently disclosed a closely watched technical experiment: a system built from an AI coding tool and multiple cooperating agents completed an end-to-end formal verification of Fermat’s Last Theorem, a classic mathematical problem, in roughly 11 days. According to the disclosed figures, the system produced about 13 million lines of formal code, generated and proved around 30,300 auxiliary theorems along the way, and referenced about 29,500 of them in the final chain. Total output reached roughly 6 billion tokens, and the root node ended in a passing state.

    Three boundaries should be clarified first, so the result is not misread:

    • It is not a new mathematical discovery. The system did not produce a proof idea that differs from existing approaches.
    • It is not a line-by-line translation. The system did not map the 129-page classic paper directly onto code; it followed the simplified version of the proof accepted in the academic community and reconstructed it into a machine-checkable form.
    • It is not the achievement of a single model. What closed the loop was a collaborative system of “multiple agents + a proof assistant + a formal language,” with the model serving only as the reasoning and generation unit.

    The statement of Fermat’s Last Theorem is itself simple: when the integer n is greater than 2, the equation xⁿ + yⁿ = zⁿ has no positive integer solutions. Yet between “a simple statement” and “machine-verifiable” lies one of the deepest technical stacks in modern number theory. The value of this experiment is that a machine checked a complete formal chain leading to the theorem all the way from the lowest-level premises to the root node for the first time.

    2. Two Kinds of Text, Two Goals: Why Papers and Formal Proofs Cannot Replace Each Other

    Understanding this event starts with understanding that “129 pages” and “13 million lines” address two entirely different problems.

    Mathematical papers serve understanding. Authors assume readers share a large body of background knowledge, compressing routine derivations into short phrases such as “it is obvious that” or “the same argument applies,” leaving readers to fill in the gaps from their own training. Peer review raises confidence, but limited by reviewers’ time, attention, and coverage of knowledge, it remains essentially probabilistic trust.

    Formal proofs serve verification. Formal languages such as Lean do not accept “the reader should understand”: every object must state its type, every step must identify the premises it depends on, and any logical gap shows up directly as an error that fails the check.

    1. -- Illustration: the machine accepts no omissions; premises and types must be explicit
    2. theorem no_positive_solution
    3. (x y z : ℤ) (n : ℕ) (hn : 2 < n)
    4. (hx : 0 < x) (hy : 0 < y) (hz : 0 < z) :
    5. x ^ n + y ^ n ≠ z ^ n := by
    6. -- Every step must cite a proved theorem; gaps cannot pass
    7. sorry -- the presence of sorry counts as incomplete

    So the significance of 13 million lines lies in coverage and reproducibility, not in length itself. The team behind the experiment also stated the boundaries clearly: this proof is very likely far longer than necessary, several times the size of a general mathematics library, and it is an engineering artifact of remarkable completeness rather than the concise version a human mathematician would pursue. The two kinds of text carry out different tasks along the same proof route and will not replace each other.

    3. How 29,500 Theorems Form One Path: The Engineering Nature of Dependency Management

    Long proofs are most easily dragged down by dependencies. When the number of references reaches tens of thousands of theorems, the real difficulty shifts from “can it be proved” to “how to organize the proof.”

    • The dependency topology must be acyclic. Any circular reference makes the check fail to converge, so explicit dependency-graph management and layered progression are required.
    • Incremental compilation and caching cannot be skipped. The cost of a full recheck rises nonlinearly with scale, so validation must be incremental according to the scope of dependency changes, and passed subgoals must be cached.
    • Failures must be locatable. When multiple agents generate in parallel, one failing low-level lemma invalidates a large amount of upper-level work, so failures must be propagated quickly back to the smallest responsible unit.
    • Intermediate artifacts need versioning. 13 million lines of code mean enormous intermediate states, which must be snapshotted and rolled back using object storage and version management.

    This is exactly where cloud engineering capabilities come into play: container platforms host parallel proof tasks, object storage keeps massive intermediate artifacts, message queues decouple task distribution among agents, and logging services with monitoring and alerting handle failure localization and progress observation. In other words, the bottleneck for landing formal verification in the cloud is often not model capability but the maturity of the infrastructure for this kind of “large-scale, long-chain task.”

    4. The Engineering Paradigm of a Multi-Agent Collaboration System

    The truly reusable part of this experiment is a transferable collaboration architecture:

    1. Task decomposition layer: split the overall goal into lemmas that can be verified independently, forming a directed acyclic dependency graph.
    2. Generation layer: multiple agents try different proof strategies in parallel and produce candidate proofs.
    3. Verification layer: the formal language and proof assistant make the hard decision, and pass or fail is binary.
    4. Backtracking layer: failed goals are decomposed again, descending to more basic definitions and lemmas when necessary.
    5. Aggregation layer: confirm that the final chain closes from the premises to the root node.

    The core advantage of this architecture is that the verification layer provides an absolutely objective signal. Unlike the fuzzy judgment of “looks correct” in conventional code generation, the feedback from formal verification is definite, which makes large-scale parallel trial and error possible and allows failures to be attributed precisely.

    5. Lessons for Enterprise Technical Practice

    Setting aside the mathematics, this experiment offers direct lessons for enterprises building high-assurance systems:

    • Move “verifiability” forward into the design stage. Making types, contracts, and preconditions explicit is equivalent to fitting the system with guardrails a machine can check.
    • Replace subjective review with deterministic verification. Introduce formal methods, model checking, or strong type constraints on critical paths, turning “trust” into “verification.”
    • Control complexity through dependency governance. The reliability bottleneck of large-scale systems usually lies in dependencies, not in individual modules.
    • Use cloud-native infrastructure to carry long-chain tasks. Parallel computing, intermediate-state storage, and observability are all indispensable.

    In summary, the hardest conclusion of this experiment is not “a machine proved Fermat’s Last Theorem” but “a machine checked a complete formal chain to the root node for the first time.” It marks a shift in how the trustworthiness of software and algorithms is built, from relying on human reading and review to relying on repeatable machine verification. For enterprises, the real opportunity is not chasing a particular tool but embedding this methodology of “explicit, verifiable, and traceable” into their own development and verification systems.