增强具有大型语言模型的复杂程序的自动循环不变量生成

IF 1.4 4区 计算机科学 Q3 COMPUTER SCIENCE, SOFTWARE ENGINEERING
Ruibang Liu, Minyu Chen, Ling-I Wu, Jingyu Ke, Guoqiang Li
{"title":"增强具有大型语言模型的复杂程序的自动循环不变量生成","authors":"Ruibang Liu,&nbsp;Minyu Chen,&nbsp;Ling-I Wu,&nbsp;Jingyu Ke,&nbsp;Guoqiang Li","doi":"10.1016/j.scico.2025.103387","DOIUrl":null,"url":null,"abstract":"<div><div>Automated program verification has always been an important component of building trustworthy software. While the analysis of loops remains a theoretical challenge, the automation of loop invariant analysis has effectively resolved the problem. However, existing invariant generation tools are predominantly effective for programs with purely numerical or purely pointer-based structures. Real-world programs often mix complex data structures and control flows. These structures can include arrays, pointers, and recursive definitions, while control flows may involve multiple nested or concurrent loops. Traditional methods generally only generate invariants for simple numerical programs or specific segments, lacking broad applicability. In order to automatically generate loop invariants for real-world programs, we proposed <em>ACInv</em>, an Automated Complex program loop Invariant generation tool, which combines static analysis with prompting with Large Language Models (LLM) to generate the proper loop invariants. We employ static analysis to systematically decompose the program's data structures and loops. This involves layer-by-layer transmission of structural information about variables, numerical data, and the complete loop structure to the LLM, enabling the generation of corresponding invariants. In comparison to prior work on AutoSpec, we delve deeper into the variable information within each loop. We conducted experiments on ACInv, which showed that ACInv outperformed previous tools on data sets with data structures and maintained similar performance to the state-of-the-art tool AutoSpec on numerical programs without data structures. For the total data set, ACInv can solve 21% more examples than AutoSpec, and can generate reference data structure templates.</div></div>","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103387"},"PeriodicalIF":1.4000,"publicationDate":"2025-08-29","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Enhancing automated loop invariant generation for complex programs with large language models\",\"authors\":\"Ruibang Liu,&nbsp;Minyu Chen,&nbsp;Ling-I Wu,&nbsp;Jingyu Ke,&nbsp;Guoqiang Li\",\"doi\":\"10.1016/j.scico.2025.103387\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"<div><div>Automated program verification has always been an important component of building trustworthy software. While the analysis of loops remains a theoretical challenge, the automation of loop invariant analysis has effectively resolved the problem. However, existing invariant generation tools are predominantly effective for programs with purely numerical or purely pointer-based structures. Real-world programs often mix complex data structures and control flows. These structures can include arrays, pointers, and recursive definitions, while control flows may involve multiple nested or concurrent loops. Traditional methods generally only generate invariants for simple numerical programs or specific segments, lacking broad applicability. In order to automatically generate loop invariants for real-world programs, we proposed <em>ACInv</em>, an Automated Complex program loop Invariant generation tool, which combines static analysis with prompting with Large Language Models (LLM) to generate the proper loop invariants. We employ static analysis to systematically decompose the program's data structures and loops. This involves layer-by-layer transmission of structural information about variables, numerical data, and the complete loop structure to the LLM, enabling the generation of corresponding invariants. In comparison to prior work on AutoSpec, we delve deeper into the variable information within each loop. We conducted experiments on ACInv, which showed that ACInv outperformed previous tools on data sets with data structures and maintained similar performance to the state-of-the-art tool AutoSpec on numerical programs without data structures. For the total data set, ACInv can solve 21% more examples than AutoSpec, and can generate reference data structure templates.</div></div>\",\"PeriodicalId\":49561,\"journal\":{\"name\":\"Science of Computer Programming\",\"volume\":\"248 \",\"pages\":\"Article 103387\"},\"PeriodicalIF\":1.4000,\"publicationDate\":\"2025-08-29\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Science of Computer Programming\",\"FirstCategoryId\":\"94\",\"ListUrlMain\":\"https://www.sciencedirect.com/science/article/pii/S0167642325001261\",\"RegionNum\":4,\"RegionCategory\":\"计算机科学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q3\",\"JCRName\":\"COMPUTER SCIENCE, SOFTWARE ENGINEERING\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Science of Computer Programming","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0167642325001261","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

