paperbot · PL 论文追踪

全部论文 待读 收藏

P0 Can Formal Specifications Be Synthesized from Tests Alone?

仅凭测试能否合成形式规约?
ASE Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering2026匹配度 8/10 · 论文利用 LLM 从测试与动态执行轨迹黑盒推断 JML 形式规约,并用有界模型检验迭代精化,属于“AI→PL:利用 LLM/Agent 改进形式化验证”的核心方向;其黑盒设定与工业落地关切也契合用户研究画像。引用 0 inbox
Tianhai Liu, Maximilian Müller, Tobias Hey, Vitus Lüntzel, Muhammad Minhas, Anne Koziolek, Bernhard Beckert
crossref: 2026-10-09

AI 速览

一句话:用 LLM 仅从测试代码与动态执行轨迹(黑盒)推断 JML 形式规约,并以有界模型检验迭代精化。

形式规约能提供强保证,但手工编写代价高昂。已有基于 LLM 的方法多依赖源码(白盒)推断规约,这在工业落地时因知识产权风险与部署成本而受阻。本文提出仅从测试代码与动态执行轨迹中推断候选规约:LLM 只能观察到程序接口、选定输入以及对应的输出或状态变化,实现内部细节完全隐藏。候选规约随后在本地用有界模型检验进行验证,验证反馈用于引导迭代精化。在 SpecGenBench 基准上的初步结果显示,测试足以引导 LLM 生成有意义的 Java 建模语言(JML)规约,同时也暴露出检验器兼容性与诊断反馈质量是可靠精化的关键挑战。

问题
如何在不访问程序实现内部(白盒)的前提下,低成本地自动获得可靠的形式规约,从而规避知识产权风险与部署成本。
方法
让 LLM 仅观察程序接口、测试输入及对应输出或状态变化来推断候选 JML 规约,再用有界模型检验在本地验证,并以验证反馈驱动迭代精化。
评估
在 SpecGenBench 基准上进行初步实验,考察生成的 JML 规约质量并分析精化过程中检验器兼容性与诊断反馈带来的困难。
原文摘要(Abstract)

Formal specifications offer strong guarantees, but remain costly to write manually. Recent LLM-based approaches automate this by inferring specifications from source code, yet their reliance on white-box access poses barriers to industrial adoption due to intellectual property risks and deployment costs. Our approach uses LLMs to infer candidate specifications solely from test code and dynamic execution traces: the LLM observes only the program interface, selected inputs, and corresponding outputs or state changes, while the implementation internals remain hidden. Candidate specifications are validated locally using bounded model checking, with feedback guiding iterative refinement. Initial results on the SpecGenBench benchmark suggest that tests can guide LLMs towards meaningful Java Modeling Language specifications, while also highlighting checker compatibility and diagnostic feedback as key challenges for reliable refinement.

链接与引用

DOI 原文 · arXiv ·

BibTeX
@inproceedings{paperbot12318,
  title = {Can Formal Specifications Be Synthesized from Tests Alone?},
  author = {Tianhai Liu and Maximilian Müller and Tobias Hey and Vitus Lüntzel and Muhammad Minhas and Anne Koziolek and Bernhard Beckert},
  booktitle = {ASE},
  year = {2026},
  doi = {10.1145/3832783.3834549}
}