TRANSMISSION // 2612.02353v1

Can AI Turn a Quantum Physics Textbook Into Verified Code?

Source published

An AI-agent system translated much of a quantum-information textbook into Lean proofs, but machine-checking those proofs does not establish that they mean what the book intended.

AI-generated conceptual illustration for Can AI Turn a Quantum Physics Textbook Into Verified Code?
AI-generated conceptual illustration; not documentary evidence.

Proof assistants such as Lean check whether formal proofs follow from formal assumptions. A new preprint applies AI agents and Lean 4 to a textbook-scale physics project: translating results from Nielsen and Chuang’s quantum-information textbook into a reusable, machine-checkable library.

From textbook claims to machine-checkable proofs

A proof assistant such as Lean checks formal statements and proofs according to fixed logical rules. But physics adds another question: does a formal statement represent the physical claim in its source? A proof can be logically sound while stating a narrower or different result than the original text.

Weichen Winston Yin and colleagues describe an AI-agent system designed to address this challenge at scale. Its target was the finite-dimensional quantum mechanics in Quantum Computation and Quantum Information by Michael Nielsen and Isaac Chuang. The researchers supplied the system with the source text, a mathematical foundation and a fixed set of quantum-mechanics postulates. The agents planned, wrote, reviewed and revised Lean 4 code, coordinating through shared knowledge graphs that tracked concepts and dependencies.

The library separates general mathematics from physics. Its six postulates—covering states, observables, measurement, collapse, evolution and composite systems—form a boundary between the two. Automated “grounding” checks prevent physics statements in designated layers from bypassing those postulates and referring directly to underlying mathematical objects. This design makes it possible to trace formal physics claims back to the assumptions they use.

Each proposed code change also had to pass Lean’s proof checker and a panel of up to three AI reviewers. The reviewers assessed faithfulness to the textbook, physical meaning, whether a statement was non-vacuous, and code quality. No human intervened in the content or direction of individual textbook items during the run, though researchers set the postulates and review rules in advance.

Broad coverage, with an important qualification

Of the book’s 687 items, the researchers judged 509 to be within scope. The system formalised 505, adding 7,708 theorems and 1,898 definitions. It set aside four items about computational cost because the library had no model for expressing cost. Other exclusions included material such as essay questions, plots and content requiring infinite-dimensional Hilbert spaces.

Passing Lean’s checks did not settle whether each formalisation captured the book’s full meaning. In a separate audit by AI agents applying rules fixed by the authors, 433 of the 505 formalised items were judged complete, 56 partial and 16 borderline. Missing elements often involved features the library could not yet express, such as operation counts, explicit circuits or fault-tolerant constructions.

The project also corrected 28 printed statements. A separate AI review judged 24 to be errors and four to be ambiguities that could be resolved by clarifying the wording. The paper says 20 of the errors had already appeared in errata or published solutions; the other four were minor. The authors note that some formal refutations did not precisely establish the negation of the printed claim, underscoring why the corrections also needed review.

The library was subsequently used to formalise results beyond the textbook, including material from three research papers and 28 landmark theorems. This demonstrates that it could serve as a foundation for further formalisation in the project; it does not establish that the approach works for every area of physics.

What the proof checker can—and cannot—guarantee

Lean verifies that a formal proof follows from its formal definitions and assumptions. It cannot, on its own, certify that those definitions faithfully capture a textbook’s intended physics. The paper illustrates the distinction with separate tests that started without most of the accumulated library: AI judges accepted formal statements that missed or weakened the original claim. The authors argue that a shared foundation helps later results reuse established concepts, but reuse cannot by itself confirm that the foundation is correct.

The semantic audit also has limits. It relies substantially on AI reviewers, and the authors say some failures of meaning do not have a complete automatic solution. The project used a fixed, finite-dimensional postulate layer; it did not cover every topic in the book or all of quantum physics. The public release differs in some technical details from the library at the end of the run, and the paper notes that the grounding linters are not included in that release.

This preprint reports a substantial proof of concept: AI agents can help build a large, interconnected formal library from a physics textbook, and Lean can check the mathematics encoded in it. Whether each formal statement preserves the intended physical meaning remains a separate question, requiring careful auditing.

Reviewed cross-references

These connections were reviewed by a model, not independently fact-checked by a human. Similarity does not imply agreement; consult the original papers and the evidence below.

  • Can AI Make Scientific Reasoning Easier to Check?

    Shared method: Both papers use Lean 4 to machine-check formal reasoning built from explicit assumptions: Yin et al. formalise finite-dimensional quantum mechanics from mathematical foundations and quantum postulates, while Medvedev et al. describe checking scientific deductions from assumptions reviewed by a human. The scope and workflows differ, and the latter’s examples do not establish that the quantum formalisation approach generalises to other sciences.

    Model review: · openai-codex/gpt-6-luna

    Evidence and provenance

    Selected excerpts, not complete papers. PDF extraction can omit figures or damage equations, tables and reading order; sources may be preprints.

    • 2612.02353v1 — Original paper

      Excerpt reference: static/papers/2612.02353v1.md:13-52
      Basis: Paper text
      Source file SHA-256: 1cb682c3acaa80ffcd4720f5c4457a84452d9d0be5c5286549535eaaddabfc93

    • 2611.26754v1 — Original paper

      Excerpt reference: static/papers/2611.26754v1.md:12-93
      Basis: Paper text
      Source file SHA-256: 7cb6cec0bb572a9439141ab97d66b8d163f395242a4a78b6b5500173a4680332

    • 2611.26754v1 — Original paper

      Excerpt reference: static/papers/2611.26754v1.md:94-204
      Basis: Paper text
      Source file SHA-256: 7cb6cec0bb572a9439141ab97d66b8d163f395242a4a78b6b5500173a4680332

Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.