From mathcomp.ssreflect 
Require Import ssreflect ssrbool ssrnat eqtype ssrfun seq.
From mathcomp
Require Import path.
Require Import Eqdep.
Require Import Relation_Operators.
From fcsl
Require Import axioms pred prelude ordtype finmap pcm unionmap heap.
From DiSeL
Require Import Freshness State EqTypeX Protocols Worlds.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.


(* Operational semantics of the network *)

Section NetworkSemantics.

Variable w : world.
Variable this: nid.

Notation getl := (getLocal).
Notation gets := (getStatelet).
Notation getp := (@getProtocol w).

(* Getters for transitions *)

Definition get_coh l := @coh (getp l).
Definition get_st l := @snd_trans (getp l).
Definition get_rt l := @rcv_trans (getp l).

Lemma getsE l s : l \in dom s -> find l s = Some (gets s l).
Proof.
(* Goal: @Coherence.sort (Protocols.nodes (getProtocol w k)) (coh (getProtocol w k)) match (if @PCM.valid (@union_map_classPCM Label dstatelet (union_mapUMC Label dstatelet)) s1 then @Some dstatelet (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) rt this from (tms_cont H1) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end (@coh_s l s1 (@And5 (is_true (@PCM.valid (prodPCM (union_mapPCM Label protocol) (union_mapPCM hook_domain hook_type)) w)) (is_true (@PCM.valid (union_mapPCM Label dstatelet) s1)) (hook_complete w) (@eq_mem nat (@mem nat (seq_predType (Ordered.eqType Label)) (@UMC.dom Label protocol (union_mapUMC Label protocol) (@fst context hooks w))) (@mem nat (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1))) (forall l : nat, @Coherence.sort (Protocols.nodes (getProtocol w l)) (coh (getProtocol w l)) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) W V K E H)) pf) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) (consume_msg (dsoup match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) i)) else @None dstatelet) with | Some d => d | None => empty_dstatelet end *)
move=>D. rewrite /gets; case f: (find l s)=>[v|]=>//.
(* Goal: @eq bool true (@PCM.valid (@union_map_classPCM nat_ordType Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap)) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) *)
by move: (find_none f); move/negbTE; rewrite D.
Qed.

Lemma coh_s l s: Coh w s -> coh (getp l) (gets s l).
Proof. by case=>_ _ _ /(_ l). Qed.

(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
Lemma Coh_dom l s : l \in dom s -> Coh w s -> 
                     dom (dstate (gets s l)) =i nodes (getp l) (gets s l).
Proof. by move=>D; case:w=>c h [] W V K E /(_ l); apply:cohDom. Qed.

(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* A predicate making all hooks apply to the send-transition with a
   tag st of a protocol with label l.  *)
Definition all_hooks_fire (h : hooks) l st s n (msg : seq nat) to :=
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  (* For any hook associated with client protocol l and send-tag st *)
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  forall z lc hk, Some hk = find ((z, lc), (l, st)) h ->
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  lc \in dom s -> l \in dom s ->               
  let: core_local   := getl n (gets s lc) in
  let: client_local := getl n (gets s l)  in              
  hk core_local client_local msg to.

(* Semantics of the network in the presence of some world *)
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Defining small-step semantics of the network *)
Inductive network_step (s1 s2 : state) : Prop :=
  (* Do nothing *)
  Idle of s1 \In Coh w /\ s1 = s2

  (* Send message *)
| SendMsg (* Pick a world, send transition and a recipient *)
          l st (_ : st \In @get_st l) to msg b
          (pf: this \in (nodes (getp l) (gets s1 l)))
          (pf' : l \in dom s1) (C: Coh w s1)
          
          (* It's safe to send *)
          (S : send_safe st this to (gets s1 l) msg)

          (* All hooks are applicable *)
          (pf_hooks : all_hooks_fire (geth w) l (t_snd st) s1 this msg to)
          
          (* b is a result of executing the transition *)
          (spf : Some b = send_step S) of
          
          (* Generate the message and the new local state *)
          let: d :=  gets s1 l in

          (* Update the soup and local state *)
          let: f' := upd this b (dstate d) in
          let: s' := (post_msg (dsoup d) (Msg (TMsg (t_snd st) msg)
                                              this to true)).1 in
          s2 = upd l (DStatelet f' s') s1

