Skip to content

Commit 49d0fd3

Browse files
committed
it-compiler-proof
1 parent a323e4f commit 49d0fd3

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

proofs/compiler/it_compiler_proof.v

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,34 +67,43 @@ Context
6767
(print_sprogP : forall s p, cparams.(print_sprog) s p = p)
6868
.
6969

70-
Definition of_void1 {A T} (e : void1 A) : T := match e with end.
71-
Definition of_void_sum {E} : E +' void1 ~> E :=
72-
fun _ x => match x with inl1 a => a | inr1 e => of_void1 e end.
70+
#[local]
71+
Instance with_Error0 : with_Error (ErrEvent +' RndEvent syscall_state) (RndEvent syscall_state).
72+
Proof.
73+
refine {| mfun1 T x := x; mfun2 T x := x |}; done.
74+
Qed.
7375

7476
#[local]
75-
Instance with_Error0 : with_Error ErrEvent void1 :=
77+
Instance HandlerContract : EventRels (RndEvent syscall_state) :=
7678
{|
77-
mfun1 := inl1;
78-
mfun2 := of_void_sum;
79-
mid12 := fun _ e =>
80-
match e with inl1 e => refl_equal | inr1 a => of_void1 a end;
81-
mid21 := fun _ _ => refl_equal;
79+
EPreRel0_ := fun A B r1 r2 =>
80+
let: Rnd scs1 n1 := r1 in
81+
let: Rnd scs2 n2 := r2 in
82+
scs1 = scs2 /\ n1 = n2;
83+
EPostRel0_ := fun A B r1 =>
84+
match r1 in RndEvent _ A' return A' -> _ with
85+
Rnd scs1 n1 => fun (a: syscall_state * seq u8) r2 =>
86+
match r2 in RndEvent _ B' return B' -> _ with
87+
Rnd scs2 n2 => fun (b: syscall_state * seq u8) => a = b
88+
end
89+
end
8290
|}.
8391

8492
#[local]
85-
Instance HandlerContract : EventRels void1 :=
86-
{|
87-
EPreRel0_ := fun _ _ _ _ => False;
88-
EPostRel0_ := fun _ _ _ _ _ _ => True;
89-
|}.
93+
Instance : RndE0 syscall_state (RndEvent syscall_state) := fun T => id.
9094

9195
#[local]
92-
Instance HandlerContract_trans {rE23 rE13} :
93-
EventRels_trans HandlerContract rE23 rE13 :=
94-
{|
95-
ERpre_trans := fun _ _ _ e => of_void1 e;
96-
ERpost_trans := fun _ _ _ e => of_void1 e;
97-
|}.
96+
Instance : RndE0_refl HandlerContract.
97+
Proof. by constructor. Qed.
98+
99+
#[local]
100+
Instance HandlerContract_trans :
101+
EventRels_trans HandlerContract HandlerContract HandlerContract.
102+
Proof.
103+
constructor.
104+
- by move => T1 T2 T3 [scs1 n1] [scs2 n2] [scs3 n3] [-> ->] [-> ->].
105+
- move => ??? [??] [??] [??] ?? [] -> -> [] -> -> -> /=; eauto.
106+
Qed.
98107

99108
Section FIRST_PART.
100109

0 commit comments

Comments
 (0)