Skip to content

Commit 620e995

Browse files
authored
Merge pull request #8 from DistributedComponents/fcsl-pcm
Port to fcsl-pcm
2 parents 8584ec0 + def3f89 commit 620e995

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+975
-8058
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,4 @@ extraction/**/*.ml
8383
_build
8484
*.d.byte
8585
Makefile.coq.conf
86+
.coqdeps.d

.travis-ci.sh

100644100755
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1+
#!/usr/bin/env bash
2+
13
set -ev
24

3-
opam init --yes --no-setup
45
eval $(opam config env)
56

6-
opam repo add coq-released https://coq.inria.fr/opam/released
7-
opam repo add coq-core-dev https://coq.inria.fr/opam/core-dev
8-
opam repo add coq-extra-dev https://coq.inria.fr/opam/extra-dev
9-
10-
opam pin add coq $COQ_VERSION --kind=version --yes
11-
opam pin add coq-mathcomp-ssreflect $SSREFLECT_VERSION --kind=version --yes --verbose
7+
opam update
128

13-
opam pin add Heaps --yes --verbose
149
opam pin add Core --yes --verbose
1510
make -j4 -C Examples

.travis.yml

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,54 @@
1-
language: c
2-
addons:
3-
apt:
4-
sources:
5-
- avsm
6-
packages:
7-
- ocaml
8-
- opam
9-
- aspcud
1+
language: generic
2+
sudo: false
3+
4+
services:
5+
- docker
6+
107
env:
8+
global:
9+
- THIS_REPO=disel
1110
matrix:
12-
- COQ_VERSION=8.7.1 SSREFLECT_VERSION=1.6.4
13-
script: bash -ex .travis-ci.sh
14-
sudo: false
11+
- COQ_VERSION=coq8.7-32bit
12+
- COQ_VERSION=coq8.8-32bit
13+
14+
# The "docker run" command will pull if needed.
15+
# Running this first gives two tries in case of network lossage.
16+
before_script:
17+
- timeout 5m docker pull palmskog/xenial-for-verdi-$COQ_VERSION || true
18+
19+
# Using travis_wait here seems to cause the job to terminate after 1 minute
20+
# with no error (!).
21+
# The git commands are tried twice, in case of temporary network failure.
22+
# The fcntl line works around a bug where Travis truncates logs and fails.
23+
script:
24+
- python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
25+
- REMOTE_ORIGIN_URL=`git config --get remote.origin.url`
26+
- echo "THIS_REPO=${THIS_REPO}"
27+
- echo "COQ_VERSION=${COQ_VERSION}"
28+
- echo "TRAVIS_BRANCH=${TRAVIS_BRANCH}"
29+
- echo "REMOTE_ORIGIN_URL=${REMOTE_ORIGIN_URL}"
30+
- echo "TRAVIS_EVENT_TYPE=${TRAVIS_EVENT_TYPE}"
31+
- echo "TRAVIS_COMMIT=${TRAVIS_COMMIT}"
32+
- echo "TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST}"
33+
- echo "TRAVIS_PULL_REQUEST_BRANCH=${TRAVIS_PULL_REQUEST_BRANCH}"
34+
- echo "TRAVIS_PULL_REQUEST_SHA=${TRAVIS_PULL_REQUEST_SHA}"
35+
- echo "TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG}"
36+
- >-
37+
docker run palmskog/xenial-for-verdi-$COQ_VERSION /bin/bash -c "true &&
38+
if [ $TRAVIS_EVENT_TYPE = pull_request ] ; then
39+
git clone --quiet --depth 9 $REMOTE_ORIGIN_URL $THIS_REPO || git clone --quiet --depth 9 $REMOTE_ORIGIN_URL $THIS_REPO
40+
cd $THIS_REPO
41+
git fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge
42+
git checkout -qf $TRAVIS_PULL_REQUEST_SHA
43+
else
44+
git clone --quiet --depth 9 -b $TRAVIS_BRANCH $REMOTE_ORIGIN_URL $THIS_REPO || git clone --quiet --depth 9 -b $TRAVIS_BRANCH $REMOTE_ORIGIN_URL $THIS_REPO
45+
cd $THIS_REPO
46+
git checkout -qf $TRAVIS_COMMIT
47+
fi &&
48+
./.travis-ci.sh"
49+
50+
git:
51+
depth: 9
52+
1553
notifications:
1654
email: false

