paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Not by equations alone: Reasoning with extensible effects

不止靠等式:用可扩展效应进行推理
JFP vol.312021匹配度 2/10 · 该论文属于程序语言形式语义与代数效应的等式推理,关注处理器等价与同余性,未涉及静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析;仅与形式化验证/程序推理基础有间接关联,不匹配当前研究画像的核心方向。引用 5 inbox
OLEG KISELYOV, SHIN-CHENG MU, AMR SABRY
crossref: 2026-09-10

AI 速览

一句话:提出基于代数可扩展效应的指称语义框架,由程序与处理器诱导等式定律,并证明模处理器等价是同余。

带有多重且相互作用的效应(如变异、跳转、IO)的程序推理长期困难:单体 monad 不组合,效应交互可能使各自等式定律失效并产生涌现性质;判断定律是否充分、加入新效应后是否仍成立也不易。本文基于代数可扩展效应框架,采用指称语义,不把等式定律强加于程序或效应处理器,而是由程序和处理器诱导定律并澄清边条件。作者提出“模处理器”(或模观察/处理器组合)的等价概念,并证明其在特定条件下是同余,故可用于任意上下文而不仅是求值上下文。文中给出非确定性的现实处理器及其定律,并展示在全局状态存在时非确定性的等式定律。

问题
如何推理带有多重、相互作用效应的程序,尤其是当 monad 不组合、个体等式定律可能失效或产生涌现性质时。
方法
在代数可扩展效应框架下采用指称语义,从程序与效应处理器诱导等式定律,并引入模处理器(模观察或处理器组合)等价概念且证明其为同余。
评估
通过为非确定性构造现实处理器、分析其定律,并展示全局状态下非确定性的等式定律,论证该等价与定律的适用性;主要技术结果是同余性证明。
原文摘要(Abstract)

Abstract The challenge of reasoning about programs with (multiple) effects such as mutation, jumps, or IO dates back to the inception of program semantics in the works of Strachey and Landin. Using monads to represent individual effects and the associated equational laws to reason about them proved exceptionally effective. Even then it is not always clear what laws are to be associated with a monad—for a good reason, as we show for non-determinism. Combining expressions using different effects brings challenges not just for monads, which do not compose, but also for equational reasoning: the interaction of effects may invalidate their individual laws, as well as induce emerging properties that are not apparent in the semantics of individual effects. Overall, the problems are judging the adequacy of a law; determining if or when a law continues to hold upon addition of new effects; and obtaining and easily verifying emergent laws. We present a solution relying on the framework of (algebraic, extensible) effects, which already proved itself for writing programs with multiple effects. Equipped with a fairly conventional denotational semantics, this framework turns useful, as we demonstrate, also for reasoning about and optimizing programs with multiple interacting effects. Unlike the conventional approach, equational laws are not imposed on programs/effect handlers, but induced from them: our starting point hence is a program (model), whose denotational semantics, besides being used directly, suggests and justifies equational laws and clarifies side conditions. The main technical result is the introduction of the notion of equivalence modulo handlers (“modulo observation”) or a particular combination of handlers—and proving it to be a congruence . It is hence usable for reasoning in any context, not just evaluation contexts—provided particular conditions are met. Concretely, we describe several realistic handlers for non-determinism and elucidate their laws (some of which hold in the presence of any other effect). We demonstrate appropriate equational laws of non-determinism in the presence of global state, which have been a challenge to state and prove before.

链接与引用

DOI 原文 ·

BibTeX
@article{paperbot1224,
  title = {Not by equations alone: Reasoning with extensible effects},
  author = {OLEG KISELYOV and SHIN-CHENG MU and AMR SABRY},
  journal = {Journal of Functional Programming},
  volume = {31},
  year = {2021},
  doi = {10.1017/s0956796820000271}
}