Checking AI-Written Code With Math Gets Cheaper: Opus 5.5 Uses 40% Fewer Tokens
Tests and code review can't guarantee that AI-written code has no hidden bug. Formal verification can: the AI writes a mathematical proof, and the Lean program checks every step. This used to be too expensive, but according to Anthropic and Theorem, Opus 5.5 solved 50% of 36 small verification tasks while using 40% fewer tokens than Opus 5. Developers should learn to state their requirements for code precisely.
AI-processed from Latent Space (swyx); edited by Hamidun News
AI agents write more and more code, and "slop" grows with it. In 2026, that is the name for raw, low-quality language model output. Picture this: an agent writes a function that copies data, the tests pass, and the review is done.
But you can't be sure there isn't a rare case where the function reads past the end of an array and opens a security hole. Tests don't give you that certainty. Formal verification, meaning a mathematical proof that a program is correct, does.
It used to be the work of a few specialists, but now AI and the Lean language automate most of it. If you trust agents with more and more of your code, this topic bears directly on your work.
How a proof differs from tests
Clark Barrett is a co-founder and co-CEO of the startup &Truth (pronounced "and truth"), a Stanford professor and one of the creators of cvc5. It is a satisfiability modulo theories (SMT) "solver": a program that automatically determines whether a given condition can be violated. According to Barrett, Amazon uses such tools widely. For example, cvc5 helps analyze specifications and generate tests in Kiro, Amazon's agentic development environment. "It's gratifying to see my tools go from a good idea in a lab to billions of calls a day in Amazon's production pipelines," he said.
When companies say an agent "verifies" its work, they usually mean that it runs tests, critiques its own output or asks another model to grade it. According to Barrett, the main difference is how you know the work is finished. Tests, patches and scanners find plenty of problems, but you have no assurance that there isn't one more bug the tool simply can't see.
A proof works differently. You state a precise requirement, for example "the function never accesses memory outside the array," and you get a guarantee that it holds for all inputs, not just the ones you checked. Lean, an open programming language and proof-checking system, verifies the proof. "Lean simply checks that you haven't made a mistake," Barrett explained. "It's a very sophisticated proofreader for math." That is why it doesn't matter that an AI composed the proof: if Lean accepted it, you can trust it.
Who is building these tools
- &Truth. A newcomer building a "verification machine" on top of Lean. Its goal is to read code in any language, prove that it meets precisely stated requirements, and let people trust the code without reading every line. The first product is &Atlas, a "map of the world's open-source code," starting with C. According to Barrett, the main use case is to go through all C code, open and closed, check its memory safety and point out exactly what to fix.
- Harmonic. Its Aristotle is an automated theorem prover. The company says the AI produces proofs and Lean checks every step, so the result doesn't depend on whether the AI is right.
- Axiom Math. It develops AxiomProver, an AI system that writes proofs in Lean, and AXLE, a set of tools for exploring, checking and transforming them. The company also uses verification in training: proof attempts give models feedback on correctness. In a June interview with Latent Space, Axiom CEO Karina Hong said that for the company this is not only protection against hallucinations but also a path to superintelligence.
- Theorem. It bets on security: "verification is the only defense that works while adversaries scale." Together with Anthropic, the company published a piece arguing that LLMs are making formal software verification real at a much larger scale. Anthropic's approach in that piece is built not on Lean but on a different proof system, Rocq.
For context: according to Vals, this week GPT-6.2 Astra produced what is likely the first Lean proof of Smoktunowicz's Gap Theorem. Vals also reports that Anthropic formalized Fermat's Last Theorem, a project of 13 million lines. Finally, Anthropic mathematician Levent Alpöge reportedly claimed that he used Claude to prove the 167-year-old Riemann hypothesis and posted the proof in Lean. These are claims, not results confirmed by the community, but they show what models are capable of.
What it costs and what to change in your work
The main limitation is cost. Formal verification takes a lot of tokens. But the joint Theorem and Anthropic piece includes an encouraging figure: on 36 small verification tasks, Opus 5.5 solved 50% while using roughly 40% fewer tokens than Opus 5. The authors expect the trend to hold once models are trained on long verification tasks. The caveat matters: these are small tasks, not large industrial codebases.
&Truth proposes replacing "vibe coding" with "veri-coding," in which verification is built into the process. The developer still tells the agent what to build, but first refines the specification together with it. Then the agent works with a verification tool and, according to Barrett, the code should work the first time. More human time will go into writing and reviewing specifications, and less into writing and reviewing code.
The practical takeaway: if agents write more and more for you, your job is to say precisely what "correct" means. It is worth practicing how to state requirements now. And it is worth watching &Atlas, Aristotle and AxiomProver: judging by the companies' statements, the first area will be the security of critical C code.
- Nov 20, 2026Nvidia Put $58.1 Billion Into Other Companies in Nine Months — 12 Times More Than a Year Ago
- Nov 20, 2026Anthropic's IPO Valuation Tops $2 Trillion — 3.5 Times the Entire Russian Stock Market
- Nov 20, 2026METR Updates Its Famous AI Chart: Task Length Doubles Every 4 Months, but Judgment Lags
- Nov 20, 2026In six weeks, Claude derived an exact c/9.1266 bound in black hole physics
Key Questions Answered
How a proof differs from tests?
Clark Barrett is a co-founder and co-CEO of the startup &Truth (pronounced "and truth"), a Stanford professor and one of the creators of cvc5. It is a satisfiability modulo theories (SMT) "solver": a program that automatically determines whether a given condition can be violated. According to Barrett, Amazon uses such tools widely. For example, cvc5 helps analyze specifications and generate tests in Kiro, Amazon's agentic development environment.
Who is building these tools?
&Truth. A newcomer building a "verification machine" on top of Lean. Its goal is to read code in any language, prove that it meets precisely stated requirements, and let people trust the code without reading every line. The first product is &Atlas, a "map of the world's open-source code," starting with C. According to Barrett, the main use case is to go through all C code, open and closed, check its memory safety and point out exactly what to fix. Harmonic. Its Aristotle is an automated theorem prover.
What it costs and what to change in your work?
The main limitation is cost. Formal verification takes a lot of tokens. But the joint Theorem and Anthropic piece includes an encouraging figure: on 36 small verification tasks, Opus 5.5 solved 50% while using roughly 40% fewer tokens than Opus 5. The authors expect the trend to hold once models are trained on long verification tasks. The caveat matters: these are small tasks, not large industrial codebases.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.