Flux: Liquid Types for Rust

07/08/2022
by   Nico Lehmann, et al.
0

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

READ FULL TEXT

page 1

page 2

page 3

page 4

research
01/01/2018

TWAM: A Certifying Abstract Machine for Logic Programs

Type-preserving (or typed) compilation uses typing derivations to certif...
research
11/25/2017

Refinement Types for Ruby

Refinement types are a popular way to specify and reason about key progr...
research
02/18/2020

ConSORT: Context- and Flow-Sensitive Ownership Refinement Types for Imperative Programs

We present ConSORT, a type system for safety verification in the presenc...
research
12/11/2021

Overcoming Restraint: Composing Verification of Foreign Functions with Cogent

Cogent is a restricted functional language designed to reduce the cost o...
research
08/22/2022

Verification-Preserving Inlining in Automatic Separation Logic Verifiers (extended version)

Bounded verification has proved useful to detect bugs and to increase co...
research
08/04/2020

Trace Logic for Inductive Loop Reasoning

We propose trace logic, an instance of many-sorted first-order logic, to...
research
03/26/2020

Data-Driven Inference of Representation Invariants

A representation invariant is a property that holds of all values of abs...

Please sign up or login with your details

Forgot password? Click here to reset