paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Interaction trees: representing recursive and impure programs in Coq

交互树:在 Coq 中表示递归与不纯程序
POPL 4(POPL)2019匹配度 3/10 · 论文属于 Coq 中基于余归纳交互树的形式语义与程序验证工作,与用户核心关注的静态分析、LLM/Agent 交叉、浮点程序分析及贝叶斯程序分析均无直接关联;仅作为 PL/形式化验证背景有间接价值。引用 131 inbox
Li-yao Xia, Yannick Zakowski, Paul He, Chung-Kil Hur, Gregory Malecha, Benjamin C. Pierce, Steve Zdancewic
crossref: 2026-09-10

AI 速览

一句话:提出交互树,在 Coq 中表示递归、有副作用且可能非终止的程序,支持组合解释与弱互模拟等式推理。

本文提出交互树(ITrees),一种在 Coq 中表示与环境交互的递归程序行为的通用数据结构。ITrees 可视为共归纳的“自由单子”,由未解释事件及其续延构成,支持从事件处理器组合式构造解释器,并具有弱互模拟下的丰富等式理论。它能表达不纯、可能非终止和互递归的计算,又可通过代码抽取执行。作者在 Coq 中实现 ITrees 及相关理论,机械化了程序语义、迭代、单子结构与等式推理中的经典结果;库内部大量使用共归纳证明,但接口隐藏细节。为展示效用,他们证明从简单命令式源语言到类汇编目标的编译器的终止敏感正确性,目标语言意义由基于 ITree 的指称语义给出;互模拟证明通过结构归纳和控制流图组合子的等式重写完成。

问题
如何在 Coq 中表示递归、不纯、可能非终止且互递归的程序,同时支持可执行的指称语义、弱互模拟等式推理以及组合式解释器构造。
方法
提出交互树 ITrees,作为共归纳自由单子,由未解释事件与续延构成;在 Coq 中机械化其理论,并隐藏共归纳细节,提供组合子与等式推理接口。
评估
实现 Coq 库,并用它证明一个简单命令式语言到类汇编语言的编译器的终止敏感正确性;证明基于结构归纳和等式重写。
原文摘要(Abstract)

Interaction trees (ITrees) are a general-purpose data structure for representing the behaviors of recursive programs that interact with their environments. A coinductive variant of “free monads,” ITrees are built out of uninterpreted events and their continuations. They support compositional construction of interpreters from event handlers , which give meaning to events by defining their semantics as monadic actions. ITrees are expressive enough to represent impure and potentially nonterminating, mutually recursive computations, while admitting a rich equational theory of equivalence up to weak bisimulation. In contrast to other approaches such as relationally specified operational semantics, ITrees are executable via code extraction, making them suitable for debugging, testing, and implementing software artifacts that are amenable to formal verification. We have implemented ITrees and their associated theory as a Coq library, mechanizing classic domain- and category-theoretic results about program semantics, iteration, monadic structures, and equational reasoning. Although the internals of the library rely heavily on coinductive proofs, the interface hides these details so that clients can use and reason about ITrees without explicit use of Coq’s coinduction tactics. To showcase the utility of our theory, we prove the termination-sensitive correctness of a compiler from a simple imperative source language to an assembly-like target whose meanings are given in an ITree-based denotational semantics. Unlike previous results using operational techniques, our bisimulation proof follows straightforwardly by structural induction and elementary rewriting via an equational theory of combinators for control-flow graphs.

链接与引用

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

BibTeX
@article{paperbot530,
  title = {Interaction trees: representing recursive and impure programs in Coq},
  author = {Li-yao Xia and Yannick Zakowski and Paul He and Chung-Kil Hur and Gregory Malecha and Benjamin C. Pierce and Steve Zdancewic},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {4},
  number = {POPL},
  year = {2019},
  doi = {10.1145/3371119}
}