End EvalDo.
Section EvalReturn.
Variables (A B : Type).

(* Specifications: *)
Lemma val_ret v i (r : cont A) :
(def i -> r (Val v) i) -> verify (ret_s v) i r.
Lemma try_ret s1 s2 (v : A) i (r : cont B) :
verify (s1 v) i r -> verify (try_s (ret_s v) s1 s2) i r.
Lemma bnd_ret s (v : A) i (r : cont B) :
verify (s v) i r -> verify (bind_s (ret_s v) s) i r.
Lemma try_read s1 s2 v x i (r : cont B) :
verify (s1 v) (x :-> v :+ i) r ->
verify (try_s (read_s A x) s1 s2) (x :-> v :+ i) r.
Lemma bnd_read s v x i (r : cont B) :
verify (s v) (x :-> v :+ i) r ->
verify (bind_s (read_s A x) s) (x :-> v :+ i) r.
Lemma try_write s1 s2 (v: A) (w : C) x i (r : cont B) :
verify (s1 tt) (x :-> v :+ i) r ->
verify (try_s (write_s x v) s1 s2) (x :-> w :+ i) r.
Lemma bnd_write s (v : A) (w : C) x i (r : cont B) :
verify (s tt) (x :-> v :+ i) r ->
verify (bind_s (write_s x v) s) (x :-> w :+ i) r.
Lemma try_alloc s1 s2 (v : A) i (r : cont B) :
(forall x, verify (s1 x) (x :-> v :+ i) r) ->
verify (try_s (alloc_s v) s1 s2) i r.
Lemma bnd_alloc s (v : A) i (r : cont B) :
(forall x, verify (s x) (x :-> v :+ i) r) ->
verify (bind_s (alloc_s v) s) i r.
Lemma try_allocb s1 s2 (v : A) n i (r : cont B) :
(forall x, verify (s1 x) (updi x (nseq n v) :+ i) r) ->
verify (try_s (allocb_s v n) s1 s2) i r.
Lemma bnd_allocb s (v : A) n i (r : cont B) :
(forall x, verify (s x) (updi x (nseq n v) :+ i) r) ->
verify (bind_s (allocb_s v n) s) i r.
Lemma try_dealloc s1 s2 (v : B) x i (r : cont A) :
verify (s1 tt) i r ->
verify (try_s (dealloc_s x) s1 s2) (x :-> v :+ i) r.
Lemma bnd_dealloc s (v : B) x i (r : cont A) :
verify (s tt) i r ->
verify (bind_s (dealloc_s x) s) (x :-> v :+ i) r.
Lemma try_throw s1 s2 e i (r : cont B) :
verify (s2 e) i r ->
verify (try_s (throw_s A e) s1 s2) i r.
Lemma bnd_throw s e i (r : cont B) :
(def i -> r (Exn e) i) ->
verify (bind_s (throw_s A e) s) i r.