(****************************************************)
Notation coh := QCoh.
(********************* Takes: - initial state q - a recipient node to - a transition tag tag - a request id to be spent (in the case of response)  Returns - a new local state **********************)
Definition send_step_fun (q : qstate) (to : nid) (tag : nat) (rid: nat) : qstate :=
let: (xs, ys) := q in
if tag == treq then ((to, fresh_id xs) :: xs, ys)
else if (tag == tresp) && ((to, rid) \in ys)
then (xs, seq.rem (to, rid) ys)
else q.

(* Specifications: *)
Lemma send_step_uniq q to tag rid:
uniq q.1 -> uniq q.2 ->
uniq (send_step_fun q to tag rid).1  /\ uniq (send_step_fun q to tag rid).2.