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

作为分配效应的类型论域

Type Universes as Allocation Effects

Paulette Koronkevich, William J. Bowman

AI总结:

本文建立类型论域与内存分配的关联,提出将论域视为堆分配位置的视角,构建带论域约束高阶引用的类型系统框架,并给出3种简单类型λ演算下的分配推事实例及相关性质证明与推测。

摘要:

本文探究了类型论域与内存分配之间的关联。在依赖类型论中,类型论域层级通过禁止一个类型对所有类型进行量化来保证一致性。类型的类型(即论域)构成一个层级,一个类型仅能对其他论域中的类型进行量化(存在少数例外),以此限制证明中的循环推理。我们提出一种视角:论域同样描述了值在堆中分配的“位置”,论域代数的选择会为整个堆赋予特定结构。由此得到的类型系统提供了一个简洁的声明式系统,无需对读写操作进行推理,即可对内存分配进行推理与限制。我们提出一个理论框架,用于为类型系统配备受论域层级约束的高阶引用,并推测许多现有的论域代数都能衍生出有趣的分配推理系统。我们给出了该方法的3种实例,以支持在简单类型λ演算中进行分配推理:(1)标准分支论域层级,我们证明其通过限制堆中的循环,可保证扩展了高阶引用的语言的终止性;(2)带有“非直谓”基论域的扩展,我们推测其支持完全基类引用(计算可终止,但存在循环基类数据结构);(3)带有“论域多态”的扩展,可将堆划分为细粒度的区域。

英文摘要:

In this paper, we explore a connection between type universes and memory allocation. Type universe hierarchies are used in dependent type theories to ensure consistency, by forbidding a type from quantifying over all types. Instead, the types of types (universes) form a hierarchy, and a type can only quantify over types in other universes (with some exceptions), restricting cyclic reasoning in proofs. We present a perspective where universes also describe \emph{where} values are allocated in the heap, and the choice of universe algebra imposes a structure on the heap overall. The resulting type system provides a simple declarative system for reasoning about and restricting memory allocation, without reasoning about reads or writes. We present a theoretical framework for equipping a type system with higher-order references restricted by a universe hierarchy, and conjecture that many existing universe algebras give rise to interesting systems for reasoning about allocation. We present 3 instantiations of this approach to enable reasoning about allocation in the simply typed $λ$-calculus: (1) the standard ramified universe hierarchy, which we prove guarantees termination of the language extended with higher-order references by restricting cycles in the heap; (2) an extension with an \emph{impredicative} base universe, which we conjecture enables full-ground references (with terminating computation but cyclic ground data structures); (3) an extension with \emph{universe polymorphism}, which divides the heap into fine-grained regions.

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

↑