paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Flux: Liquid Types for Rust

Flux:面向 Rust 的液体类型
PLDI 7(PLDI)2023匹配度 3/10 · 这是一篇扎实的 PL/类型系统与程序验证工作(逻辑精化 + Rust 所有权 + 液态推断),兼具形式化与工程实现,符合你对理论+工程、工业落地的偏好;但它与用户画像的核心方向(PL↔AI/LLM、浮点程序分析、贝叶斯程序分析)均无交集,属于纯 PL 验证工作。引用 29 inbox
Nico Lehmann, Adam T. Geller, Niki Vazou, Ranjit Jhala
crossref: 2026-09-10

AI 速览

一句话:提出 Flux,将逻辑精化与 Rust 所有权结合,实现指针程序的易用类型验证与液态推断。

Flux 让逻辑精化与 Rust 所有权机制协同,对底层指针程序做易用的类型验证。其精化类型系统用纯值索引可变位置,借所有权在泛型构造器中抽象子结构推理并支持强更新,还基于 Stacked Borrows 证明良借用良类型程序不会卡住。Flux 作为 Rust 编译器插件实现,利用类型与精化分解,通过 liquid inference 合成循环注解和容器的量化不变式。在向量基准及安全沙箱库片段上,相比 Prusti,规约行数减半、验证时间快一个数量级,注解开销从最高 24%(平均 14%)降到零。

问题
底层指针操作程序的验证通常需要大量规约与注解;能否利用 Rust 所有权与精化类型兼顾表达力与易用性?
方法
设计索引可变位置的精化类型系统,借所有权抽象子结构推理并用 Stacked Borrows 证明可靠性;在 Rust 编译器中实现 Flux,利用 liquid inference 合成循环与量化不变式。
评估
在向量操作基准和已验证安全沙箱库片段上,与最先进的 Prusti 比较,规约行数减半、验证时间快一个数量级,注解开销由最高 24%(平均 14%)降至零。
原文摘要(Abstract)

We introduce Flux, which shows how logical refinements can work hand in glove with Rust's ownership mechanisms to yield ergonomic type-based verification of low-level pointer manipulating programs. First, we design a novel refined type system for Rust that indexes mutable locations, with pure (immutable) values that can appear in refinements, and then exploits Rust's ownership mechanisms to abstract sub-structural reasoning about locations within Rust's polymorphic type constructors, while supporting strong updates. We formalize the crucial dependency upon Rust's strong aliasing guarantees by exploiting the Stacked Borrows aliasing model to prove that "well-borrowed evaluations of well-typed programs do not get stuck". Second, we implement our type system in Flux, a plug-in to the Rust compiler that exploits the factoring of complex invariants into types and refinements to efficiently synthesize loop annotations-including complex quantified invariants describing the contents of containers-via liquid inference. Third, we evaluate Flux with a benchmark suite of vector manipulating programs and parts of a previously verified secure sandboxing library to demonstrate the advantages of refinement types over program logics as implemented in the state-of-the-art Prusti verifier. While Prusti's more expressive program logic can, in general, verify deep functional correctness specifications, for the lightweight but ubiquitous and important verification use-cases covered by our benchmarks, liquid typing makes verification ergonomic by slashing specification lines by a factor of two, verification time by an order of magnitude, and annotation overhead from up to 24% of code size (average 14%), to nothing at all.

链接与引用

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

BibTeX
@article{paperbot1959,
  title = {Flux: Liquid Types for Rust},
  author = {Nico Lehmann and Adam T. Geller and Niki Vazou and Ranjit Jhala},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {PLDI},
  year = {2023},
  doi = {10.1145/3591283}
}