This project is the companion Rocq development of the paper "All for One and One for All: Program Logics for Exploiting Internal Determinism in Parallel Programs".
See INSTALL.md.
Coq files are located in the src/ directory.
- directory
langcontains the syntax and semantics of the language we study. - directory
musketeercontains the Musketeer logic:- The Musketeer logic is defined as
tripleinlockstep.v. - Its adequacy theorem appears in
adequacy.v - The ChainedLog logic is defined as
dwpindwp.v - Its adequacy theorem appears in
dwp_adequacy.v
- The Musketeer logic is defined as
- directory
angeliccontains the angelic logic and its adequacy theorem. - directory
types/affinecontains the MiniDet type system:- Syntactical rules are in
syntactical.v - The soundness theorem is in
fundamental.v.
- Syntactical rules are in
- directory
types/lvarcontains a toy type system inspired by LVar. - directory
utilscontains utility functions - Code and examples are in
examples/
Coq files are located in the src/ directory.
- Section 2.1:
- the
dumasexample is covered inexamples/dumas.v - code for the atomic counter is in
examples/counter.v
- the
- Figure 1:
- specifications related to the counter are in
examples/counter.v:- M-KSplit:
vcounter_split - M-KRef:
triple_rref - M-KAdd:
triple_ratomic_add - M-KGet:
triple_rget
- M-KSplit:
- Musketeer rules are in
musketeer/lockstep.v:- M-Assert:
triple_assert - M-Par:
triple_par
- M-Assert:
- specifications related to the counter are in
- Figure 2:
- specifications related to the counter are in
examples/counter.v:- A-Ref:
run_rref - A-Add:
run_ratomic_add - A-Get:
run_rget
- A-Ref:
- Angelic rules are in
angelic/run.v:- A-Assert:
run_assert - A-ParSeqL:
run_par_seql - A-ParSeqR:
run_par_seqr
- A-Assert:
- specifications related to the counter are in
- Figure 3: syntactical definitions are in
lang/syntax.v. Projections are separated in two constructors. The active parallel tuple is called RunPar. - Figure 4: the head reduction relation is in
lang/head_semantics.v - Figure 5: the main reduction relation is in
lang/semantics.v - Figure 6:
- reducibility is defined in
lang/reducible.v - NotStuck and Safe are defined in
musketeer/adequacy.v - SISafety is defined in
musketeer/adequacy.v. It differs from the paper: it has two parameters (two expressions), they will be instantiated by the same expression in the end. Moreover, it assumes that one expression is "closed", in the sense that it contains no locations initially (locations are runtime objects that should not appear in the program before execution).
- reducibility is defined in
- Theorem 4.1: stated in
musketeer/lockstep_adequacy.v, lemmatriple_adequacy - Figure 7: Musketeer rules are in
musketeer/lockstep.v - Section 4.4:
M-ElimExist is in
musketeer/lockstep.v, lemmatriple_elim_exist - Theorem 5.1: stated in
musketeer/adequacy.v, lemmaadequacy. Note that chained triples are implemented as "chained WPs", where the left precondition should be specified with a magic wand, that is: a chained triple{ Pl } el { Ql | Pr } er { Qr }is realized as□ (Pl -∗ dwp ⊤ el Pr er Ql Qr) - Section 5.1:
C-Chain in
musketeer/dwp.v, lemmadwpk_chain - Figure 8: Chained triples rules are in
musketeer/dwp.v - Figure 9: vProp is a standard Iris construct, see [https://gitlab.mpi-sws.org/iris/iris/-/blob/master/iris/bi/monpred.v]. In MonPred, the proposition is parameterized by a monotonic property. In our case, the property is trivialized with the equality.
- Figure 10: in
musketeer/lockstep.v, definitiontriple - Figure 11: Angelic rules are in
angelic/run.v - Theorem 6.1: in
angelic/adequacy.v, lemmarun_adequacy - Figure 12: syntax of MiniDet is in
types/affine/typing.v - Figure 13: syntactical rules are in
types/affine/syntactical.v - Figure 14:
- shapes are in
types/affine/shape.v - the logical relation is defined as
interpintypes/affine/logrel.v
- shapes are in
- Lemma 7.1: in
types/affine/soundness.v, lemmasoundness - Lemma 7.2: in
types/affine/soundness.v, lemmafundamental - Figure 15: in
examples/priority.v - Figure 16:
- syntactical rules are in
types/affine/syntactical.v - the update relation is
upd_typintypes/affine/typing.v
- syntactical rules are in
- Figure 17:
- triples for priority writes in
examples/priority.v - logical relation in
types/affine/logrel.v - the predicate ispw is called
is_priority_at_least, the predicate ispr isis_priority_is
- triples for priority writes in
- Figure 18: in
examples/hashtbl.v - Figure 19: syntactical rules are in
types/affine/syntactical.v. An IntSet is called a HashSet. - Figure 20: compared to the paper, the Rocq development
supports hash sets with arbitrary element, but the user must provide
a total comparison function and a hash function. This implies additional
hypotheses that are trivially satisfied if the elements are integers and
the comparison function is
<.- triples are in
examples/hashtbl.v - logical relation in
types/affine/logrel.v
- triples are in
- Figure 21:
- parfor is defined in
examples/parfor.v - dedup is defined in
examples/dedup.v - the section
ex_instantiationprovides a concrete instantiation of the hash and comparison functions that are parameters of dedup.
- parfor is defined in
- Section 7.4:
- forspec is defined in
examples/parfor_seq.v - angelic specification for dedup is in
examples/dedup_seq.v
- forspec is defined in
Users can check that all files compile and that no Admitted or Axiom
remains. It suffices to open the file src/noaxioms.v and play with it
interactively.
If the Coq command Print Assumptions xxx prints "Closed under the
global context", it indicates that xxx has no dependencies (reference).
Users can also open some selected .v files inside CoqIDE or Proof
General and evaluate the whole file to check that no errors occur and
to verify that the objects and statements mentioned in the claims are
what they are supposed to be.
NB: There is a hack to work with ProofGeneral.
We have a dumb src/_CoqProject which makes visible the files
produced by dune.
See issue: ProofGeneral/PG#477