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=coq
The flag --ignore-constraints-on
is necessary for working around some version constraints.
Execute the following command in the terminal:
make
Please 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
/while
loops in LGTMLibLoops_float
: lemmas to reason aboutfor
/while
loops operating with floats in LGTMNTriple
: lemmas for structural LGTM hyper-triples transformationsSubst
: machanisation and a tactic forSubst
rule from the paper
Structural rules:
- Focus:
wp_union
inlib/seplog/LibWP.v
- Product:
htriple_union_pointwise
inlib/seplog/LibWP.v
- Conseq:
htriple_conseq
inlib/seplog/LibWP.v
- Frame:
htriple_frame
inlib/seplog/LibWP.v
Lockstep rules:
- Ret:
htriple_val
inlib/seplog/LibWP.v
- Read:
htriple_get
inlib/seplog/LibWP.v
- Asn:
htriple_set
inlib/seplog/LibWP.v
- Fr:
htriple_free
inlib/seplog/LibWP.v
- Alc:
htriple_ref
inlib/seplog/LibWP.v
- MAlc:
htriple_alloc_nat
inlib/seplog/LibArray.v
- MFr:
htriple_dealloc
inlib/seplog/LibArray.v
- Let:
htriple_let
inlib/seplog/LibWP.v
- If:
htriple_if
inlib/seplog/LibWP.v
- Len:
htriple_array_length
inlib/seplog/LibArray.v
- AsnArr:
htriple_array_set
inlib/seplog/LibArray.v
- ReadArr:
htriple_array_get
inlib/seplog/LibArray.v
Domain substitution rule:
- Subst:
htriple_hsub
inlib/seplog/LibWP.v
Rule for for-loops:
- For:
wp_for
inlib/seplog/LibXWP.v
Rule for while-loops:
- While:
wp_while
inlib/seplog/LibXWP.v
Mechanisation of the overview example from the paper can be found in experiments
folder.
Evaluation Case Studies:
- #1:
sum_spec
inexperiments/SV.v
- #2:
dotprod_spec
inexperiments/SV.v
- #3:
sv_dotprod_spec
inexperiments/SV.v
- #4:
sum_spec
inexperiments/COO.v
- #5:
sum_spec
inexperiments/CSR.v
- #6:
spmv_spec
inexperiments/CSR.v
- #7:
spmspv_spec
inexperiments/CSR.v
- #8:
sum_spec
inexperiments/uCSR.v
- #9:
spmv_spec
inexperiments/uCSR.v
- #10:
spmspv_spec
inexperiments/uCSR.v
- #11:
rlsum_spec
inexperiments/RL.v
- #12:
alpha_blend_spec
inexperiments/RL.v
- #13:
spmv_spec
inexperiments/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.v
are similar to ones inexperiments/uCSR.v
.- Other
experiments/*
files - Files with metatheory mechanisation