Core/Actions.v

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ From mathcomp
44
Require Import path.
55
Require Import Eqdep.
66
Require Import Relation_Operators.
7-
From DiSeL.Heaps
8-
Require Import pred prelude idynamic ordtype finmap pcm unionmap heap coding.
9-
From DiSeL.Core
7+
From fcsl
8+
Require Import axioms pred prelude ordtype finmap pcm unionmap heap.
9+
From DiSeL
1010
Require Import Freshness State EqTypeX Protocols Worlds NetworkSem.
1111
Require Classical_Prop.
1212

@@ -285,19 +285,19 @@ set s2 := let: d := getS s l in
285285
upd l (DStatelet f' s') s.
286286
exists s2, msg; split=>//; exists b; split=>//.
287287
move: (safe_safe (And4 C S J K))=> S''.
288-
by rewrite -E (proof_irrelevance S'' S') .
288+
by rewrite -E (pf_irr S'' S') .
289289
Qed.
290290

291291
Lemma send_act_step_sem s1 (S : send_act_safe s1) s2 r:
292292
send_act_step S s2 r -> network_step W this s1 s2.
293293
Proof.
294294
case=>_[b][E Z]; case: (S)=>C S' /andP[D1] D2 K; subst s2=>/=.
295-
rewrite (proof_irrelevance (safe_safe S) S') in E; clear S.
295+
rewrite (pf_irr (safe_safe S) S') in E; clear S.
296296
rewrite /all_hooks_fire/filter_hooks in K.
297297
move: st S' E K pf'; clear pf' st; subst p=>st S' E K' pf'.
298298
apply: (@SendMsg W this s1 _ l st pf' to msg)=>////.
299299
move=>z lc hk E'; apply: (K' z); rewrite E'.
300-
by rewrite find_um_filt/= eqxx.
300+
by rewrite find_umfilt/= eqxx.
301301
Qed.
302302

303303
Definition send_action_wrapper :=

Core/Always.v

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ From mathcomp
44
Require Import path.
55
Require Import Eqdep.
66
Require Import Relation_Operators.
7-
From DiSeL.Heaps
8-
Require Import pred prelude idynamic ordtype finmap pcm unionmap heap coding.
9-
From DiSeL.Core
7+
From fcsl
8+
Require Import axioms pred prelude ordtype finmap pcm unionmap heap.
9+
From DiSeL
1010
Require Import Freshness State EqTypeX DepMaps Protocols Worlds NetworkSem Rely.
11-
From DiSeL.Core
12-
Require Import Actions Injection Process.
13-
From DiSeL.Core
14-
Require InductiveInv.
11+
From DiSeL
12+
Require Import Actions Injection Process InductiveInv.
1513

1614
Set Implicit Arguments.
1715
Unset Strict Implicit.
@@ -27,7 +25,7 @@ Variable W : world.
2725

2826
Notation coherent := (Coh W).
2927

30-
Implicit Arguments proc [W this].
28+
Arguments proc [this W].
3129

3230
Fixpoint always_sc A (s1 : state) p scs (P : state -> proc A -> Prop) : Prop :=
3331
s1 \In coherent /\
@@ -152,7 +150,7 @@ Proof.
152150
move=>C H [|sc scs]; split=>// s2; case/H=>// H1[H2]H3//.
153151
split=>//; first by case: sc.
154152
move=>s3 q /stepAct [v][pf][_ -> St].
155-
rewrite (proof_irrelevance H1 pf) in H3.
153+
rewrite (pf_irr H1 pf) in H3.
156154
apply: alw_ret'; last by move=>s4; apply: H3 St.
157155
by case: (step_coh (a_step_sem St)).
158156
Qed.
@@ -207,7 +205,7 @@ move=>Ls; split.
207205
by move=>H ps; apply/(alwA' _ (Ls ps))=>x; apply: H.
208206
Qed.
209207

210-
Implicit Arguments alwA [A B s p P].
208+
Arguments alwA [A B s p P].
211209

212210
(* always commutes with implication, so we can weaken the postconditions *)
213211

@@ -240,7 +238,7 @@ move=>Ls; split; first by move=>H Hp scs; apply/alwI': Hp.
240238
by move=>H scs; apply/alwI'=>//; move/H; move/(_ scs).
241239
Qed.
242240

243-
Implicit Arguments alwI [A s p P Q].
241+
Arguments alwI [A s p P Q].
244242

245243

246244
Lemma alw_bnd A B (p1 : proc A) (p12 : proc B) pp2 s1
@@ -336,8 +334,8 @@ split; apply: alw_imp=>t q _ I.
336334
by move=>v; move/I.
337335
Qed.
338336

339-
Implicit Arguments aftA [A B s p P].
340-
Implicit Arguments aftI [A s p P Q].
337+
Arguments aftA [A B s p P].
338+
Arguments aftI [A s p P Q].
341339

342340
End Always.
343341

@@ -364,8 +362,8 @@ case: (sem_split w C1 C2 N); case=>R E; [subst s2'|subst s2];
364362
split=>//; apply: Idle; split=>//.
365363
case: (step_coh N)=>C _.
366364
case/(cohE w): (C)=>s3[s4][E]C' C''.
367-
move: (coh_prec (cohS C) E C1 C')=>Z; subst s3.
368-
by rewrite (joinfK (cohS C) E).
365+
move: (coh_prec (cohS C) C1 C' E)=>Z; subst s3.
366+
by rewrite (joinxK (cohS C) E).
369367
Qed.
370368

371369
Lemma rely_split s1 s1' s2 s2' :
@@ -382,12 +380,12 @@ elim: n s1 s1' E C1 C2=>[|n IH] /= s1 s1'; last first.
382380
+ by case: G1=>m R; exists m.+1, z, s4.
383381
by case: G2=>m R; exists m.+1, z, s5.
384382
move=> [E1 E2] C1 C2.
385-
move: (coh_prec (cohS E2) E1 C1 C2)=>Z; subst s2.
386-
rewrite (joinfK (cohS E2) E1); split; exists 0=>//.
387-
split=>//; rewrite -(joinfK (cohS E2) E1)=>{E1 s2' C2}.
383+
move: (coh_prec (cohS E2) C1 C2 E1)=>Z; subst s2.
384+
rewrite (joinxK (cohS E2) E1); split; exists 0=>//.
385+
split=>//; rewrite -(joinxK (cohS E2) E1)=>{E1 s2' C2}.
388386
move/(cohE w): (E2)=>[t1][t2][E]C' C''.
389-
move: ((coh_prec (cohS E2)) E C1 C')=>Z; subst t1.
390-
by rewrite (joinfK (cohS E2) E).
387+
move: ((coh_prec (cohS E2)) C1 C' E)=>Z; subst t1.
388+
by rewrite (joinxK (cohS E2) E).
391389
Qed.
392390

393391

@@ -423,13 +421,13 @@ case=>sc' [q'][x1][i2][y1][_ -> E -> {sc q s}] _ T Ls.
423421

424422
have [E1 E2] : x1 = i1 /\ y1 = j1.
425423
- case: T=>Cx1 _.
426-
move: (coh_prec (cohS C) E Ci1 Cx1) (E)=><-{E Cx1 x1}.
427-
by move/(joinfK (cohS C)).
424+
move: (coh_prec (cohS C) Ci1 Cx1 E) (E)=><-{E Cx1 x1}.
425+
by move/(joinxK (cohS C)).
428426
rewrite {E x1}E1 {y1}E2 in T *.
429427
have C' : i2 \+ j1 \In Coh W.
430428
- move: (C)=>C'; rewrite (cohE w) in C *=>[[s1]][s2][E]D1 D2.
431-
move: (coh_prec (cohS C') E Ci1 D1)=>Z; subst i1.
432-
move: (joinfK (cohS C') E)=>Z; subst s2; clear E.
429+
move: (coh_prec (cohS C') Ci1 D1 E)=>Z; subst i1.
430+
move: (joinxK (cohS C') E)=>Z; subst s2; clear E.
433431
apply/(cohE w); exists i2, j1; split=>//.
434432
by case/step_coh: (pstep_network_sem T).
435433
move/(alw_step Ls): T=>{Ls} Ls.

Core/DepMaps.v

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ From mathcomp
44
Require Import path.
55
Require Import Eqdep.
66
Require Import Relation_Operators.
7-
From DiSeL.Heaps
8-
Require Import pred prelude idynamic ordtype finmap pcm unionmap heap coding.
9-
From DiSeL.Core
7+
From fcsl
8+
Require Import pred prelude ordtype finmap pcm unionmap heap.
9+
From DiSeL
1010
Require Import Freshness EqTypeX.
1111
Set Implicit Arguments.
1212
Unset Strict Implicit.
1313
Unset Printing Implicit Defensive.
1414

15-
1615
(* An implementation of a dependent map structure *)
1716

1817
Module DepMaps.
@@ -25,7 +24,7 @@ Variable V : Type.
2524
Variable labF: V -> Label.
2625

2726
Definition dmDom (u : union_map Label V) : bool :=
28-
all (fun l => if find l u is Some p then (labF p) == l else false) (keys_of u).
27+
all (fun l => if find l u is Some p then (labF p) == l else false) (dom u).
2928

3029
Record depmap := DepMap {
3130
dmap : union_map Label V;
@@ -37,9 +36,7 @@ Section PCMOps.
3736
Variable dm : depmap.
3837

3938
Lemma dmDom_unit : dmDom Unit.
40-
Proof.
41-
by apply/allP=>l; rewrite keys_dom dom0 inE.
42-
Qed.
39+
Proof. by apply/allP=>l; rewrite dom0. Qed.
4340

4441
Definition unit := DepMap dmDom_unit.
4542

@@ -53,12 +50,12 @@ Lemma dmDom_join um1 um2:
5350
dmDom um1 -> dmDom um2 -> dmDom (um1 \+ um2).
5451
Proof.
5552
case; case W: (valid (um1 \+ um2)); last first.
56-
- by move=> _ _; apply/allP=>l; rewrite keys_dom=>/dom_valid; rewrite W.
57-
move/allP=>D1/allP D2; apply/allP=>l; rewrite keys_dom.
53+
- by move=> _ _; apply/allP=>l; move/dom_valid; rewrite W.
54+
move/allP=>D1/allP D2; apply/allP=>l.
5855
rewrite domUn inE=>/andP[_]/orP; rewrite findUnL//; case=>E; rewrite ?E.
59-
- by apply: D1; rewrite keys_dom.
56+
- by apply: D1.
6057
rewrite joinC in W; case: validUn W=>// _ _ /(_ l E)/negbTE->_.
61-
by apply: D2; rewrite keys_dom.
58+
by apply: D2.
6259
Qed.
6360

6461
Definition join : depmap := DepMap (dmDom_join (@pf dm1) (@pf dm2)).
@@ -84,21 +81,21 @@ Lemma joinC f1 f2 : f1 \+ f2 = f2 \+ f1.
8481
Proof.
8582
case: f1 f2=>d1 pf1[d2 pf2]; rewrite /join/=.
8683
move: (dmDom_join pf1 pf2) (dmDom_join pf2 pf1); rewrite joinC=>G1 G2.
87-
by move: (proof_irrelevance G1 G2)=>->.
84+
by move: (bool_irrelevance G1 G2)=>->.
8885
Qed.
8986

9087
Lemma joinCA f1 f2 f3 : f1 \+ (f2 \+ f3) = f2 \+ (f1 \+ f3).
9188
Proof.
9289
case: f1 f2 f3=>d1 pf1[d2 pf2][d3 pf3]; rewrite /join/=.
9390
move: (dmDom_join pf1 (dmDom_join pf2 pf3)) (dmDom_join pf2 (dmDom_join pf1 pf3)).
94-
by rewrite joinCA=>G1 G2; move: (proof_irrelevance G1 G2)=>->.
91+
by rewrite joinCA=>G1 G2; move: (bool_irrelevance G1 G2)=>->.
9592
Qed.
9693

9794
Lemma joinA f1 f2 f3 : f1 \+ (f2 \+ f3) = (f1 \+ f2) \+ f3.
9895
Proof.
9996
case: f1 f2 f3=>d1 pf1[d2 pf2][d3 pf3]; rewrite /join/=.
10097
move: (dmDom_join pf1 (dmDom_join pf2 pf3)) (dmDom_join (dmDom_join pf1 pf2) pf3).
101-
by rewrite joinA=>G1 G2; move: (proof_irrelevance G1 G2)=>->.
98+
by rewrite joinA=>G1 G2; move: (bool_irrelevance G1 G2)=>->.
10299
Qed.
103100

104101
Lemma validL f1 f2 : valid (f1 \+ f2) -> valid f1.
@@ -108,7 +105,7 @@ Lemma unitL f : unit \+ f = f.
108105
Proof.
109106
rewrite /join/unit/=; case: f=>//=u pf.
110107
move: pf (dmDom_join (dmDom_unit labF) pf); rewrite unitL=>g1 g2.
111-
by move: (proof_irrelevance g1 g2)=>->.
108+
by move: (bool_irrelevance g1 g2)=>->.
112109
Qed.
113110

114111
Lemma validU : valid unit.
@@ -127,7 +124,7 @@ Definition DepMap := DepMap.
127124
Lemma dep_unit (d : depmap labF) : dmap d = Unit -> d = unit labF.
128125
Proof.
129126
case: d=>u pf/=; rewrite /unit. move: (dmDom_unit labF)=>pf' Z; subst u.
130-
by rewrite (proof_irrelevance pf).
127+
by rewrite (bool_irrelevance pf).
131128
Qed.
132129

133130
Coercion dmap := dmap.

Core/DiSeLExtraction.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From DiSeL.Core
1+
From DiSeL
22
Require Import While.
33

44
Require Import ExtrOcamlBasic.

0 commit comments

Comments
 (0)