摘要

自动程序验证一直是构建可靠软件的重要组成部分。虽然循环分析仍然是一个理论挑战,但循环不变量分析的自动化有效地解决了这个问题。然而,现有的不变量生成工具主要对纯数值结构或纯基于指针结构的程序有效。现实世界的程序经常混合复杂的数据结构和控制流。这些结构可以包括数组、指针和递归定义,而控制流可能涉及多个嵌套或并发循环。传统方法一般只对简单的数值程序或特定的段生成不变量,缺乏广泛的适用性。为了自动生成现实世界程序的循环不变量,我们提出了ACInv,一个自动复杂程序循环不变量生成工具,它结合了静态分析和大型语言模型(LLM)的提示来生成适当的循环不变量。我们采用静态分析系统地分解程序的数据结构和循环。这涉及到将有关变量、数值数据和完整循环结构的结构信息逐层传输到LLM,从而能够生成相应的不变量。与AutoSpec之前的工作相比,我们更深入地研究了每个循环中的变量信息。我们在ACInv上进行了实验,结果表明ACInv在具有数据结构的数据集上优于以前的工具,并且在没有数据结构的数值程序上保持与最先进的工具AutoSpec相似的性能。对于整个数据集,ACInv可以比AutoSpec多解决21%的示例,并且可以生成参考数据结构模板。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Enhancing automated loop invariant generation for complex programs with large language models
Automated program verification has always been an important component of building trustworthy software. While the analysis of loops remains a theoretical challenge, the automation of loop invariant analysis has effectively resolved the problem. However, existing invariant generation tools are predominantly effective for programs with purely numerical or purely pointer-based structures. Real-world programs often mix complex data structures and control flows. These structures can include arrays, pointers, and recursive definitions, while control flows may involve multiple nested or concurrent loops. Traditional methods generally only generate invariants for simple numerical programs or specific segments, lacking broad applicability. In order to automatically generate loop invariants for real-world programs, we proposed ACInv, an Automated Complex program loop Invariant generation tool, which combines static analysis with prompting with Large Language Models (LLM) to generate the proper loop invariants. We employ static analysis to systematically decompose the program's data structures and loops. This involves layer-by-layer transmission of structural information about variables, numerical data, and the complete loop structure to the LLM, enabling the generation of corresponding invariants. In comparison to prior work on AutoSpec, we delve deeper into the variable information within each loop. We conducted experiments on ACInv, which showed that ACInv outperformed previous tools on data sets with data structures and maintained similar performance to the state-of-the-art tool AutoSpec on numerical programs without data structures. For the total data set, ACInv can solve 21% more examples than AutoSpec, and can generate reference data structure templates.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
Science of Computer Programming
Science of Computer Programming 工程技术-计算机:软件工程
CiteScore
3.80
自引率
0.00%
发文量
76
审稿时长
67 days
期刊介绍: Science of Computer Programming is dedicated to the distribution of research results in the areas of software systems development, use and maintenance, including the software aspects of hardware design. The journal has a wide scope ranging from the many facets of methodological foundations to the details of technical issues andthe aspects of industrial practice. The subjects of interest to SCP cover the entire spectrum of methods for the entire life cycle of software systems, including • Requirements, specification, design, validation, verification, coding, testing, maintenance, metrics and renovation of software; • Design, implementation and evaluation of programming languages; • Programming environments, development tools, visualisation and animation; • Management of the development process; • Human factors in software, software for social interaction, software for social computing; • Cyber physical systems, and software for the interaction between the physical and the machine; • Software aspects of infrastructure services, system administration, and network management.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信