Program Structure Aware Precondition Generation(感知程序结构的前置条件生成)
Program Structure Aware Precondition Generation
AI总结:
本研究提出一种感知程序结构的前置条件生成方法,以目标方法结构为种子通过程序变换推断前置条件,提升了前置条件的可读性与可理解性,还构建了含约1.8万组Java方法-前置条件对的数据集用于评估与后续研究。
摘要:
我们提出了一种从代码中推断自然语言前置条件的新方法。该技术生成的前置条件在正确性(以测试生成器为验证基准)和自然度两方面均具备高质量。现有研究通过布尔谓词组合从零生成前置条件,但在可读性和易理解性上存在不足。我们的核心创新在于,转而以目标方法的结构为种子,通过程序变换推断前置条件。评估结果表明,人类更容易对本方法推断出的前置条件进行逻辑推理。最后,我们将该技术落地为可大规模应用的框架。我们将框架应用于87个真实项目,构建了包含约1.8万组Java(方法,前置条件)对的数据集,既用于评估本方法,也为前置条件推断的未来研究提供有价值的洞见。
英文摘要:
We introduce a novel approach for inferring natural preconditions from code. Our technique produces preconditions of high quality in terms of both correctness (modulo a test generator) and naturalness. Prior works generate preconditions from scratch through combinations of boolean predicates, but fall short in readability and ease of comprehension. Our innovation lies in, instead, leveraging the structure of a target method as a seed to infer a precondition through program transformations. Our evaluation shows that humans can more easily reason over preconditions inferred using our approach. Lastly, we instantiate our technique into a framework which can be applied at scale. We present a dataset of ~18k Java (method, precondition) pairs obtained by applying our framework to 87 real-world projects. We use this dataset to both evaluate our approach and draw useful insights for future research in precondition inference.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。