Definition no_preds (r: resource) :=
match r with NO => True | YES _ _ pp => pp=NoneP | PURE _ pp => pp=NoneP end.

(* Specifications: *)
Lemma remake_rmap:
forall (f: AV.address -> resource),
AV.valid (res_option oo f) ->
forall n,
(forall l, (exists m, level m = n /\ f l = m @ l) \/ no_preds (f l)) ->
{phi: rmap | level phi = n /\ resource_at phi = f}.
Lemma rmap_unage_age:
forall r, age (rmap_unage r) r.
Lemma ageN_resource_at_eq:
forall phi1 phi2 loc n phi1' phi2',
level phi1 = level phi2 ->
phi1 @ loc = phi2 @ loc ->
ageN n phi1 = Some phi1' ->
ageN n phi2 = Some phi2' ->
phi1' @ loc = phi2' @ loc.
Lemma join_YES_pfullshare1:
forall pp k p x y, join (YES (mk_lifted Share.top pp) k p) x y -> (NO, YES pfullshare k p) = (x,y).
Lemma join_YES_pfullshare2:
forall pp k p x y, join x (YES  (mk_lifted Share.top pp) k p) y -> (NO, YES pfullshare k p) = (x,y).