Integrating Symbolic Execution with LLMs for Automated Generation of Program Specifications
Fanpeng Yang, Xu Ma, Shuling Wang, Xiong Xu, Qinxiang Cao, Naijun Zhan, Xiaofeng Li, Bin Gu

TL;DR
This paper introduces a novel framework combining symbolic execution and large language models to automatically generate accurate, verified program specifications, including invariants and pre/postconditions, improving over existing methods.
Contribution
The paper presents a new template-guided approach that integrates symbolic execution with LLMs to synthesize and refine program specifications without external verification goals.
Findings
Outperforms state-of-the-art tools on benchmarks
Achieves high precision in specification synthesis
Effectively handles numerical and data-structure programs
Abstract
Automatically generating formal specifications including loop invariants, preconditions, and postconditions for legacy code is critical for program understanding, reuse and verification. However, the inherent complexity of control and data structures in programs makes this task particularly challenging. This paper presents a novel framework that integrates symbolic execution with large language models (LLMs) to automatically synthesize formally verified program specifications. Our method first employs symbolic execution to derive precise strongest postconditions for loop-free code segments. These symbolic execution results, along with automatically generated invariant templates, then guide the LLM to propose and iteratively refine loop invariants until a correct specification is obtained. The template-guided generation process robustly combines symbolic inference with LLM reasoning,…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
