论文标题

埃涅阿斯:通过功能翻译验证生锈

Aeneas: Rust Verification by Functional Translation

论文作者

Ho, Son, Protzenko, Jonathan

论文摘要

我们提出了埃涅阿斯,这是一种基于轻质功能翻译的生锈程序的新验证工具链。只要它们不依赖内部可变性或不安全的代码,我们利用Rust富含区域的类型系统来消除许多Rust程序的内存推理。这样做,我们减轻了证明工程师的基于内存的推理的负担,使他们可以专注于其代码的功能属性。 我们的第一个贡献是一种新的借用和可控别名的方法。我们为LLBC提出了一种纯粹的功能性语义,这是一种捕获大量生锈程序的低级借用微积分。我们的语义是基于价值的,这意味着没有内存,地址或指针算术的概念。我们的语义也以所有权为中心,这意味着我们通过基于贷款的语义标准而不是通过基于句法类型的寿命学科来实施借用的声音。我们声称我们的语义捕获了借用机制的本质,而不是当前在生锈编译器中实施。 我们的第二个贡献是从LLBC转换为纯Lambda-Calculus。这使用户可以通过其选择的定理供款来推论原始的生锈程序。为了应对终止借用的众所周知的技术难度,我们依靠一种新颖的方法,在这种方法中,我们在函数呼叫的存在下近似借用图。反过来,这使我们能够使用称为向后功能的新技术设备执行翻译。 我们以Rust和Ocaml的混合物来实现工具链。我们的评估显示了程序员的验证生产率很大。 生锈的长度很长,可以强制对异议的静态控制;当这么多的“免费”出现时,证明工程师不应浪费任何时间在记忆推理上!

We present Aeneas, a new verification toolchain for Rust programs based on a lightweight functional translation. We leverage Rust's rich region-based type system to eliminate memory reasoning for many Rust programs, as long as they do not rely on interior mutability or unsafe code. Doing so, we relieve the proof engineer of the burden of memory-based reasoning, allowing them to instead focus on functional properties of their code. Our first contribution is a new approach to borrows and controlled aliasing. We propose a pure, functional semantics for LLBC, a Low-Level Borrow Calculus that captures a large subset of Rust programs. Our semantics is value-based, meaning there is no notion of memory, addresses or pointer arithmetic. Our semantics is also ownership-centric, meaning that we enforce soundness of borrows via a semantic criterion based on loans rather than through a syntactic type-based lifetime discipline. We claim that our semantics captures the essence of the borrow mechanism rather than its current implementation in the Rust compiler. Our second contribution is a translation from LLBC to a pure lambda-calculus. This allows the user to reason about the original Rust program through the theorem prover of their choice. To deal with the well-known technical difficulty of terminating a borrow, we rely on a novel approach, in which we approximate the borrow graph in the presence of function calls. This in turn allows us to perform the translation using a new technical device called backward functions. We implement our toolchain in a mixture of Rust and OCaml. Our evaluation shows significant gains of verification productivity for the programmer. Rust goes to great lengths to enforce static control of aliasing; the proof engineer should not waste any time on memory reasoning when so much already comes "for free"!

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源