Module RML := Rmaps_Lemmas R.
Export RML. Export R.
Instance Cross_rmap : Cross_alg rmap := Cross_rmap_simple (fun _ => I).
Obligation Tactic := idtac.
(******  MAPSTO AND RELATED OPERATORS *****)
Program Definition mapsto (v1 v2: adr) : pred rmap :=
fun w => forall i,
if eq_dec i v1 then w @ i = YES pfullshare (VAL v2) NoneP else identity (w @ i).
Next Obligation.
intros. intros ? ? ? ?.
intro i; specialize (H0 i).
destruct (eq_dec i v1).
apply (age1_YES _ _ _ _ _ H); auto.
destruct (identity_resource (a @ i)) as [? _]. specialize (H1 H0).
apply identity_resource.
generalize (age1_resource_at _ _ H i (a @ i)); intro.
generalize (resource_at_approx a i); intro.
destruct (a @ i); try contradiction.
rewrite H2; simpl in *; auto.
rewrite H2; simpl in *; auto.
Qed.
Definition singleton_rmap  (v v': adr) (m: rmap) : rmap :=
proj1_sig
(make_rmap (fun i => if eq_dec i v then YES pfullshare (VAL v') NoneP  else core m @ i )
I (level m) (singleton_rmap_OK _ _ m)).
Local Open Scope pred.

Lemma mapsto_e1: forall v1 v2 w,
app_pred (mapsto v1 v2 * TT) w ->
w @ v1 = YES pfullshare (VAL v2) NoneP.