Skip to content

Commit ef09b49

Browse files
committed
Require spawn and terminate covariance
1 parent 566c973 commit ef09b49

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

theories/Handlers/Mailbox.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ Section defn.
122122
h_handler _ req := mailbox_step req;
123123
h_initial := new;
124124
h_spawn pid mb_t := put pid {| mb_t := mb_t; mb_q := empty |};
125+
h_spawn_covariance pid mb_t s s' H := ltac:(now rewrite H);
125126
h_terminate pid := delete pid;
127+
h_terminate_covariance pid s s' H := ltac:(now rewrite H);
126128
|}.
127129
End defn.

theories/Handlers/Storage.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ Section storage_handler.
7777
h_handler _ req := storage_mfun req;
7878
h_initial := stor.new;
7979
h_spawn _ _ := id;
80+
h_spawn_covariance _ _ _ _ H := H;
8081
h_terminate _ := id;
82+
h_terminate_covariance _ _ _ H := H;
8183
|}.
8284
End storage_handler.
8385

theories/IOHandler.v

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@ Section IOHandler.
1717
Definition MFunRet Ret State `{HRet : Setoid Ret} `{HState : Setoid State} :=
1818
@MFun State (Ret * State) HState (@pair_setoid _ _ HRet HState).
1919

20+
2021
Class IOHandler := {
2122
h_state : Type;
2223
h_setoid : Setoid h_state;
2324
h_handler (pid : Ref) (req : Request) : MFunRet (Reply req) h_state;
2425
h_initial : h_state;
2526

2627
h_spawn (pid : Ref) (mailbox_t : Set) : h_state -> h_state;
28+
h_spawn_covariance : forall pid mailbox_t s s',
29+
s == s' ->
30+
h_spawn pid mailbox_t s == h_spawn pid mailbox_t s';
2731
h_terminate (pid : Ref) : h_state -> h_state;
32+
h_terminate_covariance : forall pid s s',
33+
s == s' ->
34+
h_terminate pid s == h_terminate pid s';
2835
}.
2936
End IOHandler.
3037

0 commit comments

Comments
 (0)