From mathcomp.ssreflect
From fcsl
From DiSeL
From DiSeL
From DiSeL
Section QueryHooked.
(* Constructing the composite world *)
Variables (lq : Label) (pc : protocol).
Variable Data : Type.
Variable qnodes : seq nat.
Variable serialize : Data -> seq nat.
Variable deserialize : seq nat -> Data.
Hypothesis ds_inverse : left_inverse serialize deserialize.
Definition pq := QueryProtocol qnodes serialize lq.
Variable core_state_to_data : nid -> heap -> Data -> Prop.
Hypothesis core_state_to_data_inj :
forall n h d d', core_state_to_data n h d -> core_state_to_data n h d' -> d = d'.
(* The query hook extracts certain data from the the core protocol *)
(* local state if it's present there. *)
Definition query_hook : hook_type :=
fun hc hq ms to =>
forall n rid d, ms = rid :: serialize d -> core_state_to_data n hc d.
Definition query_hookz := (1, (plab pc), (plab pq, tresp)) \\-> query_hook.
Definition W : world := ((plab pc \\-> pc) \+ (plab pq \\-> pq), query_hookz).
Hypothesis Lab_neq: lq != (plab pc).
(* Hypothesis Nodes_eq: forall d, nodes pc d =i qnodes. *)

(* Specifications: *)
Lemma W_valid : valid W.
Lemma W_complete : hook_complete W.
Lemma W_dom : dom W.1 =i [:: plab pc; lq].
Lemma eqW :
W = (plab pc \\-> pc, Unit) \+ (plab pq \\-> pq, Unit) \+ (Unit, query_hookz).
Lemma labC : plab pc \in dom W.1.
Lemma labQ : lq \in dom W.1.
Lemma injWQ : inj_ext injW = (lq \\-> pq, Unit).
Lemma prEqC : getProtocol W (plab pc) = pc.
rewrite /getProtocol/W/= findUnL; last by case/andP: W_valid.