Saved in:
Bibliographic Details
Main Authors: Chen, Zehan, Zhang, Long, Zhang, Zhiwei, Zhang, JingJing, Zhou, Ruoyu, Shen, Yulong, Ma, JianFeng, Yang, Lin
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2509.09917
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866914300074917888
author Chen, Zehan
Zhang, Long
Zhang, Zhiwei
Zhang, JingJing
Zhou, Ruoyu
Shen, Yulong
Ma, JianFeng
Yang, Lin
author_facet Chen, Zehan
Zhang, Long
Zhang, Zhiwei
Zhang, JingJing
Zhou, Ruoyu
Shen, Yulong
Ma, JianFeng
Yang, Lin
contents Traditional formal specification generation methods are typically tailored to specific specification types, and therefore suffer from limited generality. In recent years, large language model (LLM)-based specification generation approaches have emerged, offering a new direction for improving the universality of automated specification synthesis. However, when dealing with complex control flow, LLMs often struggle to precisely generate complete specifications that cover substructures. Moreover, the distinctive verification pipelines adopted by existing approaches may incorrectly discard logically correct specifications, while verification tools alone cannot reliably identify correct specifications. To address these issues, we propose SLD-Spec, an LLM-based specification generation method that combines program slicing and logical deletion. Specifically, SLD-Spec augments the conventional specification generation framework with two key stages: (1) a program slicing stage that decomposes the target function into several smaller code slices, enabling LLMs to focus on more localized semantic structures and thereby improving specification relevance and completeness; and (2) a logical deletion stage that leverages LLMs to perform logical reasoning and filtering over candidate specifications so as to retain logically correct ones. Experimental results show that SLD-Spec consistently outperforms existing methods on datasets containing programs of varying complexity, verifying more programs and generating specifications that are more relevant and more complete. Further ablation studies indicate that program slicing mainly improves specification relevance and completeness, whereas logical deletion plays a key role in increasing verification success rates.
format Preprint
id arxiv_https___arxiv_org_abs_2509_09917
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Enhancing LLM-based Specification Generation via Program Slicing and Logical Deletion
Chen, Zehan
Zhang, Long
Zhang, Zhiwei
Zhang, JingJing
Zhou, Ruoyu
Shen, Yulong
Ma, JianFeng
Yang, Lin
Software Engineering
Traditional formal specification generation methods are typically tailored to specific specification types, and therefore suffer from limited generality. In recent years, large language model (LLM)-based specification generation approaches have emerged, offering a new direction for improving the universality of automated specification synthesis. However, when dealing with complex control flow, LLMs often struggle to precisely generate complete specifications that cover substructures. Moreover, the distinctive verification pipelines adopted by existing approaches may incorrectly discard logically correct specifications, while verification tools alone cannot reliably identify correct specifications. To address these issues, we propose SLD-Spec, an LLM-based specification generation method that combines program slicing and logical deletion. Specifically, SLD-Spec augments the conventional specification generation framework with two key stages: (1) a program slicing stage that decomposes the target function into several smaller code slices, enabling LLMs to focus on more localized semantic structures and thereby improving specification relevance and completeness; and (2) a logical deletion stage that leverages LLMs to perform logical reasoning and filtering over candidate specifications so as to retain logically correct ones. Experimental results show that SLD-Spec consistently outperforms existing methods on datasets containing programs of varying complexity, verifying more programs and generating specifications that are more relevant and more complete. Further ablation studies indicate that program slicing mainly improves specification relevance and completeness, whereas logical deletion plays a key role in increasing verification success rates.
title Enhancing LLM-based Specification Generation via Program Slicing and Logical Deletion
topic Software Engineering
url https://arxiv.org/abs/2509.09917