arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.13414cs.SEcs.AI
收藏

神经符号生成与验证内存感知的形式函数规范

Neuro-Symbolic Generation and Validation of Memory-Aware Formal Function Specifications

School of Computer Science, Shanghai Jiao Tong University(上海交通大学计算机科学学院);School of Artificial Intelligence, Shanghai Jiao Tong University(上海交通大学人工智能学院);Shanghai Innovation Institute(上海创新研究院);School of Computer Science and Engineering, University of Washington(华盛顿大学计算机科学与工程学院)

Liao Zhang, Tong Chen, Xiwei Wu, Qi Liu, Xiyu Zhai, Xinqi Wang, Qinxiang Cao

AI总结:

本文提出神经符号框架,通过自然语言描述和函数签名生成内存感知的形式函数规范,结合符号证明器和验证工具链迭代优化,提升形式规范的正确性与语法有效性。

摘要:

内存操作程序的形式验证严重依赖于专家精确捕捉内存状态的函数规范。随着大语言模型生成低层系统代码,其正确性无法保证,成为主要瓶颈。本文提出神经符号框架,从自然语言问题描述和函数签名自动生成内存感知的形式函数规范。流程首先通过上下文学习生成候选规范,再利用符号证明器和验证工具链迭代优化。通过构造规范否定的证明,验证候选规范的正确性,过滤LLM常接受的假阳性。引入LeetCode-C-Spec基准测试,实验表明迭代优化显著提升语法有效性,符号证明器反馈显著增强正确性评估。

英文摘要:

Formal verification of memory-manipulating programs critically depends on precise function specifications that capture memory states written by experts. This requirement has become a major bottleneck as large language models (LLMs) increasingly generate low-level systems code whose correctness cannot be assumed. To enable scalable formal verification, we focus exclusively on function specification generation, deliberately avoiding the synthesis of complex loop invariants that are central to traditional verification pipelines. We propose a neuro-symbolic framework for automatically generating memory-aware formal function specifications for C programs from natural language problem descriptions and function signatures. The pipeline first produces candidate specifications via in-context learning, and then iteratively refines them using compiler diagnostics from symbolic provers and the verification toolchain. In particular, we validate candidate specifications by constructing a proof for the negation of the specification with concrete examples, enabling machine-checked rejection of plausible-but-incorrect specifications. To support systematic evaluation, we introduce LeetCode-C-Spec, a new benchmark of 200 C programming problems for generating memory-aware formal function specifications. Experiments show that iterative refinement substantially improves syntactic validity, while symbolic prover-based refutation significantly enhances correctness assessment by filtering false positives that LLM-only judges frequently accept. Our results demonstrate that combining neural generation with symbolic feedback provides an effective approach to formal specification synthesis for memory-safe systems software.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