Section Exports.
Definition inj_ext := E.
Definition injects := injects.
Definition Inject := Inject.
(* The following two definitions are central for framing with respect to the hooks. In essence. we can add more hooks via the frame rule, if none of the protocols in the "core" world (i.e., the world, to which we attach the frame with more hooks) are going to become constrained by the newly added hooks.  In other words, the new hooks only constrain the world "to be attached" but not our "core" world. *)
Definition not_hooked_by (K : hooks) l :=
forall z lc l' st, (z, lc, (l', st)) \in dom K -> l != l'.
Definition world_not_hooked (W: world) K :=
forall l, l \in dom W.1 -> not_hooked_by K l.

Lemma hooks_frame (U W : world) (K : hooks) l st s s' n msg to :
hook_complete U -> hook_complete W ->
hooks_consistent (U \+ W).1 K ->
l \in dom s -> s \In Coh U -> s \+ s' \In Coh (U \+ W \+ (Unit, K)) ->
not_hooked_by K l ->
all_hooks_fire (geth U) l st s n msg to ->
all_hooks_fire (geth (U \+ W \+ (Unit, K))) l st (s \+ s') n msg to.