(* Representing q as a unary postcondition, including the precondition *)
Definition binarify {A} (p : pre) (q : cont A) : spec A := 
  (p, fun i y m => p i -> q y m).Notation "'DHT' [ this , W ] ( p , q ) " := 
  (DTbin this W (binarify p q)) (at level 0, 
   format "'[hv ' DHT  [ this , W ]  ( '[' p , '/' q ']' ) ']'").(* A unary Hoare-style specification  *)
Notation "{ x .. y }, 'DHT' [ this , W ] ( p , q )" :=
  (DTbin this W (logvar (fun x => .. (logvar (fun y => binarify p q)) .. )))
   (at level 0, x binder, y binder, right associativity,
    format "'[hv ' { x .. y }, '/ ' DHT  [ this , W ]  ( '[' p , '/' q ']' ) ']'").

(* Specifications: *)
Lemma vrf_pre W A (e : DT this W A) i i' (k : cont A) : verify i e k -> network_rely W this i i' -> verify i' e k.
Lemma vrf_post W A (e : DT this W A) i (k : cont A) : verify i e k -> verify i e (fun x m => forall m', network_rely W this m m' -> k x m').
Lemma step W A B (e1 : DT this W A) (e2 : A -> DT this W B) i (r : cont B) : verify i e1 (fun y m => verify m (e2 y) r) -> verify i (bind e1 e2) r.
Lemma gh_conseq t : conseq f (s t).
Lemma gh_ex g i (k : cont A) : verify i (do' (@gh_conseq g)) k -> verify i (@with_spec this W A (logvar s) f) k.
Lemma act_rule W A (a: action W A this) i (r : cont A) : (forall j, network_rely W this i j -> a_safe a j /\ forall y k m, (exists pf : a_safe a j, a_step pf k y) -> network_rely W this k m -> r y m) -> verify i (act a) r.
Lemma ret_rule W A i (v : A) (r : cont A) : (forall m, network_rely W this i m -> r v m) -> verify i (ret this W v) r.