paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Fold–unfold lemmas for reasoning about recursive programs using the Coq proof assistant

使用 Coq 证明助手推理递归程序的折叠–展开引理
JFP vol.322022匹配度 2/10 · 论文属于 Coq 定理证明与证明工程,关注递归函数的折叠–展开引理及其插件实现,未涉及用户核心方向中的 LLM/Agent 与静态分析/形式化验证交叉、浮点程序分析或贝叶斯程序分析。虽然形式化验证与工程实现符合部分偏好,但研究目标本身与用户当前追的问题几乎无直接交集。引用 3 inbox
OLIVIER DANVY
crossref: 2026-09-10

AI 速览

一句话:提出折叠–展开引理,在 Coq 中机械生成并精确推理局部或全局递归函数,且已由插件支持。

在 Coq 中,rewrite 策略推理递归函数时常需折叠–展开步骤来精确控制调用与其分支的等价。本文提出折叠–展开引理:对每个结构情形,生成一个引理,将该情形下对函数的调用与该情形分支相等。这些引理是样板式的,可机械生成,证明通用;使用精确(如含多个调用的项),并能扩展到 continuation-passing style 和各种递归模式,支持等式与关系推理。作者依据课堂经验及学生后续使用说明其有效性;自 8.0 版起 functional-induction 插件为全局定义提供该引理,Equations 插件现在也为全局和局部声明提供支持。

问题
如何在使用 Coq 的 rewrite 策略推理局部或全局定义的递归函数时,获得精确且可扩展的折叠与展开步骤。
方法
为递归函数的每个结构情形生成折叠–展开引理,将该情形下的函数调用与该情形分支相等;引理可机械生成,证明通用,并集成到 functional-induction 与 Equations 插件中。
评估
通过课堂教学经验、学生后续在 Coq 中的使用以及插件对引理的提供情况来评估其有效性;摘要未报告受控实验。
原文摘要(Abstract)

Abstract Fold–unfold lemmas complement the rewrite tactic in the Coq Proof Assistant to reason about recursive functions, be they defined locally or globally. Each of the structural cases gives rise to a fold–unfold lemma that equates a call to this function in that case with the corresponding case branch. As such, they are “boilerplate” and can be generated mechanically, though stating them by hand is a learning experience for a beginner, to say nothing about explaining them. Their proof is generic. Their use is precise (e.g., in terms with multiple calls) and they scale seamlessly (e.g., to continuation-passing style and to various patterns of recursion), be the reasoning equational or relational. In the author’s experience, they prove effective in the classroom, considering the clarity of discourse in the subsequent term reports and oral exams, and beyond the classroom, considering their subsequent use when continuing to work with the Coq Proof Assistant. Fold–unfold lemmas also provide a measure of understanding as well as of control about what is cut short when one uses a shortcut, i.e., an automated simplification tactic. Since Version 8.0, the functional-induction plugin provides them for functions that are defined globally, i.e., recursive equations, and so does the Equations plugin now, both for global and for local declarations, a precious help for advanced users.

链接与引用

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

BibTeX
@article{paperbot1625,
  title = {Fold–unfold lemmas for reasoning about recursive programs using the Coq proof assistant},
  author = {OLIVIER DANVY},
  journal = {Journal of Functional Programming},
  volume = {32},
  year = {2022},
  doi = {10.1017/s0956796822000107}
}