Section GenericQuerySendTransitions.
Definition Hn this to := this \in nodes /\ to \in nodes.
Definition mkLocal (q : qstate) := st :-> q.
(* Send tag *)
Variable stag : nat.
(* Generic precondition *)
Variable prec : qstate -> nid -> seq nat -> Prop.
(* Making sure that the precondition is legit *)
Definition prec_safe :=
forall this to q m, Hn this to -> prec q to m ->
cohMsg (Msg (TMsg stag m) this to true).
Hypothesis psafe : prec_safe.
(* Generic send-safety *)
Definition send_safe (this n : nid)
(d : dstatelet) (msg : seq nat) :=
Hn this n /\ exists (C : coh d), prec (getSt this C) n msg.
Definition qsend_trans :=
SendTrans send_safe_coh send_safe_in send_safe_def send_step_coh.
End GenericQuerySendTransitions.
Definition send_req_prec (q : qstate) (to : nid) (payload : seq nat) :=
payload = [::(fresh_id q.1)].
Definition send_resp_prec (q : qstate) (to : nid) (payload : seq nat) :=
exists rid d, payload = rid :: (serialize d) /\
(to, rid) \in q.2.

Lemma send_resp_prec_safe : prec_safe tresp send_resp_prec.