Six Weeks and Ten Million Lines of Code: Engineering Lessons from AI-Assisted Formal Proofs

    This article examines a widely discussed case in which a young mathematician used AI coding assistance and formal proof tools to close a classic number theory problem in weeks, producing proof code on the order of ten million lines. It focuses on the engineering questions raised by the case: how to trust machine-generated code, what role human researchers play, and how to store, search, and reproduce massive proof assets. It then explains why formal proofs must be machine-checkable, outlines the architecture needed at this scale across storage, retrieval, build, and observability, and proposes a three-layer division of labor between humans and machines. It closes with security practices and a practical checklist for technical teams.

    1. The Event in Abstract: Human Intuition Meets Machine Compute

    A technical event that has drawn wide discussion: a young mathematician used intelligent coding tools and formal proof assistants to complete a formal closure of a classic number theory problem within weeks, producing proof code on the order of ten million lines. The controversy is not about the result itself but about three engineering questions. First, how can the trustworthiness of machine-generated code be guaranteed? Second, what role does the human researcher actually play in the loop? Third, how do storage, retrieval, and reproduction support proof assets at this scale?

    The technical core of such an event is independent of any specific product. What developers and research teams can borrow is the methodology as a whole: long-horizon human-machine collaboration, formal verification, and large-scale code asset management. Similarly, in technical practice at Baidu AI Cloud, general cloud capabilities such as large-scale code hosting, build pipelines, and logging with monitoring alerts form the same kind of foundation for very long-running tasks.

    2. Why Formal Proofs Must Be Machine-Checkable

    Traditional mathematical proofs rely on peer review, which has long cycles, limited coverage, and cannot handle reasoning chains of a million lines or more. The core idea of a formal proof is to write every inference step in a formal language that a kernel can check line by line, with a proof assistant performing the verification automatically. The value comes in three parts:

    1. Trust does not depend on the author’s reputation: the kernel accepts only derivations permitted by the rules, and any skipped step is rejected.
    2. Reproducibility: given the same formal script and the same dependency versions, anyone can re-verify the proof.
    3. Incremental maintainability: proofs are split into lemma layers, so a local change does not overturn the whole.

    A schematic structure of a formal declaration looks like this (pseudocode, expressing only the layering idea):

    1. theorem main_claim :
    2. ∀ x, P x → Q x
    3. proof
    4. apply lemma_stage_1
    5. apply lemma_stage_2
    6. exact core_invariant

    This pattern of “layered lemmas plus kernel checking” is closely analogous to unit testing and contract-based design in software engineering: it turns “I believe it is correct” into “the machine has verified it is correct.”

    3. Engineering Architecture for Ten-Million-Line Proofs: Storage, Retrieval, and Build

    Once a proof reaches ten million lines, the problem shifts from mathematics to systems engineering.

    • Storage layer: massive numbers of small files put heavy pressure on metadata. Object storage is typically used for cold data and a versioned repository for hot data, with chunking and compression to reduce size. The “compression progress” mentioned in the original is essentially the compression dividend that comes from high redundancy in very large text.
    • Retrieval layer: the proof library must be searchable by lemma name, type signature, and dependency graph, which requires both inverted indexes and symbol indexes.
    • Build layer: incremental compilation and caching are critical. If the dependency hash is unchanged, artifacts can be reused, cutting a full verification from hours to minutes.
    • Observability: long-running tasks must be wired into logging and monitoring with alerts, with thresholds set for “silent process,” “memory jitter,” and “verification failure rate,” so that weeks of work are not voided by a single silent failure.

    A simplified incremental verification flow:

    1. for each lemma in dependency_graph:
    2. key = hash(lemma.source, lemma.dependencies)
    3. if cache.hit(key): continue
    4. result = kernel_check(lemma)
    5. cache.put(key, result)
    6. emit_metric(result)

    4. Division of Labor: Who Pulls the Trigger, Who Makes the Bullets

    The essence of the dispute is attribution of contribution. A more rigorous split has three layers:

    1. Problem formalization layer (human-led): translating a natural-language conjecture into a machine-decidable proposition. This step determines success or failure, and machines cannot replace it.
    2. Strategy search layer (machine-led): searching a huge proof state space for usable lemma combinations, with humans supplying heuristics and pruning constraints.
    3. Verification and archiving layer (machine-led, human-audited): the kernel checks line by line, while humans spot-check key lemmas and write readable explanations.

    So both “AI did it independently” and “the human only pressed a button” are oversimplifications. The reusable engineering conclusion is to leave the non-automatable parts to human experts, hand the parallelizable and exhaustively searchable parts to compute, and use the formal kernel as the single judge.

    5. Security and Ethics: When Publication Meets Threats

    The “fatal threats” mentioned in the event are a reminder that teams must design for security up front:

    • Minimize disclosure of personal identity information and temporary addresses before publication;
    • Enable tiered permissions and operation auditing on collaboration repositories;
    • Keep multiple copies and off-site backups of key results to prevent single-point loss;
    • Establish an external communication line to avoid emotional confrontation amplifying risk.

    6. A Practical Checklist for Technical Teams

    • Pilot formal verification in a low-risk scenario (such as a protocol state machine or compiler invariants);
    • Define lemma layering conventions and naming rules, and prohibit cross-layer direct connections;
    • Build incremental caching and dependency hashing so verification becomes a daily action;
    • Wire in unified logging and monitoring alerts, with dual thresholds for silence and failure;
    • Create a security checklist for releasing results and disclosing information.

    The conclusion is clear: the transferable asset in such an event is not a specific tool but a culture of machine-checkable correctness. When a team upgrades correctness from manual review to kernel checking, long-horizon, very large-scale complex engineering finally has a foundation that is deliverable, reproducible, and maintainable.