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"!
翻译:我们为鲁斯特程序提供了一个基于轻量级功能翻译的新的核查工具链 Aeneas 。 我们利用鲁斯特丰富的区域类型系统来消除许多鲁斯特程序的记忆推理, 只要它们不依赖内部变异性或不安全的代码。 这样, 我们就可以减轻内存推理负担的证明工程师, 让他们能够专注于其代码的功能性能。 我们的第一个贡献是借出和控制化别名的新方法。 我们为LLBC提出一个纯正功能性语义, 一个低级别借款计算器, 它可以捕捉鲁斯特程序的大量子集。 我们的精度计算器基于价值, 意思是不存在内存、 地址或指算概念。 我们的精度计算器也以所有权为中心, 意味着我们通过基于贷款的语义标准而不是基于同步的终身纪律来实施借款的音义性能。 我们的语义学已经掌握了借款机制的精髓, 而不是当前在鲁斯特编译器中实施。 我们的第二个贡献来自LBC的翻译, 意思是没有记忆、 缩缩算过程的精度的翻译。