一句话:提出 LLM 智能体 LemmaNet,通过程序语义理解离线合成与在线适配辅助引理,自动完成演绎验证中的 VC 证明。
演绎验证通过生成验证条件(VC)并为其构造形式化证明来提供强正确性保证,但 VC 证明高度依赖专家经验,是主要瓶颈。近期基于大语言模型(LLM)的证明智能体虽已部分自动化该任务,却无法发现辅助引理(helper lemma),难以应对规模与复杂度增长的程序。本文指出,程序验证中的 VC 证明不只是纯数学任务,还极大受益于程序理解:人类证明工程师常依据对程序语义的理解发现并应用辅助引理,而这些信息并未直接体现在 VC 生成器的输出中。基于此,作者提出 LLM 智能体 LemmaNet,以两种方式发现辅助引理:先离线分析源码与规约合成引理,并将其语义理解与 VC 生成器产生的机械化、冗长编码相关联;随后在证明展开过程中在线适配已有引理以适应不断演化的证明状态。LemmaNet 实现在现有证明智能体 AutoRocq 之上,面向 Rocq 与 Frama-C 生态,并在 SV-COMP 及 Linux 内核、Contiki OS、标准 C++ 库、X.509 解析器等真实基准上评估,结果显著优于现有最优方法。
Deductive verification provides strong correctness guarantees for code by extracting verification conditions (VCs) and writing formal proofs for them. The expertise-intensive task of VC proving is the main bottleneck in this process, and has been partly automated owing to recent advances in Large Language Model (LLM) agents. However, existing proof agents are not able to discover helper lemmas – auxiliary lemmas that aid in proving – and thus fall short as programs grow in size and complexity. In this paper, we argue that VC proving for program verification is more than a purely mathematical task, and benefits considerably from program comprehension. Our key insight is that human proof engineers often discover and apply helper lemmas based on their understanding of the program semantics, which are not directly reflected in the VCs produced by VC generators. Inspired by this insight, we propose an LLM agent, LemmaNet, that discovers helper lemmas in two ways. Specifically, the agent first synthesizes lemmas offline by directly analyzing the source code and specifications and then relating this semantic understanding to the mechanical, verbose encoding produced by VC generators. As the proof unfolds, LemmaNet then adapts existing helper lemmas online to accommodate evolving proof states, enabling the agent to effectively discharge complex VCs on-the-fly. We implement LemmaNet on top of an existing proof agent AutoRocq for Rocq and the Frama-C ecosystem, and evaluate it on SV-COMP and established real-world subjects, including modules of the Linux kernel, Contiki OS, standard C++ library, and X.509 parser. Our experimental results demonstrate that LemmaNet significantly outperforms state-of-the-art approaches, highlighting the importance of program comprehension-aided lemma discovery in agentic program verification.