| ReceiveMsg l rt (_ : rt \In @get_rt l) i from
             (* Pick a world, receive transition and a message *)
             (pf: this \in (nodes (getp l)) (gets s1 l))
             (pf': l \in dom s1) (C: Coh w s1)
             (msg : TaggedMessage)
             (pf': tag msg = t_rcv rt) of
             let: d := (gets s1 l) in
             let: f := dstate d in
             let: s := dsoup d  in

             [/\ find i s = Some (Msg msg from this true),
              msg_wf rt (coh_s l C) this from msg &
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
              (* The semantics doesn't execute unsafe receive-transitions *)
              let loc' := receive_step rt from msg (coh_s l C) pf in
              let: f' := upd this loc' f in
              let: s'' := consume_msg s i in
              s2 = upd l (DStatelet f' s'') s1].


(* The first important result: network stepping preserves overall coherence.

   Intuitively, this follows from the fact that the transitions
   preserve coherence.  *)

(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
Lemma step_coh s1 s2: network_step s1 s2 ->
                      Coh w s1 /\ Coh w s2.
Proof.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
case=>[[H1 <-] | l st _ to a loc' pf D C S Ph Spf ->/= |
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
       l rt _ i from pf D C H1 msg [H3 H4->/=]]//; split=>//.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
- case: (C)=>W V K E H; split=>//; first by rewrite validU/= V.
(* Goal: @eq_mem (Equality.sort (Ordered.eqType Label)) (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label protocol (union_mapUMC Label protocol) (@fst context hooks w))) (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l))) (@PCM.join (union_mapPCM mid (msg TaggedMessage)) (dsoup (getStatelet s1 l)) (@um_pts nat_ordType (msg TaggedMessage) (@fresh (msg TaggedMessage) (dsoup (getStatelet s1 l))) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) st) a) this to true)))) s1))) *)
(* Goal: forall l0 : Ordered.sort Label, @Coherence.sort (Protocols.nodes (getProtocol w l0)) (coh (getProtocol w l0)) (getStatelet (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l))) (@PCM.join (union_mapPCM mid (msg TaggedMessage)) (dsoup (getStatelet s1 l)) (@um_pts nat_ordType (msg TaggedMessage) (@fresh (msg TaggedMessage) (dsoup (getStatelet s1 l))) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) st) a) this to true)))) s1) l0) *)
(* Goal: Coh w (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) rt this from (tms_cont H1) (getStatelet s1 l) (@coh_s l s1 C) pf) (dstate (getStatelet s1 l))) (consume_msg (dsoup (getStatelet s1 l)) i)) s1) *)
  + move=>z; rewrite domU/= !inE V.
    by case b:  (z == l)=>//; move/eqP: b=>?; subst; rewrite E D.
(* Goal: forall (_ : is_true (@in_mem (Equality.sort (Ordered.eqType Label)) l (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : network_step s1 s2), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  move=>k; case b: (k == l); rewrite /gets findU b/=; last by apply: H.
(* Goal: @Coherence.sort (Protocols.nodes (getProtocol w k)) (coh (getProtocol w k)) match (if @PCM.valid (@union_map_classPCM Label dstatelet (union_mapUMC Label dstatelet)) s1 then @Some dstatelet (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) rt this from (tms_cont H1) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end G1 pf) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) (consume_msg (dsoup match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) i)) else @None dstatelet) with | Some d => d | None => empty_dstatelet end *)
  rewrite V/=; move/eqP: b=>Z; subst k=>/=.
(* Goal: @Coherence.sort (Protocols.nodes (getProtocol w l)) (coh (getProtocol w l)) (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) rt this from (tms_cont H1) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end G1 pf) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) (consume_msg (dsoup match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) i)) *)
  case: st a S Ph Spf => /= t_snd ssafe G1 G2 sstep Y G3 a S Ph Spf.
(* Goal: @Coherence.sort (Protocols.nodes (getProtocol w l)) (coh (getProtocol w l)) (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) rt this from (tms_cont H1) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end G1 pf) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) (consume_msg (dsoup match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) i)) *)
  have X: exists b pf, sstep this to (gets s1 l) a pf = Some b by exists loc', S.
(* Goal: @Coherence.sort (Protocols.nodes (getProtocol w l)) (coh (getProtocol w l)) (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) (@PCM.join (union_mapPCM mid (msg TaggedMessage)) (dsoup match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) (@um_pts nat_ordType (msg TaggedMessage) (@fresh (msg TaggedMessage) (dsoup match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) (@Msg TaggedMessage (TMsg t_snd a) this to true)))) *)
(* Goal: Coh w (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) rt this from (tms_cont H1) (getStatelet s1 l) (@coh_s l s1 C) pf) (dstate (getStatelet s1 l))) (consume_msg (dsoup (getStatelet s1 l)) i)) s1) *)
  move/Y: X=>X; move: (G1 _ _ _ _ X) (G2 _ _ _ _ X)=>{G1 G2}G1 G2; apply: G3. 
