Notation init_hist := (Some (Tsh, [] : hist), Some ([] : hist)).

(* Specifications: *)
Lemma andp_valid_pointer : forall P Q v, P * (Q && valid_pointer v) |-- P * Q && valid_pointer v.
Lemma sepcon_later_valid_pointer2 : forall P Q p, P |-- |>valid_pointer p -> Q * P |-- |>valid_pointer p.
Lemma hist_R_valid : forall g R v, valid (hist_R g R) v = hist_R g R v.
Notation MA_witness g v R :=
(v, ghost init_hist g * R%function [] v, hist_R g R, ghost_hist Tsh ([] : hist) g).
(* The user must make the init_hist before calling make_atomic, so that the ghost location is known. *)
Lemma MA_hist_spec : forall g v R, precise (EX h : _, R h v) ->
MA_spec v (ghost init_hist g * valid (R [Store v]) v) (hist_R g R) (ghost_hist Tsh ([(O, Store v)]) g).