[论文解读] A Productivity Checker for Logic Programming
本文提出了一种用于逻辑程序的观测可生产性检查器,通过共归纳推理半判定程序是否通过共归纳推理产生无限项。通过结合通用可观测性与存在性活跃性检查,利用重写树和共归纳不变量,该方法即使在非线性、存在量化的程序中也能认证可生产行为,从而在Prolog及相关系统中实现可靠的共归纳推理。
Automated analysis of recursive derivations in logic programming is known to be a hard problem. Both termination and non-termination are undecidable problems in Turing-complete languages. However, some declarative languages offer a practical work-around for this problem, by making a clear distinction between whether a program is meant to be understood inductively or coinductively. For programs meant to be understood inductively, termination must be guaranteed, whereas for programs meant to be understood coinductively, productive non-termination (or "productivity") must be ensured. In practice, such classification helps to better understand and implement some non-terminating computations. Logic programming was one of the first declarative languages to make this distinction: in the 1980's, Lloyd and van Emden's "computations at infinity" captured the big-step operational semantics of derivations that produce infinite terms as answers. In modern terms, computations at infinity describe "global productivity" of computations in logic programming. Most programming languages featuring coinduction also provide an observational, or small-step, notion of productivity as a computational counterpart to global productivity. This kind of productivity is ensured by checking that finite initial fragments of infinite computations can always be observed to produce finite portions of their infinite answer terms. In this paper we introduce a notion of observational productivity for logic programming as an algorithmic approximation of global productivity, give an effective procedure for semi-deciding observational productivity, and offer an implemented automated observational productivity checker for logic programs.
研究动机与目标
- 为解决关于非终止逻辑程序推导的推理挑战,特别是那些产生无限项的程序。
- 形式化观测可生产性的概念,作为逻辑编程中全局可生产性的实用替代方案。
- 开发一种算法,半判定观测可生产性,且无语法限制,包括适用于存在变量和非线性递归的程序。
- 提供一种实用工具,用于验证共归纳语义并确保共归纳Prolog方言(如CoLP和S-reduction)中的可靠性。
- 实现对可生产行为的自动化认证,以支持程序验证、类型系统以及无限数据结构的惰性求值。
提出的方法
- 该方法将观测可生产性定义为通用可观测性(所有推导步骤均产生可观测项)与存在性活跃性(无限项可逐步近似)的结合。
- 利用重写树建模项的约化及推导步骤之间的转换,追踪项在SLD归约下的演化过程。
- 关键创新在于使用共归纳不变量记录在循环中减少并随后在转换中重新引入的模式,从而捕捉无限推导的“生产者/消费者”动态。
- 该算法通过分析重写树是否在向叶节点约化并利用最一般合一(mgus)实现结构再生,执行半判定过程。
- 与现有的项重写系统(TRS)终止性检查器集成,以验证收缩序,实现模块化分析。
- 检查器使用Go语言实现,支持并行证明搜索,可扩展分析复杂逻辑程序。
实验结果
研究问题
- RQ1观测可生产性是否可被定义为一般逻辑程序的可判定或半可判定属性,且独立于特定方言?
- RQ2如何通过小步、可观测的行为算法近似全局可生产性——即在无穷远处计算无限项的能力?
- RQ3何种形式条件可确保逻辑程序的无限推导可通过有限步惰性近似,即使答案不是正规项?
- RQ4如何自动发现并验证共归纳不变量,以认证存在量化变量和非线性递归程序中的可生产行为?
- RQ5该可生产性检查器是否可用作预检工具,以保证CoLP或S-reduction等共归纳Prolog系统中的可靠性?
主要发现
- 观测可生产性检查器成功识别出P5和P2等可生产程序,这些程序在无穷远处生成如p(f(f(...)))的无限项,同时正确拒绝P3和P4等非可生产循环。
- 该方法对任意逻辑程序(包括存在变量和非线性递归)半判定观测可生产性,且无语法限制。
- 共归纳不变量在捕捉无限推导的结构动态方面非常有效,能够检测重写树中项的约化与再生。
- 该检查器可用于将谓词类型化为共归纳,从而在逻辑编程中静态分类归纳与共归纳语义。
- Go语言实现支持并行证明搜索,可集成至CoLP等工具中,作为预验证机制,以确保共归纳推理的可靠性。
- 该检查器为不规则无限项(如程序P6中的项)提供了通用证书,实现惰性近似,即使无法获得闭项答案。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。