paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Recovering purity with comonads and capabilities

用余单子和能力恢复纯性
ICFP 4(ICFP)2020匹配度 2/10 · 论文属于纯类型论与形式语义研究,讨论余单子、能力空间模型和效应系统的等式理论,不涉及机器学习系统、Agentic 程序、LLM 辅助静态分析或浮点/贝叶斯程序分析等核心方向。仅与 PL 形式化理论有较远的背景关联,因此匹配度低。引用 15 inbox
Vikraman Choudhury, Neel Krishnaswami
dblp: 2026-09-10crossref: 2026-09-10arxiv: 2026-09-10

AI 速览

一句话:提出余单子类型纪律与能力空间模型,在带效应λ演算中用类型刻画纯表达式并保持等式推理。

论文研究如何在普遍带效应的 ML 风格类型化 λ 演算中重新刻画纯表达式。作者观察到,正如纯 STLC 可用单子类型纪律加入效应,带效应演算也可用余单子类型纪律加入纯性。为此提出能力空间模型,将执行效应需拥有运行时可访问能力/许可的直觉形式化,并定义能力安全。文章刻画该模型满足的范畴公理,给出余单子类型系统的范畴语义;为命令式 λ 演算建立含替换、按值调用 β/η 的等式理论并证明可靠性;最后把纯 STLC 翻译到该演算,证明 βη 相等项翻译后仍相等,从而保持等式地嵌入纯程序。

问题
在 ML 风格、普遍带效应的类型化 λ 演算中,如何用类型系统区分并保证纯表达式,使纯程序可被安全嵌入并保持等式推理。
方法
引入余单子类型纪律,并以能力空间指称模型形式化效应能力;刻画其范畴公理,给出范畴语义与等式理论,并将 STLC 翻译到该演算。
评估
通过指称模型和范畴语义证明类型系统与等式理论的可靠性,并证明 STLC 到该演算的翻译保持 βη 等式;无实现型基准评估。
原文摘要(Abstract)

In this paper, we take a pervasively effectful (in the style of ML) typed lambda calculus, and show how to extend it to permit capturing pure expressions with types. Our key observation is that, just as the pure simply-typed lambda calculus can be extended to support effects with a monadic type discipline, an impure typed lambda calculus can be extended to support purity with a comonadic type discipline. We establish the correctness of our type system via a simple denotational model, which we call the capability space model. Our model formalises the intuition common to systems programmers that the ability to perform effects should be controlled via access to a permission or capability, and that a program is capability-safe if it performs no effects that it does not have a runtime capability for. We then identify the axiomatic categorical structure that the capability space model validates, and use these axioms to give a categorical semantics for our comonadic type system. We then give an equational theory (substitution and the call-by-value β and η laws) for the imperative lambda calculus, and show its soundness relative to this semantics. Finally, we give a translation of the pure simply-typed lambda calculus into our comonadic imperative calculus, and show that any two terms which are βη-equal in the STLC are equal in the equational theory of the comonadic calculus, establishing that pure programs can be mapped in an equation-preserving way into our imperative calculus.

链接与引用

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

BibTeX
@article{abs-1907-07283,
  title = {Recovering purity with comonads and capabilities},
  author = {Vikraman Choudhury and Neel Krishnaswami},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {4},
  number = {ICFP},
  year = {2020},
  doi = {10.1145/3408993}
}