Definition left_inverse {A B : Type} (op: A -> B) (inv : B -> A) :=
  forall x, inv (op x) = x.(* Protocol state *)
Definition st := ptr_nat 1.(* Pending requests (client-side): node, request id *)
(* Pending responses (server-side): node, response id *)
Definition reqs := seq (nid * nat)%type.Definition resp := seq (nid * nat)%type.Definition qstate := (reqs * resp)%type.(* Tags *)
Definition treq : nat := 0.Definition tresp : nat := 1.

(* Specifications: *)
Lemma l1 d: qcoh d -> valid (dstate d).
Lemma l2 d: qcoh d -> valid (dsoup d).
Lemma l3 d: qcoh d -> dom (dstate d) =i nodes.