[论文解读] A Framework for Dependent Types and Effects
本文提出 dCBPV-,即一种依赖类型扩展的调用-按值-推-值(call-by-push-value)语言,通过自然的小步操作语义和优美的范畴语义,支持计算效应,实现了对单子式和 CBN 依赖类型理论的完整且忠实的翻译。此外,本文还提出了 dCBPV+,通过引入依赖 Kleisli 扩展来编码 CBV 依赖类型理论和正向连通词,尽管为此付出了潜在类型唯一性丧失的代价,该代价通过子类型化形式化表达。
We generalise Levy's call-by-push-value (CBPV) to dependent type theory, to gain a better understanding of how to combine dependent types with effects. We define a dependently typed extension of CBPV, dCBPV-, and show that it has a very natural small-step operational semantics, which satisfies subject reduction and (depending on the effects present) determinism and strong normalization, and an elegant categorical semantics, which - surprisingly - is no more complicated than the simply typed semantics. We have full and faithful translations from a dependently typed version of Moggi's monadic metalanguage and of a call-by-name (CBN) dependent type theory into dCBPV- which give rise to the expected operational behaviour. However, it turns out that dCBPV- does not suffice to encode call-by-value (CBV) dependent type theory or the strong (dependent) elimination rules for positive connectives in CBN-dependent type theory. To mend this problem, we discuss a second, more expressive system dCBPV+, which additionally has a principle of Kleisli extension for dependent functions. We obtain the desired CBV- and CBN-translations of dependent type theory into dCBPV+. It too has a natural categorical semantics and operational semantics. However, depending on the effects we consider, we may lose uniqueness of typing, as the type of a computation may become more specified as certain effects are executed. This idea can be neatly formalized using a notion of subtyping. We hope that the theoretical framework of this paper on the one hand provides at least a partial answer to the fundamental type theoretic question of how one can understand the relationship between computational effects and dependent types. On the other hand, we hope it can contribute a small-step towards the ultimate goal of an elegant fully fledged language for certified effectful programming.
研究动机与目标
- 开发一个系统化的框架,将计算效应与依赖类型理论相结合,解决现有系统中的局限性。
- 将 Levy 的调用-按值-推-值(CBPV)演算扩展至依赖类型,保持课题约化和强规范性。
- 解决 dCBPV- 无法编码调用-按值(CBV)依赖类型理论以及 CBN 中正向连通词的强消除规则的问题。
- 通过引入具有依赖 Kleisli 扩展的 dCBPV+,实现对 CBV 和 CBN 依赖类型系统的完整编码。
- 通过范畴模型和操作语义,为可信效应编程提供语义基础。
提出的方法
- 通过 dCBPV- 将 CBPV 扩展至依赖类型,引入满足课题约化和在特定效应下确定性的自然小步操作语义。
- 为 dCBPV- 定义范畴语义,其复杂度与简单类型情况相当,利用伴随关系建模计算类型与值类型之间的分离。
- 通过引入依赖函数的 Kleisli 扩展原则,提出 dCBPV+,以支持 CBV 和 CBN 依赖类型系统的编码。
- 使用子类型化形式化 dCBPV+ 中的类型唯一性缺失,其中效应执行可能细化计算的类型。
- 提供从 Moggi 的单子式元语言和 CBN 依赖类型理论到 dCBPV- 的完整且忠实的翻译,保持操作行为不变。
- 使用博弈语义和域语义作为模型来验证该框架,尤其适用于递归、控制操作和局部状态等效应。
实验结果
研究问题
- RQ1如何系统地将依赖类型与计算效应结合,以保持类型安全和操作清晰性?
- RQ2为何 dCBPV- 无法编码 CBV 依赖类型理论以及 CBN 中正向连通词的强消除规则?
- RQ3依赖 Kleisli 扩展原则是否能恢复 dCBPV+ 中的表达能力,同时保持一致的语义?
- RQ4在 dCBPV+ 中引入效应在多大程度上损害了类型唯一性,以及如何形式化表达这一问题?
- RQ5该框架是否能够支持诸如归纳族、类型族和归纳-递归定义等高级类型构造?
主要发现
- dCBPV- 支持自然的小步操作语义,满足课题约化,且在特定效应下具备确定性和强规范性。
- dCBPV- 的范畴语义与简单类型情况一样简洁,表明依赖类型并不会固有地使效应语义复杂化。
- dCBPV+ 引入了依赖 Kleisli 扩展,使得 CBV 和 CBN 依赖类型理论能够被完整编码,而这是 dCBPV- 所无法表达的。
- 在 dCBPV+ 中,计算的类型可能在效应执行过程中变得更加具体化,这一现象通过子类型化概念形式化表达。
- 该框架支持包含递归、控制操作和局部状态等效应的依赖类型理论模型,通过博弈语义和域语义得到验证。
- 该系统提供了从单子式和 CBN 依赖类型理论到 dCBPV+ 的完整且忠实的翻译,保持了操作行为,并支持对效应程序的验证。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。