paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Scalable linear invariant generation with Farkas’ lemma

基于 Farkas 引理的可扩展线性不变式生成
OOPSLA 6(OOPSLA2)2022匹配度 4/10 · 该论文属于程序验证中的线性不变式生成,是静态分析/形式化验证的经典问题,与用户关注的静态分析基础有一定关联;但完全不涉及 LLM/Agent、机器学习系统、浮点程序分析或贝叶斯程序分析,因此与用户当前核心交叉方向匹配度较低。引用 15 inbox
Hongming Liu, Hongfei Fu, Zhiyong Yu, Jiaxin Song, Guoqiang Li
crossref: 2026-09-10

AI 速览

一句话:提出两项改进,显著提升基于 Farkas 引理的仿射程序线性不变式生成的扩展性。

不变式生成用于程序形式分析。本文针对无给定目标性质的仿射程序,生成紧致线性不变式。已知唯一可靠且完备的刻画基于 Farkas 引理,但原有方法受非线性约束或组合爆炸影响,难以扩展。作者在 Sankaranarayanan 等 SAS 2004 的实用方法上提出两项独立改进:按程序位置单独生成不变式,从而支持并行处理并进一步减少组合爆炸;在 CNF 到 DNF 展开中采用分段包含测试,以提前发现更多局部包含关系。作者证明新方法保持原方法的精度,并在含非平凡线性不变式的代表性基准上实现数个数量级的运行时加速,即使在串行汇总所有位置的场景下亦然。

问题
如何为带仿射守卫和更新的程序自动生成紧致线性不变式,且不预设目标性质,并解决基于 Farkas 引理方法的可扩展性瓶颈。
方法
在 SAS 2004 的 Farkas 引理启发式方法基础上,按程序位置分别生成不变式以支持并行并减少组合爆炸,同时在 CNF 到 DNF 展开中使用分段包含测试提前发现局部包含。
评估
在含非平凡线性不变式的代表性基准上进行实验,证明精度与原方法一致,且运行时间提升数个数量级,即使串行汇总所有程序位置的耗时也如此。
原文摘要(Abstract)

Invariant generation is a classical problem to automatically generate invariants to aid the formal analysis of programs. In this work, we consider the problem of generating tight linear-invariants over affine programs (i.e., programs with affine guards and updates) without a prescribed goal property. In the literature, the only known sound and complete characterization to solve this problem is via Farkas’ Lemma (FL), and has been implemented through either quantifier elimination or reasonable heuristics. Although FL-based approaches can generate highly accurate linear invariants from the completeness of FL, the main bottleneck to applying these approaches is the scalability issue caused by either non-linear constraints or combinatorial explosion. We base our approach on the only practical FL-based approach [Sankaranarayanan ‍ et al. , SAS 2004] that applies FL with reasonable heuristics, and develop two novel and independent improvements to leverage the scalability. The first improvement is the novel idea to generate invariants at one program location in a single invariant-generation process, so that the invariants for each location are generated separately rather than together in a single computation. This idea naturally leads to a parallel processing that divides the invariant-generation task for all program locations by assigning the locations separately to multiple processors. Moreover, the idea enables us to develop detailed technical improvements to further reduce the combinatorial explosion in the original work [Sankaranarayanan ‍ et al. , SAS 2004]. The second improvement is a segmented subsumption testing in the CNF-to-DNF expansion that allows discovering more local subsumptions in advance. We formally prove that our approach has the same accuracy as the original work and thus does not incur accuracy loss on the generated invariants. Moreover, experimental results on representative benchmarks involving non-trivial linear invariants demonstrate that our approach improves the runtime of the original work by several orders of magnitude, even in the non-parallel scenario that sums up the execution time for all program locations. Hence, our approach constitutes the first significant improvement in FL-based approaches for linear invariant generation after almost two decades.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1467,
  title = {Scalable linear invariant generation with Farkas’ lemma},
  author = {Hongming Liu and Hongfei Fu and Zhiyong Yu and Jiaxin Song and Guoqiang Li},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {OOPSLA2},
  year = {2022},
  doi = {10.1145/3563295}
}