paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Solving Conditional Linear Recurrences for Program Verification: The Periodic Case

求解条件线性递推式以进行程序验证:周期情形
OOPSLA 7(OOPSLA1)2023匹配度 3/10 · 该论文属于传统程序验证/循环递推式求解,关注条件线性递推的闭式解与验证工具实现,但未涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析,与当前 PL-AI 交叉研究方向匹配度较低。其形式化定义加工程实现的风格有一定参考价值,但不在核心问题范围内。引用 9 inbox
Chenglin Wang, Fangzhen Lin
crossref: 2026-09-10

AI 速览

一句话:提出条件线性递推式在最终周期情形下的闭式解,并实现生成-验证求解器以验证含条件分支循环。

循环的程序验证常把循环转换为递推式并求闭式解,但现有求解器难以处理循环体含条件语句时产生的条件表达式。本文研究条件线性递推式,证明若由给定初值生成的索引序列是最终周期的,则该递推式具有闭式解;同时指出判定最终周期性是不可判定的,于是提出启发式“生成-验证”算法,在检查最终周期性的同时计算闭式解。作者实现了求解器,并在其基础上用 SMT 求解器 Z3 构建直接的程序验证器。实验表明,它能有效验证许多循环中含条件语句的基准程序,且优于其他基于递推的验证工具。最后还讨论了初值未知时闭式解的扩展。

问题
循环体含条件语句时,程序验证中由循环转换得到的递推式带有条件表达式,现有闭式解求解器难以处理这类条件线性递推式。
方法
将条件线性递推式的索引序列最终周期性与其闭式解存在性联系起来,并针对周期性判定不可判定提出启发式“生成-验证”算法,同时检查最终周期性并计算闭式解。
评估
实现求解器,并与 SMT 求解器 Z3 结合构建程序验证器,在多个含条件分支循环的基准程序上实验,与其他基于递推的验证工具相比表现良好。
原文摘要(Abstract)

In program verification, one method for reasoning about loops is to convert them into sets of recurrences, and then try to solve these recurrences by computing their closed-form solutions. While there are solvers for computing closed-form solutions to these recurrences, their capabilities are limited when the recurrences have conditional expressions, which arise when the body of a loop contains conditional statements. In this paper, we take a step towards solving these recurrences. Specifically, we consider what we call conditional linear recurrences and show that given such a recurrence and an initial value, if the index sequence generated by the recurrence on the initial value is what we call ultimately periodic, then it has a closed-form solution. However, checking whether such a sequence is ultimately periodic is undecidable so we propose a heuristic "generate and verify" algorithm for checking the ultimate periodicity of the sequence and computing closed-form solutions at the same time. We implemented a solver based on this algorithm, and our experiments show that a straightforward program verifier based on our solver and using the SMT solver Z3 is effective in verifying properties of many benchmark programs that contain conditional statements in their loops, and compares favorably to other recurrence-based verification tools. Finally, we also consider extending our results to computing closed-form solutions of recurrences with unknown initial values.

链接与引用

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

BibTeX
@article{paperbot2019,
  title = {Solving Conditional Linear Recurrences for Program Verification: The Periodic Case},
  author = {Chenglin Wang and Fangzhen Lin},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {OOPSLA1},
  year = {2023},
  doi = {10.1145/3586028}
}