This artifact contains the mechanized formalization accompanying the article Precise Reasoning about Container-Internal Pointers with Logical Pinning. It provides:
- The complete Rocq development of the logical pinning model;
- The mechanized formalization of all case studies and examples stated in the paper, illustrating the application of the model and proof discipline;
- A reproducible build environment based on opam;
- Guide on how to compile the development and navigate the code structure.
The following are the most interesting parts of the development:
Borrowable.v: Core logic for handling borrowable values.ValOps.v: Specs and proofs for operations on single cells.MRecord.v: Definitions and lemmas of records.Stdlib.v: Helpful functions.
-
Lists: Linked listsList_impl.v: Implementation of list APIs.ListE_API.v: Lists with borrowable elements.ListES_API.v: Lists with borrowable elements and borrowable tails.
-
Trees: Binary treesTree_impl.v: Implementation of tree APIs.Tree_API.v: Plain trees.Tree_E.v: Tree with borrowable elements.Tree_S.v: Tree with borrowable subtrees.Tree_ES.v: Tree with borrowable elements and borrowable subtrees.
-
Other examples:
- “Logger” (using
incr_allinstead ofset_level_all):Triple_logger_exampleinListE_API.v. - “Element swapping”:
Triple_swap_eleminListE_API.v. - “find” API from CPP'16:
Triple_findinTreeS_API.v(orTreeES_API.v). - “Binary-tree left rotation”:
- Conceptually complicated proof using plain representation predicates:
Triple_left_rotateinTree_API.v - Simple proof using logical pinning:
Triple_left_rotateinTreeS_API.v(orTreeES_API.v).
- Conceptually complicated proof using plain representation predicates:
- "Subtree-compare":
Triple_subtree_compareinTreeS_API.v.
- “Logger” (using
You can run our provided build script run.sh. This script will:
- create a new opam switch called "lp";
- install all dependencies and compile them;
- compile our development.
At the end of running the script (this can take several minutes), if everything succeeded you should see the following line: "[logical-pinning] Compiled all proofs.".
This build script is tested on Ubuntu 24.04. For other platforms, please refer to the manual setup.
This artifact depends on the Equations plugin, the TLC library and a variant of the CFML library. We have tested it with Coq 8.20.1 built with OCaml 4.14.2. We recommend creating a clean OPAM switch for testing purposes:
opam update
opam switch create lp ocaml-base-compiler.4.14.2
eval $(opam env --switch=lp --set-switch)
opam pin add -y coq 8.20.1
opam repo add coq-released https://coq.inria.fr/opam/released
opam pin add -y coq-equations 1.3.1+8.20
CFML and TLC are not hosted on OPAM, so they must be built manually. We have included their source code in this artifact.
-
Install dependencies
opam install -y pprint menhir -
Build TLC and install it:
make -C tlc -j make -C tlc install -
Build CFML and install it:
make -C cfml depend make -C cfml -j libcoq stdlib
We have tested the above commands on Ubuntu 24.04. For other platforms, please consult the links provided above for each package.
Run make.