arXiv:2605.03822 · 中英对照阅读
KVerus:面向 Rust 代码的可扩展且稳健的形式化验证证明生成
KVerus: Scalable and Resilient Formal Verification Proof Generation for Rust Code
中文速览
Rust 仓库里的形式化证明常常要跨文件找定义、挑已有引理,还得跟上 Verus 工具链变化,人工维护成本很高。KVerus 会先按代码依赖整理相关上下文,再根据引理的逻辑含义检索可复用证明,并把 Verus 的报错反馈给模型逐轮修补,最后仍由验证器检查、工程师审阅。它在 Asterinas 内存管理模块中补上了 23 个此前未验证函数的证明,新增 6 条可复用引理,相关代码通过验证并被上游接收;在跨文件基准上的成功率也达到 51%,远高于对照方法的 4.5%。这说明大模型不只能为小例子生成证明,也有机会融入真实 Rust 项目的验证与维护流程,同时让工具检查和人工把关继续守住正确性与可维护性。
摘要
仓库级形式化验证在 Rust 系统中正逐渐变得实用,但在真实项目中维护和扩展证明仍然代价高昂。在 Asterinas Rust 操作系统内核中,CortenMM 内存管理模块要求 Verus 证明跨越文件和模块边界,复用文档有限的项目专用引理,并适应 Verus/工具链的频繁演进。现有基于大语言模型的证明生成方法大多针对小型或单文件任务设计,无法为这类仓库级验证工作流提供所需的项目结构知识或面向验证器的修复能力。
Repository-scale formal verification is becoming practical for Rust systems, but maintaining and extending proofs remains expensive in real projects. In the Asterinas Rust OS kernel, the CortenMM memory-management module requires Verus proofs that cross file and module boundaries, reuse project-specific lemmas with limited documentation, and survive frequent Verus/toolchain evolution. Existing LLM-based proof-generation methods are mostly designed for small or single-file tasks, and they do not provide the structural project knowledge or verifier-aware repair needed in such a repository-scale verification workflow.
术语表
- KVerus
- KVerus
- Verus
- Verus
- Rust
- Rust
- Asterinas
- Asterinas
- CortenMM
- CortenMM
- repository-scale formal verification
- 仓库级形式化验证
- LLM-assisted proof generation
- 大语言模型辅助证明生成
- dynamic knowledge base
- 动态知识库
- dependency-aware context extraction
- 依赖感知上下文提取
- semantic lemma retrieval
- 语义引理检索
- error-driven refinement
- 错误驱动的迭代改进
- verifier diagnostics
- 验证器诊断信息
- Semantic-Structural Gap
- 语义—结构鸿沟
- proof obligation
- 证明义务
- specification
- 规约
- precondition
- 前置条件
- postcondition
- 后置条件
- lemma
- 引理
- trait bound
- 特征约束
- state-machine invariant
- 状态机不变式
- ghost proof code
- 幽灵证明代码
- SMT automation
- SMT 自动化
- toolchain
- 工具链
- Verus-Bench
- Verus-Bench
- AutoVerus
- AutoVerus
- Coq/Rocq
- Coq/Rocq
- VST-A
- VST-A
- upstream acceptance
- 上游接纳