arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.15344cs.SE
收藏

计算树逻辑引导的程序修复

Computation Tree Logic Guided Program Repair

Yu Liu, Yahui Song, Martin Mirchev, Abhik Roychoudhury

AI总结:

针对测试用例集引导的程序修复易过拟合的问题,提出基于分层Datalog、扩展SEDL并结合循环摘要的CTL引导无限状态程序修复框架,在两类基准上准确率均优于基线且能修复所有检测到的错误。

摘要:

诸如计算树逻辑(Computation Tree Logic,CTL)之类的时序逻辑已被广泛用作表达丰富行为规范的表达形式体系。CTL能够表达可达性、终止性、不变性和响应性等难以测试的性质。本文提出了一种由CTL性质引导的无限状态程序自动修复机制。我们生成的补丁避免了测试用例集引导的修复中出现的过拟合问题——这类问题中修复后的代码可能无法通过给定测试用例集之外的测试。为实现这一目标,我们提出了一种基于Datalog的修复框架,Datalog是一种广泛用于程序分析的领域特定语言,它通过分层否定可直接支持CTL的嵌套不动点语义。具体而言,我们的框架将程序和CTL性质编码为Datalog事实与规则,并通过修改事实以满足分析规则来执行修复。此前的研究以Datalog符号执行(Symbolic Execution of Datalog,SEDL)的形式提出了一种基于Datalog分析的通用修复机制。然而,SEDL仅支持正Datalog,不足以表达CTL性质。因此,我们对SEDL进行了扩展,使其适用于分层Datalog。此外,活性性质的违反涉及无限计算,我们通过一种新颖的循环摘要方法来处理该问题。我们的方法在小规模基准上实现了56.6%的分析准确率,在真实世界基准上实现了88.5%的分析准确率,优于27.7%和76.9%的最佳基线性能。我们的方法修复了所有检测到的错误,这是现有工具无法实现的。

英文摘要:

Temporal logics like Computation Tree Logic (CTL) have been widely used as expressive formalisms to capture rich behavioral specifications. CTL can express properties such as reachability, termination, invariants and responsiveness, which are difficult to test. This paper suggests a mechanism for the automated repair of infinite-state programs guided by CTL properties. Our produced patches avoid the overfitting issue that occurs in test-suite-guided repair, where the repaired code may not pass tests outside the given test suite. To realize this vision, we propose a repair framework based on Datalog, a widely used domain-specific language for program analysis, which readily supports nested fixed-point semantics of CTL via stratified negation. Specifically, our framework encodes the program and CTL properties into Datalog facts and rules and performs the repair by modifying the facts to pass the analysis rules. Previous research proposed a generic repair mechanism for Datalog-based analysis in the form of Symbolic Execution of Datalog (SEDL). However, SEDL only supports positive Datalog, which is insufficient for expressing CTL properties. Thus, we extended SEDL to make it applicable to stratified Datalog. Moreover, liveness property violations involve infinite computations, which we handle via a novel loop summarization. Our approach achieves analysis accuracy of 56.6% on a small-scale benchmark and 88.5% on a real-world benchmark, outperforming the best baseline performances of 27.7% and 76.9%. Our approach repairs all detected bugs, which is not achieved by existing tools.

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

↑