arXiv:2607.06341cs.FLcs.AI2026-07

用通用代码智能体自动证明软件正确性,无需预设推理策略。

Harnessing Code Agents for Automatic Software Verification

  • 让大模型自主选择证明路径,不再受限于固定策略。
  • 在Iris系统上100%证明4257个核心引理,零失败。
  • 适合想自动化验证复杂程序的开发者与研究者。

形式化验证能提供最强的软件正确性保证,但难以扩展:交互式定理证明器(如Coq)所需的证明需要大量专家投入。大型语言模型(LLM)有望自动生成这些证明,但现有方法将固定的人工设计证明策略硬编码进系统,限制模型只能按步执行(如逐次检索前提、预测战术或分治拆解目标),且仅能证明目标定理的一小部分。我们表明,强制这种策略既不必要也具有局限性。将完整引理交由通用LLM代码智能体(如Claude Code)自由选择方法,并配合验证框架使用,不仅更简单,而且更高效,实现完全覆盖:所有目标引理均被成功证明,无失败,无需Coq专家干预。该智能体在框架反馈与严格约束下写作证明,确保每个证明逻辑正确(仅当证明内核接受)、完整(无遗漏义务)和终止(无发散战术)。我们在三个维度评估此框架加代码智能体的表现:(1) 核心逻辑:在最先进的并发与内存操作程序分离逻辑Iris上,Aria全自动证明了四个核心模块共4,257个引理,以及基于它构建的Rust标准库217个验证引理;(2) 与先前LLM证明器对比:在reglang上,先前方法仅能证明约八分之一,而Aria成功证明全部318个;(3) 通用性:在尚未完成的Lean 4版本Iris-lean上,证明了72个未迁移引理,表明该方法不限于Coq。顶级模型(Claude Opus 4.7)可全自动完成可信软件开发中的证明任务。

原文摘要 · Abstract (English)

Formal verification offers the strongest guarantee of software correctness, but it does not scale: the proofs demanded by interactive theorem provers such as Coq require enormous expert effort. Large language models (LLMs) promise to generate these proofs automatically, yet existing approaches wire a fixed, human-designed proof strategy into the system and constrain the model to follow it (retrieving premises and predicting tactics one step at a time, or splitting goals by divide-and-conquer), and still prove only a fraction of their target theorems. We show that imposing such a strategy is unnecessary and limiting. Handing the whole lemma to a general LLM code agent (for example, Claude Code), free to choose its own approach, and wrapping it in a verification harness is both simpler and more effective, achieving full coverage: every targeted lemma proved, with no failures and no Coq expert intervention. The agent writes the proofs under feedback and hard constraints from the harness that keep each one sound (accepted only when the prover's kernel closes it), complete (no obligation left unproved or silently dropped), and terminating (no divergent tactics). We evaluate this harness plus code agent along three dimensions. (1) Core logic: on Iris, the state-of-the-art separation logic for concurrent and memory-manipulating programs, Aria proves all 4,257 lemmas of the four core modules and the 217 lemmas verifying Rust's standard libraries built on it, fully automatically. (2) Comparison with prior LLM provers: on reglang, where prior provers manage barely one in eight, Aria proves all 318. (3) Generality: on iris-lean, the unfinished Lean 4 port of Iris, it proves 72 not-yet-ported lemmas, showing the approach is not specific to Coq. A state-of-the-art model (Claude Opus 4.7) can write proofs for verified software development fully and automatically.

自动证明代码智能体形式化验证大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。