End Read.
Section Write.
Variable (A : Type) (x : ptr) (v : A).
Definition write_s : spec unit :=
(fun i => x \in dom i : Prop,
fun y i m => y = Val tt /\ upd i x (dyn v) = m).
Definition write_sp (p : ideald write_s.1) (y : ans unit) m :=
exists i, i \In id_val p /\ x \in dom i /\
y = Val tt /\ m = upd i x (dyn v).

(* Specifications: *)
Lemma write_coherent : coherent write_sp.
Lemma write_dstrict : def_strict write_sp.
Lemma write_has_spec : write_sp \In has_spec write_s.
Lemma alloc_dstrict : def_strict alloc_sp.
Lemma alloc_has_spec : alloc_sp \In has_spec alloc_s.
Definition alloc := STprog alloc_coherent alloc_dstrict alloc_has_spec.