Comparisons of classical and prompt-based JML synthesis approaches are compared, and it is found that prompt optimization through verification feedback raises pass rates but reaches a clear ceiling, and Spec-Harness is introduced, a framework that measures the behavioral adequacy of a specification along four dimensions of precondition and postcondition correctness and completeness.
Abstract
Formal specifications play a central role in ensuring software reliability, yet automatically synthesizing high-quality specifications remains difficult and often requires domain expertise. Recent work has applied large language models to generate specifications in the Java Modeling Language (JML), reporting high verifier pass rates. But passing a verifier only confirms that an implementation is consistent with a specification, not that the specification is meaningful. A trivial postcondition such as ensures true satisfies any verifier while saying nothing about the code. How much behavior, then, does a verifier-accepted specification actually capture? In this work, we first compare classical and prompt-based JML synthesis approaches under a unified setup, and find that prompt optimization through verification feedback raises pass rates but reaches a clear ceiling. We then introduce Spec-Harness, a framework that measures the behavioral adequacy of a specification along four dimensions of precondition and postcondition correctness and completeness, using Hoare-triple based symbolic verification and input/output mutation. Spec-Harness reveals that many verifier-accepted specifications, including optimized ones, are behaviorally weak, over- or under-constraining inputs and outputs in ways the verifier cannot see. Finally, we show that Spec-Harness works as a feedback signal that helps coding agents synthesize specifications with higher behavioral adequacy, including general-purpose agents such as Codex CLI and Claude Code, as well as VeriAct, a JML-specialized agent we build for this study.
Formal specification generation is a critical step towards formal verification and correctness assurance of software. Recently, large language models have been widely adopted in automatic generation of formal specifications. However, existing LLM-based specification generation approaches often assume that the input pro...
Wen-Han Wang, Shi-Ming Chen, Ze-Yu Sun et al.· 0 citations
This work presents a model-driven code generator transforming static USF specifications into executable software simulations that abstract cycle-accurate timing and helps shorten validation cycles, ultimately reducing the risk of costly design flaws.
Robert Kunzelmann, Raphael Kunz, Stephanie Ecker et al.· Journal of Signal Processing...· 0 citations
This dissertation aims to make specification recovery from imperfect code accurate, evidence-driven, and uncertainty-aware, so that it consistently yields effective bug-finding tests.
Jun-Da Zhao· Companion Proceedings of the...· 0 citations
Formal verification proves that a program satisfies its specification, but says nothing about whether the specification captures what the author meant. As LLMs increasingly write both code and specifications, a gap between the author's natural-language requirement and the specification becomes a live risk. A machine-ch...
Martín Amster, One An, Holly Baker et al.· 0 citations
VeriCodeBench is introduced, a benchmark for self-spec verifiable code generation, where the LLM relies solely on its own generated specification and code throughout the entire process, and CodeNova is introduced to enhance the capabilities of LLMs in self-spec verifiable code generation.
Jia-Ru Qian, Yihong Dong, Yong-Ming Li et al.· arXiv.org· 0 citations
AI-assisted code generation amplifies the demand for automated formal verification. Generated programs must not only be executable but also accompanied by machine-checkable evidence of correctness. Existing approaches can synthesize functionally plausible code or plausible-looking specifications from natural-language p...
Zian Wang, Qin Li, Wei-Song Sun et al.· 0 citations