The version of Coq used in our development is 8.18.0, where the version of underlying OCaml compiler is 4.13.1. We recommend installing Coq and the required packages via OPAM. The official page of OPAM describes how to install and configure OPAM, and the official page of Coq describes how to install Coq and Coq packages with OPAM.
We have tested on our machine that after executing opam repo add coq-released https://coq.inria.fr/opam/released according to the official page of Coq, running the following commands can install all required packages for compiling our project:
opam install coq-mathcomp-ssreflect=2.1.0
opam install coq-mathcomp-zify coq-mathcomp-algebra=2.1.0 coq-mathcomp-fingroup=2.1.0 coq-mathcomp-finmap=2.1.0
opam install coq-flocq
opam install coq-bignums=9.0.0+coq8.18
opam install coq-interval=4.9.0
opam install coq-vcfloat=2.1.1 --ignore-constraints-on=coqThe flag --ignore-constraints-on is necessary for working around some version constraints.
Execute the following command in the terminal:
makePlease note that warnings (in yellow colour) may appear during the compilation, but they will not cause the compilation to fail.
This project consists of two major folders: lib/ with LGTM metatheory formalisation and experiments/ with LGTM case study evaluation. First we present a brief description of lib/ folder contents:
theory/: various extensions of Coq Standard Libraryseplog/: LGTM metatheoty mechanisationLibSepFmap: mechanisation of finite mappingsLibSepVar: auxilary file to deal with variablesLibSepSimpl: tactic for heap asserions simplification and automationLibHypHeap: lemmas about hyper heap assertionsLibWP: lemmas about weakest precondition calculusLibXWP: setting up a Coq framework (automation and notations) to reason about LGTM hyper-triples in weakest precondition styleLibArrays: lemmas to reason about arrays in LGTMLibLoops: lemmas to reason aboutfor/whileloops in LGTMLibLoops_float: lemmas to reason aboutfor/whileloops operating with floats in LGTMNTriple: lemmas for structural LGTM hyper-triples transformationsSubst: machanisation and a tactic forSubstrule from the paper
Structural rules:
- Focus:
wp_unioninlib/seplog/LibWP.v - Product:
htriple_union_pointwiseinlib/seplog/LibWP.v - Conseq:
htriple_conseqinlib/seplog/LibWP.v - Frame:
htriple_frameinlib/seplog/LibWP.v
Lockstep rules:
- Ret:
htriple_valinlib/seplog/LibWP.v - Read:
htriple_getinlib/seplog/LibWP.v - Asn:
htriple_setinlib/seplog/LibWP.v - Fr:
htriple_freeinlib/seplog/LibWP.v - Alc:
htriple_refinlib/seplog/LibWP.v - MAlc:
htriple_alloc_natinlib/seplog/LibArray.v - MFr:
htriple_deallocinlib/seplog/LibArray.v - Let:
htriple_letinlib/seplog/LibWP.v - If:
htriple_ifinlib/seplog/LibWP.v - Len:
htriple_array_lengthinlib/seplog/LibArray.v - AsnArr:
htriple_array_setinlib/seplog/LibArray.v - ReadArr:
htriple_array_getinlib/seplog/LibArray.v
Domain substitution rule:
- Subst:
htriple_hsubinlib/seplog/LibWP.v
Rule for for-loops:
- For:
wp_forinlib/seplog/LibXWP.v
Rule for while-loops:
- While:
wp_whileinlib/seplog/LibXWP.v
Mechanisation of the overview example from the paper can be found in experiments folder.
Evaluation Case Studies:
- #1:
sum_specinexperiments/SV.v - #2:
dotprod_specinexperiments/SV.v - #3:
sv_dotprod_specinexperiments/SV.v - #4:
sum_specinexperiments/COO.v - #5:
sum_specinexperiments/CSR.v - #6:
spmv_specinexperiments/CSR.v - #7:
spmspv_specinexperiments/CSR.v - #8:
sum_specinexperiments/uCSR.v - #9:
spmv_specinexperiments/uCSR.v - #10:
spmspv_specinexperiments/uCSR.v - #11:
rlsum_specinexperiments/RL.v - #12:
alpha_blend_specinexperiments/RL.v - #13:
spmv_specinexperiments/CSR_float.v
Mechanised proof of the overview case study, presented in Section 4, is located in experiments/uCSR.v with all correspondent comments.
The Coq-specific details of the framework are explained in Triple.md. Triple.md explains how LGTM specification triples are embedded in the Coq development.
Triple.md-- explains how LGTM triples are embeddedexperiments/uCSR.v-- explains the mechanised proof of Section 4 from the paper, as well as other uCSR related proofs.experiments/SV.v-- explains the mechanised proofs related to operations on SV format.experiments/CSR.v-- explains the CSR format. Mechanised proofs inexperiments/CSR.vare similar to ones inexperiments/uCSR.v.- Other
experiments/*files - Files with metatheory mechanisation