paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Generic Refinement Types

泛型精化类型(Generic Refinement Types)
POPL 9(POPL)2025匹配度 4/10 · 论文属于精化类型与程序验证,兼具形式化和 Rust 工程实现,与 PL/形式化验证方向有交集;但未涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析,也不是面向 ML/Agentic 程序的静态分析,与用户当前核心交叉方向匹配有限。引用 3 inbox
Nico Lehmann, Cole Kurashige, Nikhil Akiti, Niroop Krishnakumar, Ranjit Jhala
crossref: 2026-09-10

AI 速览

一句话:提出泛型精化类型,用 ghost 参数抽象函数契约不变量,保持 SMT 可判定验证并在 Rust 中实现。

本文提出泛型精化类型,用于编写模块化高阶规约:使函数契约能抽象不同实现的具体精化,同时保持 SMT 可判定验证。作者在核心演算中形式化泛型精化,借助语法合一与约束求解在使用点自动合成泛型实例;并将语义解释为 ghost 参数,通过到多态契约演算的类型保持翻译证明可靠性。作者在 Flux 中实现该机制,并用于两个案例:为 Rust 向量索引 API 写模块化规约,静态验证多个向量操作基准的越界安全性;精化 Rust diesel ORM,追踪数据库查询语义,从而在数据库驱动 Web 应用中静态执行数据相关访问控制策略。

问题
如何编写模块化的高阶精化规约,使其能抽象函数契约上的不变量及不同实现的具体精化,同时不牺牲自动 SMT 可判定验证,例如 Rust trait 不同实现的精化难以复用。
方法
在核心演算中形式化泛型精化,用语法合一与约束求解在使用点自动合成泛型实例;语义上将其对应为 ghost 参数,并通过到多态契约演算的类型保持翻译证明可靠性。
评估
在 Flux 中实现泛型精化,并开展两个案例研究:为 Rust 向量索引 API 写模块化规约以静态验证多个基准的越界安全;精化 diesel ORM 以追踪查询语义并静态执行数据相关访问控制策略。
原文摘要(Abstract)

We present Generic Refinement Types : a way to write modular higher-order specifications that abstract invariants over function contracts, while preserving automatic SMT-decidable verification. We show how generic refinements let us write a variety of modular higher-order specifications, including specifications for Rust’s traits which abstract over the concrete refinements that hold for different trait implementations. We formalize generic refinements in a core calculus and show how to synthesize the generic instantiations algorithmically at usage sites via a combination of syntactic unification and constraint solving. We give semantics to generic refinements via the intuition that they correspond to ghost parameters , and we formalize this intuition via a type-preserving translation into the polymorphic contract calculus to establish the soundness of generic refinements. Finally, we evaluate generic refinements by implementing them in F luk and using it for two case studies. First, we show how generic refinements let us write modular specifications for Rust’s vector indexing API that lets us statically verify the bounds safety of a variety of vector-manipulating benchmarks from the literature. Second, we use generic refinements to refine Rust’s diesel ORM library to track the semantics of the database queries issued by client applications, and hence, statically enforce data-dependent access-control policies in several database-backed web applications.

链接与引用

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

BibTeX
@article{paperbot3241,
  title = {Generic Refinement Types},
  author = {Nico Lehmann and Cole Kurashige and Nikhil Akiti and Niroop Krishnakumar and Ranjit Jhala},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {POPL},
  year = {2025},
  doi = {10.1145/3704885}
}