Section CoordinatorGenericSendTransitions.
Notation coh := TPCCoh.
Definition HCn this to := (this == cn /\ to \in pts).
Definition mkLocal {T} (sl : T * Log) := st :-> sl.1 \+ log :-> sl.2.
Variable stag : ttag.
(* Precondition -- this is the way one can define multiple send-transitions *)
Variable prec : CStateT -> nid -> payload -> Prop.
(* Making sure that the precondition is legit *)
Hypothesis cn_prec_safe :
forall this to s m,
HCn this to -> prec s to m -> cohMsg (Msg (TMsg stag m) this to true) s.1.
Definition cn_safe (this n : nid)
(d : dstatelet) (msg : data) :=
HCn this n /\
exists (C : coh d), prec (getStC C) n msg.
Definition cn_step (this to : nid) (d : dstatelet)
(msg : seq nat)
(pf : cn_safe this to d msg) :=
let C := cn_safe_coh pf in
let s := getStC C in
let l := getStL C (cn_this_in (proj1 pf)) in
Some (mkLocal (cstep_send s to (behead msg) l)).

Lemma cn_safe_def this to d msg :
cn_safe this to d msg <->
exists b pf, @cn_step this to d msg pf = Some b.