Compositional Reasoning for Side-effectful Iterators and Iterator Adapters

10/18/2022
by   Aurel Bílý, et al.
0

Iteration is a programming operation that traditionally refers to visiting the elements of a data structure in sequence. However, modern programming systems such as Rust, Java, and C# generalise iteration far beyond the traditional use case. They allow iterators to be parameterised with (potentially side-effectful) closures and support the composition of iterators to form iterator chains, where each iterator in the chain consumes values from its predecessor and produces values for its successor. Such generalisations pose three major challenges for modular specification and verification of iterators and the client code using them: (1) How can parameterised iterators be specified modularly and their (accumulated) side effects reasoned about? (2) How can the behaviour of an iterator chain be derived from the specifications of its component iterators? (3) How can proofs about such iterators be automated? We present the first methodology for the modular specification and verification of advanced iteration idioms with side-effectful computations. It addresses the three challenges above using a combination of inductive two-state invariants, higher-order closure contracts, and separation logic-like ownership. We implement and our methodology in a state-of-the-art SMT-based Rust verifier. Our evaluation shows that our methodology is sufficiently expressive to handle advanced and idiomatic iteration idioms and requires modest annotation overhead.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
05/28/2021

Gobra: Modular Specification and Verification of Go Programs (extended version)

Go is an increasingly-popular systems programming language targeting, es...
research
08/02/2023

Staged Specifications for Automated Verification of Higher-Order Imperative Programs

Higher-order functions and imperative references are language features s...
research
11/09/2017

Soft Contract Verification for Higher-Order Stateful Programs

Software contracts allow programmers to state rich program properties us...
research
10/09/2020

Igloo: Soundly Linking Compositional Refinement and Separation Logic for Distributed System Verification

Lighthouse projects such as CompCert, seL4, IronFleet, and DeepSpec have...
research
09/29/2020

Iteration in ACL2

Iterative algorithms are traditionally expressed in ACL2 using recursion...
research
04/21/2022

Modular Control Plane Verification via Temporal Invariants

Satisfiability Modulo Theory (SMT)-based tools for network control plane...
research
05/17/2021

Summing Up Smart Transitions

Some of the most significant high-level properties of currencies are the...

Please sign up or login with your details

Forgot password? Click here to reset