Definition tryrecv_action_wrapper :=
Action tryrecv_act_safe_coh tryrecv_act_step_total tryrecv_act_step_sem.
End TryReceiveActionWrapper.
(* A wrapper for the send-action *)
Section SendActionWrapper.
Variable W : world.
Variable p : protocol.
Notation getP l := (getProtocol W l).
Notation getS s l := (getStatelet s l).
Variable this : nid.
Variable l : Label.
Variable pf : (getProtocol W l) = p.
(* A dedicated send-transition *)
Variable st: send_trans (coh p).
(* The transition is present *)
Variable pf' : st \In (snd_trans p).
(* The message and the recipient *)
Variable msg : seq nat.
Variable to  : nid.
(* This check is implicit in the action semantics *)
Definition can_send (s : state) := (l \in dom s) && (this \in nodes p (getS s l)).
(* Take only the hooks that affect the transition with a tag st of *)
(* protocol l *)
Definition filter_hooks (h : hooks) :=
um_filter (fun e => e.2 == (l, t_snd st)) h.
Definition send_act_safe s :=
[/\ Coh W s, send_safe st this to (getS s l) msg, can_send s &
(* All hooks from a "reduced footprint" are applicable *)
all_hooks_fire (filter_hooks (geth W)) l (t_snd st) s this msg to].

Lemma send_act_safe_coh s : send_act_safe s -> Coh W s.