arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2311.07948cs.PLcs.LG
收藏

使用大型语言模型寻找归纳循环不变量

Finding Inductive Loop Invariants using Large Language Models

Microsoft Research(微软研究院);Cornell(康奈尔大学);IIT Kanpur(印度理工学院坎普尔分校)

Adharsh Kamath, Aditya Senthilnathan, Saikat Chakraborty, Pantazis Deligiannis, Shuvendu K. Lahiri, Akash Lal, Aseem Rastogi, Subhajit Roy, Rahul Sharma

AI总结:

本文利用大型语言模型生成归纳循环不变量,并通过符号工具验证其正确性,实验表明该方法能提升自动化程序验证的性能。

摘要:

循环不变量是对含循环程序进行推理的基础。它们确立了关于给定循环行为的相关性质。当这些不变量同时具有归纳性时,它们对于形式验证任务变得非常有用,该任务旨在为程序的运行时行为建立强有力的数学保证。归纳性确保不变量可以在不参考整个程序的情况下进行局部检查,因此它们是形式正确性证明中不可或缺的构件。寻找归纳循环不变量是一个不可判定问题,尽管针对实际解决方案的研究已有悠久历史,但它仍然远未得到解决。本文探讨了大型语言模型(LLMs)为这一古老而重要的问题提供新解决方案的能力。为此,我们首先整理了一个包含循环程序的验证问题数据集。接下来,我们设计了一种利用LLMs的提示,以获得归纳循环不变量,并使用可靠的符号工具对其正确性进行检查。最后,我们探讨了在我们的数据集上使用符号工具与LLM的高效组合的有效性,并将其与纯符号基线进行比较。我们的结果表明,LLMs能够帮助改进自动化程序验证的现有技术水平。

英文摘要:

Loop invariants are fundamental to reasoning about programs with loops. They establish properties about a given loop's behavior. When they additionally are inductive, they become useful for the task of formal verification that seeks to establish strong mathematical guarantees about program's runtime behavior. The inductiveness ensures that the invariants can be checked locally without consulting the entire program, thus are indispensable artifacts in a formal proof of correctness. Finding inductive loop invariants is an undecidable problem, and despite a long history of research towards practical solutions, it remains far from a solved problem. This paper investigates the capabilities of the Large Language Models (LLMs) in offering a new solution towards this old, yet important problem. To that end, we first curate a dataset of verification problems on programs with loops. Next, we design a prompt for exploiting LLMs, obtaining inductive loop invariants, that are checked for correctness using sound symbolic tools. Finally, we explore the effectiveness of using an efficient combination of a symbolic tool and an LLM on our dataset and compare it against a purely symbolic baseline. Our results demonstrate that LLMs can help improve the state-of-the-art in automated program verification.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