Formal Verification at Scale: How AI-Assisted Proofs Are Becoming Software Engineering

    A young mathematician used AI coding and automated reasoning tools to complete a proof of a century-old conjecture related to prime distribution in a remarkably short time, then published tens of millions of lines of formal proof code. This article looks past the ensuing controversy to the engineering paradigm it reveals: managing mathematical proofs like software projects. It explains the three-layer architecture of formal proof systems, breaks down formalization, proof search, and human-machine collaboration, and outlines the scheduling, reproducibility, and observability practices needed to run proof workloads at scale, along with common pitfalls and a practical starting path for development teams.

    1. Background: An Industry Shock from a Human-Machine Joint Effort

    A young mathematics researcher used intelligent coding and automated reasoning tools to complete a proof of a century-level conjecture related to prime distribution in an extremely short time, and publicly released tens of millions of lines of formal proof code. Once the news spread, the comment sections quickly split into two camps: some saw it as an epoch-making achievement, while others questioned whether the real contributor was the human or the model. Extreme personal attacks even appeared.

    Setting aside the noise, the most valuable part of this event for developers is not “who won,” but that it exposes a maturing technical paradigm: treating mathematical proofs as software engineering. When a proof reaches the scale of tens of millions of lines, it is no longer pen-and-paper derivation but a large engineering project that requires version control, dependency management, continuous integration, reproducible builds, and compute scheduling.

    2. Technical Foundation: Why Formal Proofs Can Be Called “Engineering”

    The core idea of a formal proof is to rewrite every step of reasoning in a formal language that a computer can check, so that the correctness of the conclusion does not depend on a reviewer’s trust but on the mechanical verification of a kernel. The industry usually divides such systems into three layers:

    • Kernel layer: a minimal, auditable trusted base responsible for checking inference rules;
    • Proof library layer: a collection of formalized definitions, lemmas, and theorems, similar to a dependency repository;
    • Strategy layer: automation search and hint mechanisms responsible for “where to go next.”

    This three-layer structure is highly isomorphic to the “runtime, dependency libraries, framework” of everyday development, so engineering experience transfers directly. A common misconception is to treat it as “AI writing math”; in practice it is closer to “large-scale refactoring under extremely strong type constraints.”

    3. Key Capabilities: From Conjecture Statement to Verifiable Conclusion

    3.1 Formalization: Translating Natural Language into Types

    The first step is to turn a vague problem statement into an unambiguous formal language. The difficulty here is not syntax but definition selection: different equivalent definitions of the same concept can make the difficulty of the subsequent proof differ by orders of magnitude.

    1. -- Illustration: equivalent characterization of prime distribution (pseudocode, structure only)
    2. def PrimeCounting (x : ℝ) : ℕ := { p : ℕ | p ≤ x ∧ p.Prime }.card
    3. theorem pi_asymptotic (x : ℝ) (hx : 1 ≤ x) :
    4. (PrimeCounting x : ℝ) / (x / Real.log x) =ᶠ[Filter.atTop] 1 := by
    5. sorry -- Placeholder: in a real project this is a combination of thousands of lines of lemmas

    3.2 Proof Search: Strategies as “Automation Assistants”

    The strategy layer handles a great deal of repetitive work: simplification, rewriting, linear algebra and polynomial normalization, finite enumeration, and so on. What really determines success or failure in engineering is the search budget and backtracking strategy, not whether a single tactic is “clever.”

    1. # Illustration: layered search budget
    2. layer-1: structural simplification and type checking budget = seconds
    3. layer-2: algebraic normalization and congruence reasoning budget = minutes
    4. layer-3: automatic construction of local lemmas budget = hours, fall back and log on failure

    3.3 Human-Machine Collaboration: Write the Division of Labor into the Process

    From the public timeline, the effective pattern for this kind of effort is “humans set the direction, machines fill in the details”: humans choose definitions, split lemmas, and judge which paths are worth investing in; machines fill the gaps in the chosen paths. The engineering lesson is to explicitly model judgments that cannot be automated as milestones, and hand the rest to automation tasks that can run in parallel.

    4. Compute and Engineering Orchestration: Running Tens of Millions of Lines

    Once the scale grows, the bottleneck shifts from “algorithms” to “scheduling.” Reusable general practices include:

    • Separating compute from storage: put proof artifacts and intermediate state in object storage and keep compute nodes stateless for easy elastic scaling;
    • Task sharding and message-driven execution: split lemmas into a DAG, distribute them with a message queue, and automatically re-enqueue failed tasks;
    • Containerized reproducible builds: pin toolchain versions to ensure verification results are consistent across any node;
    • Full-pipeline observability: logging services record every strategy attempt, and monitoring alerts watch verification failure rates and queue backlogs;
    • Cache reuse: cache verified lemmas by content hash to avoid re-proving.

    Illustrative flow:

    1. conjecture statement → definition selection → lemma DAG split → shard and enqueue → containerized verification
    2. ↑ ↓
    3. └──── failure fallback and cache hits ←── result aggregation and kernel re-check

    5. Common Pitfalls and a Checklist to Avoid Them

    1. Trusted base bloat: introducing too many custom tactics makes “verifiable” nominal only, so audit regularly;
    2. Definition drift: mixing equivalent definitions makes later lemmas unreusable, so freeze core definitions first;
    3. Non-reproducibility: toolchain drift makes CI flaky, so versions must be locked;
    4. Uncontrolled compute: search without a budget cap consumes costs, so set layered timeouts and circuit breakers;
    5. Unclear attribution: human-machine projects should keep decision logs that make clear who proposed and who verified each step.

    6. Practical Advice for Developers

    If your team wants to try similar capabilities, start with “small-scale verifiability”: first pick a problem domain with clear boundaries and mechanically checkable conclusions, make version control, CI verification, caching, and observability solid, and then gradually expand the proof library. In these scenarios, Baidu AI Cloud typically plays the role of a general foundation: elastic compute carries sharded verification, object storage holds proof artifacts, message queues handle task distribution, and logging and monitoring ensure observability, letting teams focus on formal modeling itself.

    7. Conclusion

    The focus of the controversy will eventually fade, but the engineering methods it leaves behind will settle. When a “proof” becomes a software asset that can be built, tested, and rolled back, developers face not a mysterious genius narrative but a rigorous process they can learn and reuse. This is the real technical dividend of this event.