🤖 AI Summary
This paper addresses the challenge of precisely modeling and verifying container APIs—and their client programs—in separation logic when internal pointers are temporarily exposed. We propose *logical pinning*, a technique that selectively tracks exposed pointers within separation logic to enable fine-grained stability reasoning. Furthermore, we innovatively extend the magic wand operator with a lightweight borrowing model, unifying the treatment of transient pointer behaviors that elude traditional approaches. Our mechanized verification is conducted in the Rocq proof assistant using the CFML library, integrating representation predicates and logical-level specifications. Contributions include: (i) a restructured, precise, and modular specification framework for common container data structures; (ii) formal verification of representative pointer-manipulating programs and complex APIs—including iterators and borrow-based access patterns; and (iii) significant improvements in specification expressivity, verifiability, and modularity.
📝 Abstract
Most separation logics hide container-internal pointers for modularity. This makes it difficult to specify container APIs that temporarily expose those pointers to the outside, and to verify programs that use these APIs. We present logical pinning, a lightweight borrowing model for sequential programs that allows users to selectively track container-internal pointers at the logical level. Our model generalizes the magic-wand operator, making it easy to write and prove precise specifications, including pointer-stability properties. Because it only changes how representation predicates and specifications are written, our approach is compatible with most separation logic variants. We demonstrate the practicality of logical pinning by verifying small but representative pointer-manipulating programs, and deriving more precise versions of common container specifications. In doing so, we show that our approach subsumes some well-known proof patterns, simplifies some complex proofs, and enables reasoning about program patterns not supported by traditional specifications. All of our results are mechanized in the Rocq proof assistant, using the CFML library.