(* Goal: @eq (option Heap.heap) (@Some Heap.heap loc') (sstep this to match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end a X) *)
(* Goal: Coh w (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) rt this from (tms_cont H1) (getStatelet s1 l) (@coh_s l s1 C) pf) (dstate (getStatelet s1 l))) (consume_msg (dsoup (getStatelet s1 l)) i)) s1) *)
  rewrite /gets in Spf; rewrite Spf; move: (coh_s l C)=>G1'.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  by rewrite -(pf_irr X S).
(* Goal: forall (_ : is_true (@in_mem (Equality.sort (Ordered.eqType Label)) l (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : network_step s1 s2), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
case: (C)=>W V K E H; split=>//; first by rewrite validU/= V.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
- move=>z; rewrite domU/= !inE V.
  by case b:  (z == l)=>//; move/eqP: b=>?; subst; rewrite E D.
(* Goal: forall (_ : is_true (@in_mem (Equality.sort (Ordered.eqType Label)) l (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : network_step s1 s2), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
move=>k; case b: (k == l); rewrite /gets findU b/=; last by apply: H.    
(* Goal: @Coherence.sort (Protocols.nodes (getProtocol w k)) (coh (getProtocol w k)) match (if @PCM.valid (@union_map_classPCM Label dstatelet (union_mapUMC Label dstatelet)) s1 then @Some dstatelet (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) rt this from (tms_cont H1) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end (@coh_s l s1 (@And5 (is_true (@PCM.valid (prodPCM (union_mapPCM Label protocol) (union_mapPCM hook_domain hook_type)) w)) (is_true (@PCM.valid (union_mapPCM Label dstatelet) s1)) (hook_complete w) (@eq_mem nat (@mem nat (seq_predType (Ordered.eqType Label)) (@UMC.dom Label protocol (union_mapUMC Label protocol) (@fst context hooks w))) (@mem nat (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1))) (forall l : nat, @Coherence.sort (Protocols.nodes (getProtocol w l)) (coh (getProtocol w l)) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) W V K E H)) pf) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) (consume_msg (dsoup match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) i)) else @None dstatelet) with | Some d => d | None => empty_dstatelet end *)
move: (coh_s l (And5 W V K E H))=>G1.
(* Goal: @Coherence.sort (Protocols.nodes (getProtocol w k)) (coh (getProtocol w k)) match (if @PCM.valid (@union_map_classPCM Label dstatelet (union_mapUMC Label dstatelet)) s1 then @Some dstatelet (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) rt this from (tms_cont H1) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end G1 pf) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) (consume_msg (dsoup match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) i)) else @None dstatelet) with | Some d => d | None => empty_dstatelet end *)
rewrite V; move/eqP: b=>Z; subst k=>/=.
have pf' : this \in dom (dstate (gets s1 l))
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  by move: (pf); rewrite -(Coh_dom D C).
(* Goal: @Coherence.sort (Protocols.nodes (getProtocol w l)) (coh (getProtocol w l)) (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l)) (Protocols.coh (getProtocol w l)) rt this from (tms_cont H1) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end G1 pf) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) (consume_msg (dsoup match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) i)) *)
case: rt H1 H3 msg H4=>/= r_rcvwf mwf rstep G msg T F M.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
rewrite -(pf_irr (H l) (coh_s l C)) in M.
(* Goal: @Coherence.sort (Protocols.nodes (getProtocol w l)) (coh (getProtocol w l)) (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (rstep this from (tms_cont msg) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end G1 pf) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)) (consume_msg (dsoup match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end) i)) *)
move: (G (gets s1 l) from this i (H l) pf msg pf' T M F); rewrite /gets.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
by move: (H l)=>G1'; rewrite -(pf_irr G1 G1'). 
Qed.

(* Stepping preserves the protocol structure *)
Lemma step_preserves_labels s1 s2 :
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  network_step s1 s2 -> dom s1 =i dom s2.
Proof.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
by move/step_coh=>[[_ _ _ E1 _][_ _ _ E2 _]]z; rewrite -E1 -E2.
Qed.

(* Stepping only changes the local state of "this" node, 
   in any of the protocols. *)

