paperbot · PL 论文追踪

全部论文 待读 收藏

P2 When Lifetimes Liberate: A Type System for Arenas with Higher-Order Reachability Tracking

当生命周期解放时:面向 arena 的高阶可达性追踪类型系统
OOPSLA 10(OOPSLA1)2026匹配度 3/10 · 该论文属于 PL 类型系统与形式化验证(Rocq 证明内存安全),与用户关注的 PL↔AI 交叉、浮点程序分析、贝叶斯程序分析均无直接关联,也未涉及 LLM/Agent 或工业落地案例。引用 0 inbox
Siyuan He, Songlin Jia, Yuyan Bao, Tiark Rompf
crossref: 2026-09-10

AI 速览

一句话:提出统一处理多种生命周期、粒度与共享方式的资源类型系统,用可达性类型追踪个体与成组资源,并在 Rocq 中证明类型与内存安全。

静态强制安全的资源管理面临灵活生命周期与表达性共享之间的张力:基于区域的系统提供词法作用域下的批量管理,但资源是二等值,无法逃逸作用域或自由地从函数返回;Rust 等所有权与线性类型系统提供一等、非词法生命周期,但其不变式限制了高阶模式与共享表达能力。本文提出一个统一的类型系统,在类型层面一致地表示所有堆分配资源,并支持三种分配模式:一等非词法资源的新鲜分配、具有词法受限生命周期的二等资源新鲜分配,以及通过影子 arena 对资源进行分组以批量追踪与释放的共分配(coallocation)。系统基于 reachability types 扩展,能够追踪个体资源与成组资源,表达循环存储结构,并选择性地施加栈式生命周期纪律。这些机制形式化为 A <: * 与 {A} <: * 两个类型系统,并在 Rocq 中证明了类型安全与内存安全。

问题
如何在保持高阶参数化与灵活共享的前提下,静态地保证堆资源的生命周期安全与内存安全,同时避免区域系统的二等资源限制和所有权/线性类型对高阶模式与共享的束缚。
方法
基于 reachability types 进行扩展,在统一类型表示下提供三种分配模式(一等非词法、词法受限的二等、影子 arena 共分配),支持个体与成组资源的可达性追踪、循环存储结构表达以及可选的栈式生命周期纪律,形式化为 A <: * 与 {A} <: * 两套类型系统。
评估
在 Rocq 证明助手中机器化形式化两套类型系统,并证明其类型安全与内存安全。
原文摘要(Abstract)

Statically enforcing safe resource management is challenging due to tensions between flexible lifetime dis-ciplines and expressive sharing patterns. Region-based systems offer lexically scoped regions under a stack discipline, wherein resources are managed in bulk. In many such systems, however, resources are second-class and can neither escape their scope nor be freely returned from functions. Ownership and linear type systems, such as Rust, offer first-class, non-lexical lifetimes with robust static guarantees, but rely on invariants that limit higher-order patterns and expressive sharing. In this work, we propose a type system that uniformly treats all heap-allocated resources under diverse lifetime, granularity, and sharing settings. Our system provides programmers with three allocation modes: (1) fresh allocation for first-class, non-lexical resources; (2) fresh allocation for second-class resources with lexically bounded lifetimes; and (3) coallocation that groups resources by shadow arenas for bulk tracking and deallocation. Regardless of mode, resources are represented uniformly at the type level, supporting generic abstraction and preserving the higher-order parametric nature of the language. Obtaining static safety in higher-order languages with flexible sharing is nontrivial. To address this, our solution builds on reachability types, and our extension adds the capability to track both individual and grouped resources, enables the expression of cyclic store structures, and allows the selective enforcing of stack lifetime discipline. These mechanisms are formalized in the A < : ∗ and { A } < : ∗ type systems, which are proven type safe and memory safe in Rocq.

链接与引用

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

BibTeX
@article{paperbot3834,
  title = {When Lifetimes Liberate: A Type System for Arenas with Higher-Order Reachability Tracking},
  author = {Siyuan He and Songlin Jia and Yuyan Bao and Tiark Rompf},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {OOPSLA1},
  year = {2026},
  doi = {10.1145/3798254}
}