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.
(********************************************************************)
(*                      Framing result                              *)
(********************************************************************)

Lemma inject_frame U W K this s1 s2 s:
s1 \+ s \In Coh (U \+ W \+ (Unit, K)) ->
network_step U this s1 s2 ->
hook_complete U -> hook_complete W ->
hooks_consistent (U \+ W).1 K ->
world_not_hooked U K ->
network_step (U \+ W \+ (Unit, K)) this (s1 \+ s) (s2 \+ s).