(********************* Takes: - initial state q - a sender node from - a transition tag tag - a request id to be processed (added or removed)  Returns - a new local state **********************)
Definition receive_step_fun (q : qstate) (from : nid) (tag : nat) (rid : nat) :=
let: (xs, ys) := q in
if (tag == treq) && ((from, rid) \notin ys)
then (xs, (from, rid) :: ys)
else if (tag == tresp) && ((from, rid) \in xs)
then (seq.rem (from, rid) xs, ys)
else q.

(* Specifications: *)
Lemma receive_step_uniq q from tag rid:
uniq q.1 -> uniq q.2 ->
uniq (receive_step_fun q from tag rid).1  /\
uniq (receive_step_fun q from tag rid).2.