(* It's okay to have duplicating nodes in this list *)

(* World is a dependent partial map of protocols *)

Definition context := union_map Label protocol.(*

A hook is a constraint from the local state wrt. core protocol (1st
heap argument), relating the local state wrt. the client protocol (2ns
heap argument), message to be sent, and the destination node id.

*)
Definition hook_type := heap -> heap -> seq nat -> nid -> Prop.Definition hooks := union_map hook_domain hook_type.Definition world := (context * hooks)%type.Definition getc (w: world) : context := fst w.Definition geth (w: world) : hooks := snd w.(* The function is, in fact, partially defined and returns Empty
   Protocol for a non-present label. *)
Definition getProtocol i : protocol:=
  match find i (getc w) with
  | Some p => p
  | None => EmptyProt i 
  end.Definition hook_complete w := hooks_consistent (getc w) (geth w).

Lemma cohH w s : Coh w s -> hook_complete w.