计算机科学 > 软件工程
[提交于 2026年8月13日 (v1),最后修订于 2026年11月25日 (此版本, v2)]
标题:How Powerful are LLMs in Generating Formal Program Specifications?
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要:Formal verification provides strong guarantees of software correctness, but its adoption is limited by the high cost of writing precise formal specifications. While recent large language models (LLMs) have shown strong capabilities in theorem proving and verified code generation, their true ability to generate program specifications remains unclear. Existing evaluations require either verifying implementation conformance or proving semantic equivalence between specifications, both of which are formidably difficult and may conflate proof difficulty with specification quality. To address this problem, we introduce Coins, a Rocq based evaluation framework that assesses specification quality by instantiating specifications under evaluation on trusted test cases and generating concrete proof obligations. This design aligns with the asymmetric nature of formal reasoning, where successful proofs provide reliable evidence while proof failures are inherently ambiguous. Using Coins, we conduct a large scale study on HumanEval with a curated set of human written Rocq specifications. Our results show that specification generation remains a formidable challenge, and that verification complexity can obscure genuine differences in specification quality. Overall, we find that accurate specification evaluation, rather than model scaling alone, is central to understanding the power of LLMs for specification synthesis, and that test case based formal reasoning offers a more faithful and discriminative measure of progress.
提交历史
来自:Fanpeng Yang[v1] 2026年8月13日 星期四 10:45:18 UTC (1,783 KB)
[v2] 2026年11月25日 星期三 06:52:47 UTC (1,299 KB)