Preserving Separation Logic Specifications through Compilation
Carmine Abate, Kleio Liotati, František Farka, Sebastian Ertel
Abstract
Program specifications in separation logic describe ownership of resources and serve as logical interfaces for local reasoning. Compiler correctness, expressed as semantics preservation, does not by itself supply such an interface for compiled code, because it does not explicitly relate source and target resources and assertions. We investigate WP-preserving compilation: when a compiler translates a source program, the weakest preconditions that the program satisfies in a separation logic carry over to the compiled program. Our proof technique consists of a resource-aware simulation over interaction trees: it relates the resources required by corresponding source and target events, and tracks ownership through target operations, such as register accesses, that have no source counterpart. We apply the approach to a compiler from a structured imperative language to an assembly-like language, first for closed programs and then extended with modules and function calls. In the extended setting, each module can be verified in the source logic and compiled separately; its specifications carry over to the compiled module and are preserved when compiled modules are linked. All results are mechanized in Rocq.
Create a lesson
Related papers
Compiling Imperative Hardware Protocol Specifications to Hardware
Shared title terminology · Nikil V. Shyamsunder, Ernest Ng, Adrian Sampson et al.
Fibered Separation Logic: Weakest Preconditions, Universal Constructions, and Local Independence
Shared title terminology · John M. Li, Ryan Doenges, Pedro H. Azevedo de Amorim
Linking as Evaluation: Correct Separate Compilation via First-Class Environments
Shared title terminology · Jam Kabeer Ali Khan, Jinhao Tan, Bruno C. d. S. Oliveira
Djinnlang: Higher-Level Programming by Unambiguous Specification with an LLM in the Compiler
Shared title terminology · Simon Henniger, Stephen Chong, Nada Amin
Compositional Temporal Specifications for Interaction Trees
Shared title terminology · Linyu Yang, Jianwei Yin, Mingshuai Chen
Tenon: A Unified Programming Framework for Retargetable PIM Compilation
Shared title terminology · Niansong Zhang, Shiran Guo, Zhiru Zhang