Module R := R0.
Hint Resolve (@subp_sepcon _ Join_rmap Perm_rmap Sep_rmap): contractive.

Lemma allocate:
forall (phi : rmap) (f : AV.address -> resource) a,
resource_fmap (approx (level phi)) (approx (level phi)) oo f = f ->
(forall l, {r' | join (phi@l) (f l) r'}) ->
ghost_fmap (approx (level phi)) (approx (level phi)) a = a ->
{a' | join (ghost_of phi) a a'} ->
exists phi1 : rmap,
exists phi2 : rmap,
join phi phi1 phi2 /\ resource_at phi1 = f /\ ghost_of phi1 = a.