Manuscript Offprint

arXiv:2610.09681

Cost-Efficient Theorem Proving via Agent Orchestration in Program Verification

Shuangjie Yao, Nikolaus Holzer, Mark Paul Santolucito, Baishakhi Ray, Suman Jana, Dongdong She

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

Abstract

Program verification establishes software correctness through machine-checkable proofs constructed in theorem provers. It's a guarantee especially valuable for code generated by large language models (LLMs), which is fluent but carries no assurance of correctness. Almost all existing provers, however, pursue pass rates alone at whatever sampling or search budget it takes, and overlook the success-vs-cost frontier; yet real software often carries hundreds of interdependent proof obligations, so what matters at scale is not whether one theorem can be proved, but how many can be proved economically. We introduce CoCo-Prover, which formalizes cost-efficient program proving as metalevel decision-making under cost, grounded on two-level proof graphs: an AND/OR proof hypergraph within each declaration is joined to a lemma-dependency graph across declarations; and at each step, it answers two questions: which open goals to select, and which actions to purchase on these goals. Selection stays symbolic as a topological pass over the proof graphs. Action choice is agent orchestration via metalevel decision-making: an agentic router treats every bounded specialist invocation as a separately priced, best-effort computation, matching heterogeneous specialist agents together with configurations, under evolved routing rules as evidence accumulates. On five program verification benchmarks in Lean 4 including function-level CLEVER, VERINA, and AlgoVeri, and repository-level NTP4VC and Vero, we show that CoCo-Prover achieves a better success-vs-cost frontier than baselines including frontier coding agents and state-of-the-art LLM-based provers: it achieves the best solve rate on every benchmark and up to 100% on two benchmarks. It also reduces cost by up to 30.9% compared to the strongest baseline with the strongest LLM in our evaluation.

1 Introduction

Program verification uses formal mathematical reasoning to establish that a program satisfies specified correctness properties [11, 15], providing guarantees that testing, which examines only finitely many executions, cannot offer. Historically, obtaining such guarantees has been expensive, requiring substantial expert effort to construct machine-checkable proofs in interactive theorem provers (ITPs) such as Lean 4 [32], Rocq [45], and Isabelle/HOL [33]. Large language models (LLMs) create an opportunity to reduce this burden: while they can now generate sophisticated programs from natural-language specifications [2, 8], they may also automate the costly process of constructing formal proofs. This possibility has motivated verified code generation [42, 52], where a model generates a program with a machine-checkable proof proving it satisfies the specification. Nevertheless, proof generation remains considerably harder than code generation shown in recent benchmarks VERINA [54], CLEVER [44], and AlgoVeri [57]. Proof generation has therefore emerged as a central bottleneck in program verification and verified code generation.

Real software magnifies this bottleneck. A repository can contain hundreds or thousands of proof obligations with sharply different proof economics [50, 53]. At the same time, a generated proof serves only to verify its program: the checker returns exactly one of two outcomes, and every accepted proof certifies equally. Thus, the natural objective for scalable program verification is the

Figure

(a) Math proving vs. code proving.

(b) Goals within one code-proving task.

Figure 1: The difference between math proving and code proving; and the difference between goals within one code proving task. (a) A theorem in math proving (theorem from Putnam-Bench [46], proof from GoedelArchitect [9]) is stated and proved in the vocabulary of an existing library and strongly dependent on lemma decomposition, whereas a theorem in code proving (theorem from Vero [53]) is stated over definitions the task itself introduces so the proof follows program syntax rather than library priors. (b) Obligations of a single Vero task need different strategies and reasoning efforts: one goal closes under rule-based automation with no model call, two need formal proofs at different reasoning efforts (simple arithmetic versus strong induction), and a recurring fact is better stated as a shared helper lemma.

success-vs-cost frontier—the Pareto frontier between proof success and token cost (or monetary expenditure practically), measured as success under matched cost limits and cost at matched success.

Recent LLM-based theorem provers have shown substantial promise, particularly in mathematical reasoning [1, 9, 27, 36, 48]. Code proving, however, presents a different challenge Figure 1a. Each task introduces a fresh formal context (e.g., the implementation, specification, and often new data types and definitions) and proving correctness requires reasoning about the program's intermediate states. While program syntax often determines the overall proof structure and many side conditions can be discharged mechanically, a few critical obligations require discovering facts not explicit in the program or specification (e.g., the right loop invariant, a sufficiently generalized induction hypothesis). These discoveries often determine whether the entire proof succeeds, yet they are precisely the steps that require substantial semantic reasoning.

This asymmetry creates a distinctive opportunity for code proving: most obligations are routine, but a small number are both difficult and decisive. Existing code provers [14, 23, 47, 58], however, largely ignore this asymmetry, pursuing provability through large sampling or iterative repair budgets and applying similar model-driven procedures across subgoals. Such strategies are particularly costly with frontier general-purpose LLMs and waste substantial computation on obligations that theorem-prover automation or inexpensive model calls could solve directly (Figure 1). Effective code proving therefore requires not simply more reasoning, but identifying where deep reasoning matters and concentrating model computation there.

To address this challenge, we introduce CoCo-Prover, a cost-aware prover that adapts its strategy and reasoning effort to the evolving proof state. Rather than applying the same proof routine to every obligation, CoCo-Prover repeatedly decides what to prove next and how to prove it: whether an obligation can be discharged mechanically, needs direct proof generation, benefits from introducing a reusable helper lemma, or requires recovery from an unproductive proof path. It also controls how much reasoning effort to spend on each action. To make these decisions globally, CoCo-Prover maintains a two-level proof graph that tracks both fine-grained proof progress and dependencies among lemmas. We formalize this process as metalevel decision-making under cost: each proving action is a computation with a cost and an uncertain, verifier-judged outcome, and the prover must decide which computation is worth performing given the current proof state [38]. CoCo-Prover realizes this formulation through an agentic router and four specialized proving agents, using the proof graph and accumulated verifier feedback to adapt its strategy as proving progresses. This turns code proving from a fixed proof-search routine into adaptive orchestration of heterogeneous proving strategies under cost.

We evaluate CoCo-Prover on five Lean program verification benchmarks (function-level CLEVER [44], VERINA [54], and AlgoVeri [57], and repository-level NTP4VC [51] and Vero [53]) against state-of-the-art open-source agentic provers, and each model's official coding agent, with three frontier LLMs under matched caps. No baseline exceeds CoCo-Prover's solve rate on any benchmark and backbone: it solves up to 100% of function-level benchmarks and 60.5% of the large repository-level benchmark Vero while reduces cost by up to 30.9% against the strongest baseline, Humanize on the strongest backbone LLM, GPT-5.6-Terra.

In summary, our contributions are: i) Cost-efficient code proving. We pose cost efficiency, rather than provability alone, as the objective for theorem proving in program verification at the scale of real-world software. ii) Metalevel formulation under cost over two-level proof graphs. We are the first to formalize cost-efficient program proving as metalevel decision-making under cost, grounded on two-level proof graphs. And we instantiate it in CoCo-Prover with agent orchestration. iii) Success-cost evaluation. On five Lean benchmarks and three LLMs, no baseline exceeds CoCo-Prover's solve rate in any setting, and it reduces cost by up to 30.9% against the strongest baseline.

References (51)