A type system for extracting functional specifications from memory-safe imperative programs
Paul He, Eddy Westbrook, Brent Carmer et al. · Proceedings of the ACM on Programming Languages · 2021
Verifying imperative programs is hard. A key difficulty is that the specification of what an imperative program does is often intertwined with details about pointers and imperative state. Although there are a number of powerful separation logics that allow the details of imperative state to be captured and managed, these details are complicated and reasoning about them requires significant time and expertise. In this paper, we take a different approach: a memory-safe type system that, as part of type-checking, extracts functional specifications from imperative programs. This disentangles imperative state, which is handled by the type system, from functional specifications, which can be verified without reference to pointers. A key difficulty is that sometimes memory safety depends crucially on the functional specification of a program; e.g., an array index is only memory-safe if the index is in bounds. To handle this case, our specification extraction inserts dynamic checks into the specification. Verification then requires the additional proof that none of these checks fail. However, these checks are in a purely functional language, and so this proof also requires no reasoning about pointers.
Cited by 5 works. doi:10.1145/3485512 Open-access PDF
Authors
- Paul He
- Eddy Westbrook
- Brent Carmer
- Chris Phifer
- Valentin Robert
- Karl Smeltzer
- Andrei R Stefanescu
- Aaron Tomb
- Adam Wick
- Matthew Yacavone
- Steve Zdancewic
References
- Model checking
- A theory of type polymorphism in programming
- Design and synthesis of synchronization skeletons using branching time temporal logic
- Separation logic: a logic for shared mutable data structures
- A Marriage of Rely/Guarantee and Separation Logic
- Local Action and Abstract Separation Logic
- Data types à la carte
- Iris
- Formal Verification of a C-like Memory Model and Its Uses for Verifying Program Transformations
- Iris from the ground up: A modular foundation for higher-order concurrent separation logic