用大模型自动补全Dafny程序中的多个辅助断言,降低形式化验证门槛。
Inferring multiple helper Dafny assertions with LLMs
- 结合大模型预测与错误信息启发式方法,定位缺失断言
- 单缺失断言场景验证成功率63.4%,多缺失达31.7%
- 证明可多种修复路径,不必恢复所有原始断言
Dafny验证器提供强正确性保证,但常需大量手动辅助断言,成为推广的主要障碍。本文研究利用大语言模型(LLMs)自动推断Dafny程序中缺失的辅助断言,重点关注多个断言缺失的情形。为支持研究,我们扩展了DafnyBench基准,构建了移除一个、两个或全部断言的精选数据集,并引入断言类型分类体系以分析推断难度。提出一种混合方法,通过大模型预测结合错误信息启发式进行故障定位。实现工具DAISY(Dafny Assertion Inference SYstem)。尽管聚焦于多断言缺失,也评估了单断言情况:DAISY在单缺失场景下成功验证63.4%的程序,在多缺失场景下为31.7%。值得注意的是,许多程序可用比原数量更少的断言被验证,表明证明存在多种有效修复策略,恢复全部原始断言非必需。结果表明,自动化断言推断可显著降低证明工程工作量,是迈向更可扩展、易用的形式化验证的重要一步。
原文摘要 · Abstract (English)
The Dafny verifier provides strong correctness guarantees but often requires numerous manual helper assertions, creating a significant barrier to adoption. We investigate the use of Large Language Models (LLMs) to automatically infer missing helper assertions in Dafny programs, with a primary focus on cases involving multiple missing assertions. To support this study, we extend the DafnyBench benchmark with curated datasets where one, two, or all assertions are removed, and we introduce a taxonomy of assertion types to analyze inference difficulty. Our approach refines fault localization through a hybrid method that combines LLM predictions with error-message heuristics. We implement this approach in a new tool called DAISY (Dafny Assertion Inference SYstem). While our focus is on multiple missing assertions, we also evaluate DAISY on single-assertion cases. DAISY verifies 63.4% of programs with one missing assertion and 31.7% with multiple missing assertions. Notably, many programs can be verified with fewer assertions than originally present, highlighting that proofs often admit multiple valid repair strategies and that recovering every original assertion is unnecessary. These results demonstrate that automated assertion inference can substantially reduce proof engineering effort and represent a step toward more scalable and accessible formal verification.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。