paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Formal reasoning about layered monadic interpreters

分层单子解释器的形式推理
ICFP 6(ICFP)2022匹配度 2/10 · 该论文属于Coq/ITree形式语义与证明工程,虽与形式验证相关,但不涉及静态分析、LLM/Agent或浮点/贝叶斯程序分析,与用户当前核心方向距离较远。引用 11 inbox
Irene Yoon, Yannick Zakowski, Steve Zdancewic
crossref: 2026-09-10

AI 速览

一句话:扩展 Coq ITree 库,为分层单子解释器提供泛型提升与关系推理框架,消除样板并简化证明。

以解释自由单子操作构造的单子计算,是建模语言语义与效应系统的有力形式化方法;分层语义有望基于单子等式理论提供模块化推理。但层数增加会带来定义单子和解释器的样板与胶水代码,且每层等价关系的关系推理原则也需定义和论证,开销很大。本文显著扩展 Coq 的 interaction trees(ITrees)库:刻画一类可由单子变换器从 ITrees 获得的可解释单子,并支持解释器沿其泛型提升;还提出“单子模关系 R 等价”的关系推理框架,包含 typeclass、实例、新推理原则与 tactic。该工作推广了 ITree 库的现有理论,消除大量样板代码,大幅简化证明。

问题
如何在 Coq 中支持分层单子解释器,避免层数增加带来的样板代码,并为每层等价关系建立可复用的关系推理原则。
方法
扩展 ITrees 库:刻画从 ITrees 经单子变换器得到的可解释单子,泛型提升解释器;引入模关系 R 的单子等价推理框架,包括 typeclass、实例、原则和 tactic。
评估
在 Coq 中机械化实现并集成到 ITrees 库;该框架推广了原库理论,显著减少样板代码并简化证明。
原文摘要(Abstract)

Monadic computations built by interpreting, or handling , operations of a free monad are a compelling formalism for modeling language semantics and defining the behaviors of effectful systems. The resulting layered semantics offer the promise of modular reasoning principles based on the equational theory of the underlying monads. However, there are a number of obstacles to using such layered interpreters in practice. With more layers comes more boilerplate and glue code needed to define the monads and interpreters involved. That overhead is compounded by the need to define and justify the relational reasoning principles that characterize the equivalences at each layer. This paper addresses these problems by significantly extending the capabilities of the Coq interaction trees (ITrees) library, which supports layered monadic interpreters. We characterize a rich class of interpretable monads ---obtained by applying monad transformers to ITrees---and show how to generically lift interpreters through them. We also introduce a corresponding framework for relational reasoning about "equivalence of monads up to a relation R". This collection of typeclasses, instances, new reasoning principles, and tactics greatly generalizes the existing theory of the ITree library, eliminating large amounts of unwieldy boilerplate code and dramatically simplifying proofs.

链接与引用

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

BibTeX
@article{paperbot1508,
  title = {Formal reasoning about layered monadic interpreters},
  author = {Irene Yoon and Yannick Zakowski and Steve Zdancewic},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {ICFP},
  year = {2022},
  doi = {10.1145/3547630}
}