paperbot · PL 论文追踪

全部论文 待读 收藏

P2 From Linearity to Borrowing

从线性到借用
OOPSLA 9(OOPSLA2)2025匹配度 3/10 · 该论文属于线性类型、借用语义与分离逻辑的形式化验证工作,与用户关注的 AI/LLM 交叉方向(如 Agentic 程序静态分析、LLM 改进形式化验证、浮点/贝叶斯程序分析)没有直接交集。它可作为 PL/形式语义背景知识存档,但不属于当前研究画像的核心追踪问题。引用 1 inbox
Andrew Wagner, Olek Gierczak, Brianna Marshall, John M. Li, Amal Ahmed
crossref: 2026-09-10

AI 速览

一句话:逐步为线性类型演算加入不可变借用、词法生命周期、再借用与可变借用,并用分离逻辑证明其语义类型安全。

线性类型系统能静态保证资源管理安全,但显式线性传递资源使用不便。Rust 式借用通过临时禁用释放或修改等权限,换取弱化、收缩等结构权限,从而减轻负担,同时保证资源最终归还。本文从无类型 lambda 演算上保障手动内存管理的线性类型系统出发,逐步加入不可变借用、词法生命周期、再借用和可变借用,形成 Borrow Calculus (BoCa)。作者提出 Borrow Logic (BoLo),一种面向借用领域的分离逻辑,并用其证明 BoCa 的语义类型可靠性。该逻辑的语义模型还保证程序终止且无内存泄漏,并可验证一些语法上类型不良、会临时破坏但能恢复不变式的程序安全。

问题
线性类型要求资源在计算中显式传递,即使良性使用也很繁琐。如何在不牺牲静态安全的前提下,为线性资源引入 Rust 式借用,并给出其语义与可靠性证明?
方法
从无类型 lambda 演算的线性类型系统出发,逐步加入不可变借用、词法生命周期、再借用和可变借用,形成 BoCa;设计面向借用的分离逻辑 BoLo,并构造语义模型证明其可靠性。
评估
通过 BoLo 的语义模型证明 BoCa 的语义类型可靠性,并额外保证终止性与无内存泄漏;还展示该逻辑能验证某些语法上类型不良但临时破坏并恢复不变式的程序安全。
原文摘要(Abstract)

Linear type systems are powerful because they can statically ensure the correct management of resources like memory, but they can also be cumbersome to work with, since even benign uses of a resource require that it be explicitly threaded through during computation. Borrowing , as popularized by Rust, reduces this burden by allowing one to temporarily disable certain resource permissions (e.g., deallocation or mutation) in exchange for enabling certain structural permissions (e.g., weakening or contraction). In particular, this mechanism spares the borrower of a resource from having to explicitly return it to the lender but nevertheless ensures that the lender eventually reclaims ownership of the resource. In this paper, we elucidate the semantics of borrowing by starting with a standard linear type system for ensuring safe manual memory management in an untyped lambda calculus and gradually augmenting it with immutable borrows, lexical lifetimes, reborrowing, and finally mutable borrows. We prove semantic type soundness for our Borrow Calculus ( BoCa ) using Borrow Logic ( BoLo ), a novel domain-specific separation logic for borrowing. We establish the soundness of this logic using a semantic model that additionally guarantees that our calculus is terminating and free of memory leaks. We also show that our Borrow Logic is robust enough to establish the semantic safety of some syntactically ill-typed programs that temporarily break but reestablish invariants.

链接与引用

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

BibTeX
@article{paperbot2967,
  title = {From Linearity to Borrowing},
  author = {Andrew Wagner and Olek Gierczak and Brianna Marshall and John M. Li and Amal Ahmed},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {OOPSLA2},
  year = {2025},
  doi = {10.1145/3764117}
}