(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
Lemma step_is_local s1 s2 l: network_step s1 s2 ->
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  forall z, z != this ->
  find z (dstate (gets s1 l)) = find z (dstate (gets s2 l)).
Proof.
(* Goal: forall (_ : is_true (@in_mem (Equality.sort (Ordered.eqType Label)) l (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : network_step s1 s2), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
move=>S z N; case: S; first by case=>_ Z; subst s2.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
- move=>k st ? to a b pf D C S Ph Spf Z; subst s2; case B: (l == k); 
          rewrite /gets findU B //= (cohS C)/=.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  by move/negbTE: N; rewrite findU=>->/=; move/eqP: B=>->. 
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
move=>k rt ? i from H1 H2 C msg T/= [H3 H4]Z; subst s2.
(* Goal: @eq (option Heap.heap) (@UMC.find nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) z (dstate (getStatelet s1 l))) (@UMC.find nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) z (dstate (getStatelet (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) k (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w k)) (Protocols.coh (getProtocol w k)) rt this from (tms_cont msg) (getStatelet s1 k) (@coh_s k s1 C) H1) (dstate (getStatelet s1 k))) (consume_msg (dsoup (getStatelet s1 k)) i)) s1) l))) *)
case B: (l == k); rewrite /gets findU B //= (cohS C)/=.  
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
by move/negbTE: N; rewrite findU=>->/=; move/eqP: B=>->.
Qed.

