Section inflate.
Variables (m: mem) (phi: rmap).
Definition inflate_initial_mem' (w: rmap) (loc: address) :=
match access_at m loc Cur with
| Some Freeable => YES Share.top readable_share_top (VAL (contents_at m loc)) NoneP
| Some Writable => YES Ews (writable_readable writable_Ews) (VAL (contents_at m loc)) NoneP
| Some Readable => YES Ers readable_Ers (VAL (contents_at m loc)) NoneP
| Some Nonempty =>
match w @ loc with PURE _ _ => w @ loc | _ => NO _ nonreadable_extern_retainer end
| None =>  NO Share.bot bot_unreadable
end.
Definition inflate_initial_mem (w: rmap): rmap :=
proj1_sig (make_rmap (inflate_initial_mem' w) (ghost_of w) _
(inflate_initial_mem'_fmap w) (ghost_of_approx w)).

Lemma inflate_initial_mem_level: forall w, level (inflate_initial_mem w) = level w.