Skip to content

Commit cd66a65

Browse files
catalin-hritcujeremyThibault
authored andcommitted
Add interfaces to program and context types
1 parent 4fd3451 commit cd66a65

15 files changed

+533
-523
lines changed

Alternative2FR.v

Lines changed: 86 additions & 86 deletions
Large diffs are not rendered by default.

CommonST.v

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,49 @@ Set Implicit Arguments.
1111

1212
Record language :=
1313
{
14-
par : Set; (* partial programs *)
14+
int : Set;
15+
par : int -> Set; (* partial programs *)
16+
ctx : int -> Set; (* context *)
1517
prg : Set; (* whole programs *)
16-
ctx : Set; (* context *)
17-
plug : par -> ctx -> prg;
18+
plug : forall {i:int}, par i -> ctx i -> prg;
1819
sem : prg -> prop;
1920
non_empty_sem : forall W, exists t, sem W t
2021
}.
2122

22-
2323
Axiom src : language.
2424
Axiom tgt : language.
25-
Axiom compile_par : (par src) -> (par tgt).
26-
Axiom compile_ctx : (ctx src) -> (ctx tgt).
27-
Axiom compile_prg : (prg src) -> (ctx tgt).
25+
26+
Axiom cint : int src -> int tgt.
27+
28+
Axiom compile_par : forall {i}, (par src i) -> (par tgt (cint i)).
29+
Axiom compile_ctx : forall {i}, (ctx src i) -> (ctx tgt (cint i)).
30+
31+
Axiom i : int src.
2832

2933
Notation "C [ P ]" := (plug _ P C) (at level 50).
3034
Notation "P ↓" := (compile_par P) (at level 50).
3135

36+
Section Ki.
3237

33-
Definition psem {K : language}
34-
(P : prg K)
38+
Context {K : language} {i : int K}.
39+
40+
Definition psem (P : prg K)
3541
(m : finpref) : Prop :=
3642
exists t, prefix m t /\ (sem K) P t.
3743

38-
Definition xsem {K : language}
39-
(P : prg K)
44+
Definition xsem (P : prg K)
4045
(x : xpref) : Prop :=
4146
exists t, xprefix x t /\ (sem K) P t.
4247

43-
Definition sat {K : language}
44-
(P : prg K)
48+
Definition sat (P : prg K)
4549
(π : prop) : Prop :=
4650
forall t, sem K P t -> π t.
4751

48-
Definition rsat {K : language}
49-
(P : par K)
52+
Definition rsat (P : par K i)
5053
(π : prop) : Prop :=
5154
forall C, sat (C [ P ] ) π.
5255

53-
54-
Lemma neg_rsat {K : language} :
56+
Lemma neg_rsat :
5557
forall P π, (~ rsat P π <->
5658
(exists C t, sem K (C [ P ]) t /\ ~ π t)).
5759
Proof.
@@ -66,30 +68,28 @@ Proof.
6668
Qed.
6769

6870

69-
Definition beh {K : language} (P : prg K) : prop :=
71+
Definition beh (P : prg K) : prop :=
7072
fun b => sem K P b.
7173

72-
Definition hsat {K : language}
73-
(P : prg K)
74+
Definition hsat (P : prg K)
7475
(H : hprop) : Prop :=
7576
H (beh P).
7677

77-
Definition rhsat {K : language}
78-
(P : par K)
78+
Definition rhsat (P : par K i)
7979
(H : hprop) : Prop :=
8080
forall C, hsat ( C [ P ] ) H.
8181

82-
Lemma neg_rhsat {K : language} :
83-
forall P H, (~ rhsat P H <-> ( exists (C : ctx K), ~ H (beh ( C [ P ] )))).
82+
Lemma neg_rhsat : forall (P:par K i) H,
83+
(~ rhsat P H <-> ( exists (C : ctx K i), ~ H (beh ( C [ P ] )))).
8484
Proof.
8585
intros P H. split; unfold rhsat; intro H0;
8686
[now rewrite <- not_forall_ex_not | now rewrite not_forall_ex_not].
8787
Qed.
8888

89-
Definition sat2 {K : language} (P1 P2 : @prg K) (r : rel_prop) : Prop :=
89+
Definition sat2 (P1 P2 : @prg K) (r : rel_prop) : Prop :=
9090
forall t1 t2, sem K P1 t1 -> sem K P2 t2 -> r t1 t2.
9191

92-
Lemma neg_sat2 {K : language} : forall P1 P2 r,
92+
Lemma neg_sat2 : forall P1 P2 r,
9393
~ sat2 P1 P2 r <-> (exists t1 t2, sem K P1 t1 /\ sem K P2 t2 /\ ~ r t1 t2).
9494
Proof.
9595
unfold sat2. intros P1 P2 r. split.
@@ -106,19 +106,18 @@ Proof.
106106
Qed.
107107

108108

109-
Definition rsat2 {K : language} (P1 P2 : @par K) (r : rel_prop) : Prop :=
109+
Definition rsat2 (P1 P2 : par K i) (r : rel_prop) : Prop :=
110110
forall C, sat2 (C [ P1 ]) (C [ P2 ]) r.
111111

112-
113-
Definition hsat2 {K : language} (P1 P2 : @prg K) (r : rel_hprop) : Prop :=
112+
Definition hsat2 (P1 P2 : prg K) (r : rel_hprop) : Prop :=
114113
r (sem K P1) (sem K P2).
115114

116-
Definition hrsat2 {K : language} (P1 P2 : @par K) (r : rel_hprop) : Prop :=
115+
Definition hrsat2 (P1 P2 : par K i) (r : rel_hprop) : Prop :=
117116
forall C, r (sem K (C [P1])) (sem K (C [P2])).
118117

119118
(**************************************************************************)
120119

121-
Definition input_totality (K : language) : Prop :=
120+
Definition input_totality : Prop :=
122121
forall (P : prg K) l e1 e2,
123122
is_input e1 -> is_input e2 -> psem P (ftbd (snoc l e1)) -> psem P (ftbd (snoc l e2)).
124123

@@ -128,11 +127,13 @@ Definition traces_match (t1 t2 : trace) : Prop :=
128127
is_input e1 /\ is_input e2 /\ e1 <> e2 /\
129128
prefix (ftbd (snoc l e1)) t1 /\ prefix (ftbd (snoc l e2)) t2).
130129

131-
Definition determinacy (K : language) : Prop :=
130+
Definition determinacy : Prop :=
132131
forall (P : prg K) t1 t2,
133132
sem K P t1 -> sem K P t2 -> traces_match t1 t2.
134133

135-
Definition semantics_safety_like (K : language) : Prop :=
134+
Definition semantics_safety_like : Prop :=
136135
forall t P,
137136
~ sem K P t -> inf t -> ~ diverges t ->
138137
(exists l ebad, psem P (ftbd l) /\ prefix (ftbd (snoc l ebad)) t /\ ~ psem P (ftbd (snoc l ebad))).
138+
139+
End Ki.

0 commit comments

Comments
 (0)