Section free.
Variables (jm :juicy_mem) (m': mem)
(b: block) (lo hi: Z)
(FREE: free (m_dry jm) b lo hi = Some m')
(PERM: forall ofs, lo <= ofs < hi ->
perm_of_res (m_phi jm @ (b,ofs)) = Some Freeable).
Definition inflate_free: rmap. refine (
proj1_sig (make_rmap (fun loc =>
if adr_range_dec (b,lo) (hi-lo) loc then NO Share.bot bot_unreadable else m_phi jm @ loc)
(ghost_of (m_phi jm))
(level (m_phi jm)) _ (ghost_of_approx (m_phi jm)))).
(* The empty juicy memory *)
Definition after_alloc'
(lo hi: Z) (b: block) (phi: rmap)(H: forall ofs, phi @ (b,ofs) = NO Share.bot bot_unreadable)
: address -> resource := fun loc =>
if adr_range_dec (b,lo) (hi-lo) loc
then YES Share.top readable_share_top (VAL Undef) NoneP
else phi @ loc.

Lemma after_alloc'_ok : forall lo hi b phi H,
resource_fmap (approx (level phi)) (approx (level phi)) oo (after_alloc' lo hi b phi H)
= after_alloc' lo hi b phi H.