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).

Lemma alloc_has_spec : alloc_sp \In has_spec alloc_s.
Definition alloc := STprog alloc_coherent alloc_dstrict alloc_has_spec.