(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Lemma step_other_label s1 s2 l: network_step s1 s2 -> *)
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(*   forall z l', l' != l -> *)
(*   find z (dstate (gets s1 l')) = find z (dstate (gets s2 l')). *)
(* Proof. *)
(* move=>S z l' N; case: S; first by case=>_ Z; subst s2. *)
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* (* Send-transition *) *)
(* move=>k st ? to a b pf D C S Ph Spf Z; subst s2. *)
(* case B: (l' == k); rewrite /gets !findU B ?(cohS C)//=. *)
(* move/eqP: B=>B; subst l'. *)
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* case: dom_find D=>//d -> E _. rewrite findU. *)
(* Search _ (dom_find_spec). *)
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* (* Receive-transition *) *)
(* Qed. *)

(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
Lemma stepV1 s1 s2: network_step s1 s2 -> valid s1.
Proof. by case/step_coh=>/cohS. Qed.

(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
Lemma stepV2 s1 s2: network_step s1 s2 -> valid s2.
Proof. by case/step_coh=>_ /cohS. Qed.

(* 
   Network steps do not allocate/deallocate nodes 
   (although this might change soon)
 *)
Lemma step_preserves_node_ids s1 s2 l:
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  l \in dom s1 -> network_step s1 s2 ->
  dom (dstate (gets s1 l)) =i dom (dstate (gets s2 l)).
Proof.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
move=>D S; case: (S); first by case=>C<-.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
- move=> l' st H to msg b H1 H2 C _ _ _ Z; subst s2.
(* Goal: @eq_mem nid (@mem nid (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem nid (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap) (dstate (getStatelet (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l' (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l')) (Protocols.coh (getProtocol w l')) rt this from (tms_cont msg) (getStatelet s1 l') (@coh_s l' s1 C) H1) (dstate (getStatelet s1 l'))) (consume_msg (dsoup (getStatelet s1 l')) m)) s1) l)))) *)
  rewrite /gets findU; case B: (l == l')=>//=; rewrite (stepV1 S)/==>n.
(* Goal: @eq bool (@in_mem nid n (@mem nid (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)))) (@in_mem nid n (@mem nid (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap) (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l')) (Protocols.coh (getProtocol w l')) rt this from (tms_cont msg) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l' s1 with | Some d => d | None => empty_dstatelet end (@coh_s l' s1 C) H1) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l' s1 with | Some d => d | None => empty_dstatelet end))))) *)
  move/eqP: B=>B; subst l'; rewrite domU/= !inE; case B: (n == this)=>//.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  move/eqP:B=>B; subst n; rewrite -(Coh_dom D C) in H1; rewrite H1.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
  by case: C=>_ _ _ _/(_ l)/cohVl->. 
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
move=>l' rt _ m from H1 D' C msg E[F]W/=Z; subst s2.  
(* Goal: @eq_mem nid (@mem nid (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem nid (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap) (dstate (getStatelet (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l' (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l')) (Protocols.coh (getProtocol w l')) rt this from (tms_cont msg) (getStatelet s1 l') (@coh_s l' s1 C) H1) (dstate (getStatelet s1 l'))) (consume_msg (dsoup (getStatelet s1 l')) m)) s1) l)))) *)
rewrite /gets findU; case B: (l == l')=>//=; rewrite (stepV1 S)/==>n.
(* Goal: @eq bool (@in_mem nid n (@mem nid (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l s1 with | Some d => d | None => empty_dstatelet end)))) (@in_mem nid n (@mem nid (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (@Ordered.Class nat nat_eqMixin nat_ordMixin) (fun x : phantom (Ordered.class_of nat) (@Ordered.Class nat nat_eqMixin nat_ordMixin) => x)) Heap.heap) (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this (@receive_step (Protocols.nodes (getProtocol w l')) (Protocols.coh (getProtocol w l')) rt this from (tms_cont msg) match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l' s1 with | Some d => d | None => empty_dstatelet end (@coh_s l' s1 C) H1) (dstate match @UMC.find Label dstatelet (union_mapUMC Label dstatelet) l' s1 with | Some d => d | None => empty_dstatelet end))))) *)
move/eqP: B=>B; subst l'; rewrite domU/= !inE; case B: (n == this)=>//.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
move/eqP:B=>B; subst n; clear S; rewrite -(Coh_dom D C) in H1; rewrite H1.
(* Goal: forall (l0 : Ordered.sort Label) (st : @send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) st (@Mem (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@send_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_st l0))) (to : nid) (msg : list nat) (b : Heap.heap) (_ : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (_ : Coh w s1) (S : @send_safe (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg) (_ : all_hooks_fire (geth w) l0 (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) s1 this msg to) (_ : @eq (option Heap.heap) (@Some Heap.heap b) (@send_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st this to (getStatelet s1 l0) msg S)) (_ : @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this b (dstate (getStatelet s1 l0))) (@fst soup (Ordered.sort mid) (post_msg (dsoup (getStatelet s1 l0)) (@Msg TaggedMessage (TMsg (@t_snd (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) st) msg) this to true)))) s1)), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
(* Goal: forall (l0 : Ordered.sort Label) (rt : @receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (_ : @InMem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) rt (@Mem (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0))) (seq_PredType (@receive_trans (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)))) (get_rt l0))) (i0 : Ordered.sort mid) (from : nat) (pf : is_true (@in_mem nid this (@mem nid (ssrbool.predPredType nid) (nodes (getProtocol w l0) (getStatelet s1 l0))))) (_ : is_true (@in_mem (Ordered.sort Label) l0 (@mem (Equality.sort (Ordered.eqType Label)) (seq_predType (Ordered.eqType Label)) (@UMC.dom Label dstatelet (union_mapUMC Label dstatelet) s1)))) (C : Coh w s1) (msg0 : TaggedMessage) (_ : @eq nat (tag msg0) (@t_rcv (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt)) (_ : and3 (@eq (option (msg TaggedMessage)) (@UMC.find mid (msg TaggedMessage) (union_mapUMC mid (msg TaggedMessage)) i0 (dsoup (getStatelet s1 l0))) (@Some (msg TaggedMessage) (@Msg TaggedMessage msg0 from this true))) (is_true (@msg_wf (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt (getStatelet s1 l0) (@coh_s l0 s1 C) this from msg0)) (let loc' := @receive_step (Protocols.nodes (getProtocol w l0)) (Protocols.coh (getProtocol w l0)) rt this from (tms_cont msg0) (getStatelet s1 l0) (@coh_s l0 s1 C) pf in @eq state s2 (@UMC.upd Label dstatelet (union_mapUMC Label dstatelet) l0 (DStatelet (@UMC.upd nat_ordType Heap.heap (union_mapUMC nat_ordType Heap.heap) this loc' (dstate (getStatelet s1 l0))) (consume_msg (dsoup (getStatelet s1 l0)) i0)) s1))), @eq_mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s1 l)))) (@mem (Equality.sort (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (seq_predType (Ordered.eqType (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)))) (@UMC.dom (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap (union_mapUMC (@Ordered.clone nid nat_ordType (Ordered.class nat_ordType) (fun x : phantom (Ordered.class_of (Ordered.sort nat_ordType)) (Ordered.class nat_ordType) => x)) Heap.heap) (dstate (getStatelet s2 l)))) *)
by case: (C)=>_ _ _ _/(_ l)/cohVl->. 
Qed.

End NetworkSemantics.



