From mathcomp.ssreflect
From mathcomp
From fcsl
From DiSeL
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
(* Framing with respect to the world *)
Module Injection.
Section Injection.
Variable W : world.
Structure injects (U V : world) (K : hooks) := Inject {
(* The "delta world" *)
E : world;
_ : hook_complete U /\ hook_complete E;
(* Additional hooks are included with an empty world *)
_ : V = U \+ E \+ (Unit, K);
(* Additional hooks are well-formed with respect to the world *)
_ : hooks_consistent (getc (U \+ E)) K;
(* These all should be easy to prove given a standard world disentanglement *)
_ : forall s, Coh V s <-> exists s1 s2,
[/\ s = s1 \+ s2, Coh U s1 & Coh E s2];
(* Framing wrt. worlds and hooks *)
_ : forall s1 s2 s this,
s1 \+ s \In Coh V -> network_step U this s1 s2 ->
network_step V this (s1 \+ s) (s2 \+ s);
_ : forall s1 s2 s1' s2' this,
s1 \In Coh U -> s2 \In Coh U ->
network_step V this (s1 \+ s1') (s2 \+ s2') ->
(network_step U this s1 s2   /\ s1' = s2') \/
(network_step E this s1' s2' /\ s1 = s2); }.
End Injection.
Module Exports.
Section Exports.
Definition inj_ext := E.
Definition injects := injects.
Definition Inject := Inject.

(* Specifications: *)
Lemma cohK (U V : world) (K : hooks) (w : injects U V K) :
V = U \+ inj_ext w \+ (Unit, K).
Lemma sem_split (U V : world) (K : hooks) (w : injects U V K) s1 s1' s2 s2' this:
s1 \In Coh U -> s2 \In Coh U ->
network_step V this (s1 \+ s1') (s2 \+ s2') ->
(network_step U this s1 s2   /\ s1' = s2') \/
(network_step (inj_ext w) this s1' s2' /\ s1 = s2).
Lemma projectS_cohR W1 W2 s :
s \In Coh (W1 \+ W2) -> hook_complete W2 -> projectS W2 s \In Coh W2.
Lemma coh_split W1 W2 s :
s \In Coh (W1 \+ W2) ->
hook_complete W1 -> hook_complete W2 ->
exists s1 s2 : state,
[/\ s1 \In Coh W1, s2 \In Coh W2 & s = s1 \+ s2].
Lemma injExtL' (W1 W2 : world) K (pf : injects W1 (W1 \+ W2) K) :
valid (W1 \+ W2) -> inj_ext pf \+ (Unit, K) = W2.
Lemma injExtR' W1 W2 K (pf : injects W2 (W1 \+ W2) K) :
valid (W1 \+ W2) -> inj_ext pf \+ (Unit, K) = W1.
Lemma injExtL W1 W2 (pf : injects W1 (W1 \+ W2) Unit) :
valid (W1 \+ W2) -> inj_ext pf = W2.
Lemma cohUnKL U W s s':
s \+ s' \In Coh (U \+ W) -> s' \In Coh W ->
hook_complete U -> s \In Coh U .
Lemma getPUn (U W : world) l :
valid (U \+ W) -> l \in dom U.1 ->
getProtocol U l = getProtocol (U \+ W) l.
Lemma getSUn s1 s2 l :
valid (s1 \+ s2) -> l \in dom s1 ->
getStatelet s1 l = getStatelet (s1 \+ s2) l.
Lemma hook_completeL (U : world) K :
valid (U \+ (Unit, K)) ->
hook_complete (U \+ (Unit, K)) -> hook_complete U.
Lemma get_protocol_hooks (U: world) K l:
valid U -> getProtocol (U \+ (Unit, K)) l = getProtocol U l.
Lemma coh_hooks (U : world) K s :
s \In (Coh (U \+ (Unit, K))) -> s \In (Coh U).
Lemma inj_hooks_complete (U W : world) K:
valid (U \+ W \+ (Unit, K)) ->
hook_complete U -> hook_complete W ->
hooks_consistent (U \+ W).1 K ->
hook_complete (U \+ W \+ (Unit, K)).
Lemma inject_step U W K this s1 s2 s1' s2' :
valid (U \+ W) ->
s1 \In Coh U -> s2 \In Coh U ->
hook_complete U -> hook_complete W ->
network_step (U \+ W \+ (Unit, K)) this (s1 \+ s1') (s2 \+ s2') ->
network_step U this s1 s2 /\ s1' = s2' \/
network_step W this s1' s2' /\ s1 = s2.