AutoSpec: Towards Verifiable Software Development via Automated Theorem Proving

Guchan Li, Hongning WangarXiv 2026

TL;DR

Testing your code can show the presence of bugs, as the old saying goes, never their absence. AutoSpec introduces a Rust-to-Lean toolchain and benchmark that lets AI coding agents mathematically prove that real-world software implementations match their specifications. By watching agents struggle and succeed in this interactive proving ground, the authors uncover the exact bottlenecks holding AI back from writing 100% verifiable software.

What Problem Does This Paper Address?

As AI coding agents write more of our software, how do we know their code actually works? Unit tests catch edge cases, but formal verification provides ironclad, mathematical guarantees.

Traditionally, you had two painful options for verification: use automated SMT solvers (which limit what properties you can express) or rewrite your entire program from scratch inside an Interactive Theorem Prover like Lean 4 (which requires PhD-level expertise). A promising middle ground is translation-based verification—tools like Aeneas leverage Rust’s strict ownership rules to mechanically translate standard Rust code into pure functional Lean code without messy memory-heap modeling.

However, Aeneas struggles with numerical algorithms (it doesn't support floating-point math, and machine-level bit-vectors make high-level math proofs miserable). Furthermore, existing "vericoding" benchmarks usually ask chat models to write code, specs, and proofs all at once, or rely on LLMs to translate code (risking semantic drift). Nobody had isolated the core challenge: given an existing, mechanically translated program and a human-approved mathematical spec, can an interactive coding agent prove it works?

Methods

AutoSpec builds on top of the Charon and Aeneas Rust-to-Lean translation pipeline, adding two clever upgrades to bridge the gap between systems programming and pure math:

  1. Numerical Retargeting: Instead of getting bogged down in IEEE-754 floating-point quirks or integer overflow bounds, AutoSpec intercepts numeric operations in the intermediate representation (LLBC). It maps Rust's f64 and integer types to idealized mathematical structures in Lean (like exact rationals Rat, real numbers $\mathbb{R}$, or unbounded Int/Nat). This trades bit-level machine fidelity for the ability to use Mathlib (Lean’s massive library of formalized mathematics) to prove algorithmic correctness.
  2. Term Simplification: Aeneas wraps computations in a Result monad to handle potential failures, which makes basic arithmetic clunky to prove things about. AutoSpec runs a post-processing pass to rewrite arithmetic over retargeted types into clean, pure expressions.

For evaluation, rather than using simple chat prompts, the authors place eight modern AI models inside full coding agent harnesses (like Claude Code and Codex) equipped with a Lean Language Server (LSP) and a generous budget of 100–400 tool calls to inspect states, read files, and iterate on errors.

Datasets

The authors introduce the AutoSpec benchmark, consisting of 159 self-contained Rust testcases paired with manually written Lean specifications across nine domains (graphs, matrices, cryptography, dynamic programming, etc.).

  • Tier 1 (93 cases): Everyday algorithms (~87 lines of Rust) with direct mathematical specs.
  • Tier 2 (66 cases): Competitive-programming-scale algorithms (~289 lines of Rust) requiring deeper mathematical insights and named theorems from the literature.

They also compare proof structures against a reference Lean formalization of Navier–Stokes and Euler blow-up results (written by GPT-6 Astra) to contrast software verification with pure math.

Key Insights and Ideas

  • Software proofs aren't shaped like pure math proofs: Comparing AutoSpec proofs to the Navier–Stokes math corpus revealed a striking structural divide. Pure math proofs chain together intermediate claims, whereas program verification proofs use goal decomposition more than twice as often (27.6% vs. 11.8% of tactics) just to untangle branches, loops, and control flow.
  • Loops are the ultimate boss: While the median theorem takes just 8–10 tactic steps, the largest 10% of theorems swallow up 48.5% of all tactic effort—and these monsters are almost exclusively tied to loops, recursion, and invariants.
Figure 1: Proof-tree size by benchmark category.
  • Mathlib is remembered; verification libraries must be hunted down: Agents rarely open Mathlib source files (Claude Opus 5.5 accessed only 6.1% of the Mathlib files it cited!), proving they recall general math from pretraining. Conversely, agents don't know the niche Aeneas verification library by heart and burn massive amounts of their tool-call budget clumsily searching its files.
  • A simple "cheat sheet" works wonders—up to a point: Giving a struggling agent a case-agnostic guidance file (with Aeneas lemma maps and loop templates) quadrupled its library exploration efficiency and tripled its solved cases—yet it still solved zero new graph problems, proving that complex structural reasoning remains a distinct, hard bottleneck.

Key Results

Performance across the eight evaluated agents varied wildly, showing the benchmark is far from saturated:

Evaluation results across all eight coding agents and nine algorithmic categories.
  • Claude Opus 5.5 dominated the leaderboard, verifying 73.0% of all testcases (89.2% on Tier 1, dropping to 50.0% on Tier 2).
  • GPT-6 Sol took second place at 18.9% overall, followed by GPT-5.6 Sol (12.6%), DeepSeek V4.1 Flash (10.7%), and GLM 5.3 (10.1%).
  • Graph, matrix, and dynamic programming tasks were brutal across the board—outside of Opus 5.5, no agent solved a single matrix problem.
  • In the guidance ablation, DeepSeek V4.1 Flash jumped from 17 solved cases (10.7%) to 51 solved cases (32.1%), boosting its Aeneas file exploration efficiency from 10.5% to 43.2%.

Limitations and Future Work

Because AutoSpec relies on Charon and Aeneas, it only supports a clean subset of Rust—no unsafe blocks, complex generics, general mutable references, or trait-heavy abstractions yet. Furthermore, because numerical retargeting maps f64 to idealized rationals or reals, the resulting proofs guarantee the algorithmic math is sound, not that the code is immune to IEEE-754 floating-point rounding bugs or bit-level overflows. Future work aims to broaden Rust language coverage and integrate verified floating-point libraries to connect high-level mathematical proofs all the way down to bit-precise machine execution.

Summary updated

BibTeX
@misc{li2026autospec,
  author = {Guchan Li and Hongning Wang},
  title = {{AutoSpec: Towards Verifiable Software Development via Automated Theorem Proving}},
  year = {2026},
  eprint = {2611.37395},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.37395},
}
Figure