[论文解读] A Verified Algorithm for Deciding Pattern Completeness
本文提出了一种可靠且高效的算法,用于在逻辑约束项重写系统(LCTRSs)中验证准约化性,确保由于缺少模式匹配而导致的计算停滞永远不会发生。该方法通过在左线性性、构造器安全性及左值自由性的假设下,测试所有可能的构造器模式是否被覆盖,来检查规则的完备性,其核心成果是一个决策过程,通过规则模式的语法检查确认准约化性。
Pattern completeness is the property that the left-hand sides of a functional program cover all cases w.r.t. pattern matching. In the context of term rewriting a related notion is quasi-reducibility, a prerequisite if one wants to perform ground confluence proofs by rewriting induction. In order to certify such confluence proofs, we develop a novel algorithm that decides pattern completeness and that can be used to ensure quasi-reducibility. One of the advantages of the proposed algorithm is its simple structure: it is similar to that of a regular matching algorithm and, unlike an existing decision procedure for quasi-reducibility, it avoids enumerating all terms up to a given depth. Despite the simple structure, proving the correctness of the algorithm is not immediate. Therefore we formalize the algorithm and verify its correctness using the proof assistant Isabelle/HOL. To this end, we not only verify some auxiliary algorithms, but also design an Isabelle library on sorted term rewriting. Moreover, we export the verified code in Haskell and experimentally evaluate its performance. We observe that our algorithm significantly outperforms existing algorithms, even including the pattern completeness check of the GHC Haskell compiler.
研究动机与目标
- 解决由于模式匹配不完整导致LCTRSs中计算停滞的问题。
- 形式化并验证LCTRSs中准约化性的决策过程。
- 提供一种实用且可实现的方法,确保所有构造器模式均被规则覆盖。
- 建立左线性性、构造器安全性及左值自由性等条件,使该算法在这些条件下保持正确且高效。
提出的方法
- 该算法通过分析规则所有左部及其关联约束,检查模式完备性。
- 它定义了一个谓词 OK(−→x, A, b),用于判断给定的模式和约束集合是否能覆盖所有可能的构造器项输入。
- 该方法基于参数数量和排序进行结构归纳,根据当前参数是值、项,还是两者之间的选择来区分情况。
- 它依赖于左线性性假设,以安全地替换变量,避免在模式匹配过程中发生变量捕获。
- 该算法检查:对于每个定义符号或计算符号 f,f 的模式集合 Af 是否满足 OK((), Af, either),以确保所有构造器输入均被覆盖。
- 该方法的核心是一个递归的覆盖检查过程,通过传播约束并验证所有可能的构造器项输入是否能被某个规则匹配。
实验结果
研究问题
- RQ1我们能否自动验证在LCTRSs中除构造器项外不存在其他不可约的基项?
- RQ2在何种条件下,可以通过语法模式覆盖来判定准约化性?
- RQ3是否存在一种可靠且高效的算法,用于检测LCTRSs规则模式中的遗漏情况?
- RQ4该算法能否针对左线性、左值自由且构造器安全的LCTRSs类实现完全性?
主要发现
- 该算法是可靠的:若对所有符号 f 均有 OK((), Af, either) 成立,则该LCTRS是准约化的。
- 该方法已在 Ctrl 工具中完全实现,展示了其实际适用性。
- 该算法依赖于三个结构限制——左线性性、构造器安全性及左值自由性——以确保正确性。
- 本文推测,该方法对左线性、左值自由且构造器安全的LCTRSs类也具有完全性,尽管此处未证明完全性。
- 该算法通过分析规则左部及其约束的结构,有效检测出遗漏的模式情况。
- 模式完备性的验证被简化为对规则模式的语法检查,避免了昂贵的模型检查或证明搜索。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。