This is a description of the artifact supplementing the paper Reconciling Event Structures with Modern Multiprocessors by Evgenii Moiseenko, Anton Podkopaev, Ori Lahav, Orestis Melkonian, and Viktor Vafeiadis.
The artifact is two Coq packages
(imm.1.1
and weakestmoToImm
) in a VirtualBox image.
The image has been tested with VirtualBox 5.2.34 with Oracle VM VirtualBox Extension pack.
Import the VirtualBox image into VirtualBox, and boot the machine.
The login is semantics
and the password is semantics
.
All necessary software is installed, and the imm
and weakestmoToImm
projects are checked out to
/home/semantics/Desktop/imm
and /home/semantics/Desktop/weakestmoToImm
correspondingly.
Additionally, Emacs (with Proof General), VS Code, and CoqIDE are installed so that you can browse the sources
and the latest version of the paper copied to /home/semantics/Desktop/paper.pdf
.
- Coq 8.9.1
- Hahn library (
coq-hahn
) - Utility library from the Promising semantics development (
coq-promising-lib
) - Intermediate Memory Model (
coq-imm.1.1
)
Please, note that coq-imm.1.1
is a dependency for weakestmoToImm
, but it is also a part of our artifact.
The preinstalled version of coq-imm
is exactly the same as code checked out in /home/semantics/Desktop/imm
.
The proofs might be checked by opening a terminal and running
cd /home/semantics/Desktop/imm
make clean; make -j2
for imm
and
cd /home/semantics/Desktop/weakestmoToImm
make clean; make -j2
for weakestmoToImm
.
There might be some warnings about notations. The build terminating without printing "error" is successful.
Please, note that building of the proofs might take a lot of time (especially, the imm
project).
The code supplementing the paper is spread over two packages:
imm
, where we extended theIMM
memory model with support for SC accesses comparing to the version from [Podkopaev-al:POPL19];weakestmoToImm
, which contains definitions of theWeaketmo
memory model and our proof of compilation correctness fromWeakestmo
toIMM
.
Below, there is a mapping from definitions and statements used in the paper to their counterparts in the Coq code.
- The main theorem of compilation correctness from Weakestmo to IMM (Theorem 1 from the paper) is represented
by
compilation_correctness
stated inweakestmoToImm/src/compilation/Compilation.v
. - The simulation relation
I
used to prove Theorem 1 is represented bysimrel_consistent
inweakestmoToImm/src/compilation/SimRel.v
. - Lemma 2 stating that the simulation relation
I
holds for the initial event structure corresponds tosimrel_init
inweakestmoToImm/src/compilation/SimRelInit.v
. - Lemma 3 stating that the simulation relation
I
can be restored after a traversal step is represented bysimrel_step
inweakestmoToImm/src/compilation/SimRelStep.v
. - Lemma 4 stating that if
I
holds for the final traversal configuration then the graph associated with the extracted subsetX
is isomorphic to the original IMM graphG
is represented bysimrel_extract
inweakestmoToImm/src/compilation/Compilation.v
- (§3.1) Events of event structures are encoded by
eventid
(which is equal tonat
) defined inweakestmoToImm/src/model/EventStructure.v
.
Labels (label
in Coq) are defined in fileimm/src/basic/Events.v
. - (§3.2) Event structures (
ES.t
in Coq) and the well-formedness predicate (ES.Wf
in Coq) stating basic properties of their components are defined inweakestmoToImm/src/model/EventStructure.v
. - (§3.3) A step of operational semantics of event structure construction (
step
in Coq) is defined inweakestmoToImm/src/construction/Step.v
. - (§3.4) The Weakestmo event structure consistency predicate along with definitions of relations
hb
andecf
and the notion of visible events (predicatevis
in Coq) are defined inweakestmoToImm/src/model/Consistency.v
.
(The consistency predicate is parameterized bymodel
which is eitherWeakest
orWeakestmo
. The former represents a version of Weakestmo [Chakraborty-Vafeiadis:POPL19] which is not considered in our paper.)
In footnote 9, we mention that our Coq formalization uses another definition of visible events (predicatevis
in Coq) comparing to the one in [Chakraborty-Vafeiadis:POPL19]. Their equivalence is stated by lemmacc_alt
inweakestmoToImm/src/model/Consistency.v
. - (§3.5)
The notion of execution graph (Definition 6,
execution
in Coq) is defined in fileimm/src/basic/Execution.v
. Unlike the paper representation, it is not defined as a special case of event structures. Moreover, as mentioned in footnote 11, execution graphs are defined with another type of events (actid
in Coq, fileimm/src/basic/Events.v
).
The notion of a subset of events extracted from an event structure (Definition 7,Execution.t
in Coq) is defined inweakestmoToImm/src/model/Execution.v
.
The notion of a execution graph associated with an extracted subset (simrel_extract
in Coq) is defined inweakestmoToImm/src/compilation/Compilation.v
.
- Function
s2g(G, S)
from the paper (which maps events of event structureS
to events of execution graphG
) is represented by functione2a
(stands for 'eventid
toactid
') defined inweakestmoToImm/src/imm_aux/EventToAction.v
. - In Coq, functions
⌈⌈·⌉⌉
and⌊⌊·⌋⌋
for liftings2g
to sets are represented ase2a □₁ ·
ande2a ⋄₁ ·
correspondingly; their relational counterparts—e2a □ ·
ande2a ⋄ ·
.
The simulation relation I
is represented by simrel_consistent
(and its part simrel
) in weakestmoToImm/src/compilation/SimRel.v
.
Below, we map elements of the paper's version of I
to the Coq version.
Most of them are represented by fields of simrel
or derivable from them:
gcons
(a field insimrel
).SCONS
(an entry insimrel_consistent
).sr_exec
(a field insimrel
).ex_cov_iss
(a field insimrel
).- (a) Equality of events' threads and labels up to values for events connected via
e2a
is represented bysr_e2a
(a field insimrel
). It uses auxiliary definitionsimrel_e2a
defined inweakestmoToImm/src/compilation/SimRelEventToAction.v
.
(b) Equality of labels for events and their covered and issued counterparts is represented byex_cov_iss_lab
(a field insimrel
). - Derivable from
sr_e2a
via lemmae2a_sb
stated inweakestmoToImm/src/imm_aux/EventToAction.v
. - Derivable from
sr_e2a
via lemmae2a_eq_in_cf
stated inweakestmoToImm/src/imm_aux/EventToAction.v
. - (a) Field
e2a_jf
ofsimrel_e2a
(which is represented insimrel
via fieldsr_e2a
) defined inweakestmoToImm/src/compilation/SimRelEventToAction.v
.
(b) Lemmajf_cov_iv_rf
stated inweakestmoToImm/src/compilation/SimRel.v
derivable fromjf_ex_in_cert_rf
(a field insimrel
). jfe_ex_iss
(a field insimrel
).- Field
e2a_ew
ofsimrel_e2a
(which is represented insimrel
via fieldsr_e2a
) defined inweakestmoToImm/src/compilation/SimRelEventToAction.v
. ew_ex_iss
(a field insimrel
).- Field
e2a_co
ofsimrel_e2a
(which is represented insimrel
via fieldsr_e2a
) defined inweakestmoToImm/src/compilation/SimRelEventToAction.v
.
In our proof, we show that Lemma 3, the simulation step (in Coq, simrel_step
in weakestmoToImm/src/compilation/SimRelStep.v
),
holds by doing induction on a certification run.
During the induction, we preserve predicate simrel_cert
defined in weakestmoToImm/src/compilation/SimRelCert.v
.
- (§4.3.1) The
determined
set (D
in Coq), relationsvf
andsjf
(cert_rf
in Coq) are defined inweakestmoToImm/src/compilation/CertRf.v
.
The certification run is defined via predicatecert_graph
and constructed via lemmacert_graph_start
inweakestmoToImm/src/compilation/CertGraph.v
.
The proof ofcert_graph_start
uses the receptiveness property (receptiveness_full
in Coq, defined in fileimm/src/promiseToImm/Receptiveness.v
) which is mentioned in footnote 12.
As mentioned in [Podkopaev-al:POPL19], we have two versions of the IMM
model being implemented in Coq:
IMM
(file imm/src/imm/imm.v
) and IMM_S
(file imm/src/imm/imm_s.v
).
Paradoxically, IMM_S
is the one we refer to in the paper and IMM
is a stronger version of it, which we use as another intermediate
step in compilation correctness proofs to hardware models.
The proof of compilation correctness from IMM_S
to IMM
is presented in
imm/src/imm/imm_sToimm.v
.
The extension of IMM_S
-consistency predicate to SC accesses (Definition 10) is defined by
predicate imm_psc_consistent
in file imm/src/imm/imm_s.v
,
whereas the extension for IMM
is embedded in predicate imm_consistent
in file imm/src/imm/imm.v
.
Versions of relations scb
, psc_base
, and psc_f
for both model are defined in the corresponding files.
-
(§5.1.1) The compilation correctness theorem from
IMM_SC
toTSO
is represented by lemmaIMM_consistent
inimm/src/hardware/immToTSO.v
. It has a precondition stating that there should be anmfence
between every SC write and following SC read as mentioned in the paper. -
(§5.1.2) Theorem 12 is represented by lemma
global_sc_ar
inimm/src/imm/Sc_opt.v
compilation correctness theorem fromIMM_SC
toPOWER
is split to a compilation
The compilation correctness theorem fromIMM_SC
toPOWER
(assuming the absence of SC accesses which are dealt by Theorem 12) is represented by lemmaIMM_consistent
inimm/src/hardware/immToPower.v
. -
(§5.1.4) The compilation correctness theorem from
IMM_SC
toARMv8
is represented by lemmaIMM_consistent
inimm/src/hardware/immToARM.v
.