TL;DR
Current LLM-based theorem provers are heavily bottlenecked by the high cost and inefficiency of editing plain text and tracking shifting line numbers. This paper introduces Agent over AST (AoA), a framework that shifts the interaction from raw source code to an Abstract Syntax Tree (AST) represented in JSON. By fusing proof states and operations into a single tree structure, AoA slashes API costs by up to 4.7× and token usage by up to 6.9× while achieving state-of-the-art proving performance.
What Problem Does This Paper Address?
Interactive Theorem Proving (ITP) is essential for verifying critical software (like operating system kernels) and formalizing complex mathematics, but it requires immense manual labor. While Large Language Models (LLMs) show promise in automating these proofs, their API costs are currently astronomical—often costing tens to hundreds of dollars to solve a single problem.
The authors trace this bottleneck to a fundamental design flaw: existing agents treat proof generation like standard code generation, operating on serialized plain text. When an LLM modifies a line of code, all subsequent line numbers shift. To check the proof state or locate errors, the agent must make separate, brittle, line-number-based tool calls. This constant back-and-forth inflates token consumption and costs. Furthermore, this text-heavy paradigm makes it hard to adopt newly designed, highly efficient proof languages (like Minilang) because LLMs lack the corpus-scale exposure needed to master their concrete text syntax.
Methods
To solve these issues, the authors present Agent over AST (AoA). Instead of forcing the LLM to write raw proof scripts, AoA lifts the agent's operations directly onto the Abstract Syntax Tree (AST).
- JSON Schema Interface: Minilang’s AST is formalized using JSON Schema. Since modern LLMs are heavily optimized for JSON-based tool calling, they can natively generate and manipulate this structure without needing fine-tuning on the language's text syntax.
- Tree-Edit Proof Model: AoA replaces text patching with direct tree manipulation (using actions like
Fill,Insert Before,Amend, andDelete). Proof operations and the resulting prover states are interleaved within a single "proof tree." Every operation carries its own subgoal state, meaning the LLM can read the current state directly from the tree structure. - Incremental, Compressed Feedback: Instead of returning the entire tree after an edit, the system returns a compressed view that omits unchanged states and collapses successfully proven subtrees, drastically saving input tokens.
The overall pipeline is illustrated in Figure 1:
Datasets
The authors evaluated AoA on two distinct benchmarks:
- miniF2F: A standard benchmark containing competition-style mathematical problems (e.g., from the International Mathematical Olympiad and AIME) used to assess general theorem-proving capabilities.
- NTP4VC-Pearl: A challenging software verification benchmark consisting of verification conditions generated from Why3 programs, covering data structures, algorithms, and calculation-heavy tasks.
Key Insights and Ideas
- Concrete Syntax is Incidental: By abstracting text into an AST, the agent eliminates the fragile indirection of line numbers and file positions.
- Leveraging Native Capabilities: LLMs don't need massive pre-training corpora for a new language if that language's semantic structure can be mapped to JSON Schema—a format the models already understand deeply through tool-calling training.
- State-Operation Fusion: Fusing the proof state directly into the operation nodes turns a multi-step "edit-then-query" loop into a single, self-contained interaction.
Key Results
AoA was evaluated against Amazon's Isabelle Agent using state-of-the-art models. On the common success sets, AoA demonstrated massive efficiency gains:
- Cost & Token Reductions: Cut API costs by 2.3–4.7× and consumed 2.9–6.9× fewer tokens.
- Fewer Tool Calls: Required 3.9–8.9× fewer tool calls, making it 1.4–2.0× faster in elapsed time.
- Absolute Performance: Achieved a 99.6% pass rate on miniF2F (matching the state-of-the-art) and an 89.2% pass rate on the difficult NTP4VC-Pearl benchmark, setting a new state-of-the-art for verification conditions.
- Data Contamination Check: To prove the LLM wasn't just memorizing Minilang, they tested it using Claude Opus 4.5 (released before the Minilang corpus was public). It still achieved a 98.6% pass rate on miniF2F, confirming the system design's success.
The efficiency gains across budgets are visualized in Figure 4:
Limitations and Future Work
- Language Specificity: This approach relies heavily on Minilang's clean, declarative structure, which naturally mirrors human pen-and-paper reasoning. It remains an open question how well this tree-edit model scales to highly tactical, multi-mode proof languages like raw Isar or Lean.
- Evaluation Scale: Due to the extreme financial cost of running the baseline conventional agent, evaluation had to be performed on randomly sampled subsets of the benchmarks rather than the full sets.
- Application to General Coding: The authors suggest that this "Agent-over-AST" methodology could be extended to general software engineering coding agents, particularly for newly designed or experimental programming languages.
Summary updated