arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.28042cs.PL
收藏

相同共效应,不同基础:连接分级类型的两种主要方法

Same Coeffect, Different Base: Connecting Two Dominant Approaches to Graded Types

University of Kent(肯特大学);Royal Holloway, University of London(伦敦大学皇家霍洛威学院);University of Cambridge(剑桥大学)

Vilem Liepelt, Danielle Marshall, Dominic Orchard

AI总结:

本文通过证明两种分级共效应系统(分级基与线性基)之间的保类型、保等级和保操作语义的翻译,建立了它们之间的联系,揭示了它们表达相同上下文依赖概念的能力。

摘要:

分级类型提供了一种用细粒度信息增强类型系统的方法,例如跟踪副作用或上下文依赖性和资源使用(称为共效应)。用于共效应的分级类型已进入 Haskell、Idris 和 Granule 等语言,通过不同通用性的共效应分析实现资源推理。在过去十年中,出现了两种独立的分级共效应系统谱系:一种是共效应注释普遍存在,需要对函数类型进行注释(我们称之为分级基),另一种是通过在线性类型之上添加分级模态类型运算符来添加共效应(我们称之为线性基)。后者起源于 Girard 的线性逻辑,该逻辑一直是专注于资源的编程语言研究的丰富土壤,而分级基方法出现在 2010 年代中期,在编程语言理论和实践中迅速被采用,例如在 QTT 和 Linear Haskell 中。然而,这两种风格之间的关系仍然是一个悬而未决的问题。我们通过给出两个谱系的计算对之间的翻译来回答这个问题,我们证明这些翻译保留了类型、等级和操作语义。我们表明,相同的上下文依赖概念可以在任何一种风格中表达,从而在两个谱系之间建立一座桥梁,使得结果和思想的转移成为可能,同时帮助语言设计者做出更明智的选择。

英文摘要:

Graded types provide a way to augment a type system with fine-grained information, e.g., to track side effects or context dependence and resource use (called coeffects). Graded types for coeffects have found their way into languages such as Haskell, Idris, and Granule, enabling resourceful reasoning via coeffect analysis with varying levels of generality. Two separate lineages of graded coeffect system have emerged in the last decade: those in which coeffect annotations are pervasive, requiring annotations on function types (which we call graded-base) and those in which coeffects are added by way of a graded modal type operator atop linear types (which we call linear-base). The latter has its origins in Girard's Linear Logic which has been a rich humus for programming language research focused on resources, whereas the graded-base approach emerged in the mid-2010s, seeing rapid adoption in programming language theory and practice, e.g. in QTT and Linear Haskell. The relationship between these two styles has however remained an open question. We answer this question by giving translations between pairs of calculi of both lineages that we prove type-, grade- and operational-semantics preserving. We show that the same notions of context dependence can be expressed in either style, building a bridge between the two lineages that enables transfer of results and ideas, while helping language designers to make better informed choices.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