Definition resource_decay (nextb: block) (phi1 phi2: rmap) :=
(level phi1 >= level phi2)%nat /\
forall l: address,
((fst l >= nextb)%positive -> phi1 @ l = NO Share.bot bot_unreadable) /\
(resource_fmap (approx (level phi2)) (approx (level phi2)) (phi1 @ l) = (phi2 @ l) \/
(exists sh, exists (wsh: writable0_share sh), exists v, exists v',
resource_fmap (approx (level phi2)) (approx (level phi2)) (phi1 @ l) =
YES sh (writable0_readable wsh) (VAL v) NoneP /\
phi2 @ l = YES sh (writable0_readable wsh) (VAL v') NoneP)
\/ ((fst l >= nextb)%positive /\ exists v, phi2 @ l = YES Share.top readable_share_top (VAL v) NoneP)
\/ (exists v, exists pp, phi1 @ l = YES Share.top readable_share_top (VAL v) pp
/\ phi2 @ l = NO Share.bot bot_unreadable)).
Definition resource_nodecay (nextb: block) (phi1 phi2: rmap) :=
(level phi1 >= level phi2)%nat /\
forall l: address,
((fst l >= nextb)%positive -> phi1 @ l = NO Share.bot bot_unreadable) /\
(resource_fmap (approx (level phi2)) (approx (level phi2)) (phi1 @ l) = (phi2 @ l) \/
(exists sh, exists (wsh: writable0_share sh), exists v, exists v',
resource_fmap (approx (level phi2)) (approx (level phi2)) (phi1 @ l) = YES sh (writable0_readable wsh) (VAL v) NoneP
/\ phi2 @ l = YES sh (writable0_readable wsh) (VAL v') NoneP)).

Lemma inflate_free_resource_decay:
forall (jm :juicy_mem) (m': mem)
(b: block) (lo hi: Z)
(FREE: free (m_dry jm) b lo hi = Some m')
(PERM: forall ofs : Z,
lo <= ofs < hi -> perm_of_res (m_phi jm @ (b, ofs)) = Some Freeable),
resource_decay (nextblock (m_dry jm)) (m_phi jm) (inflate_free jm b lo hi).