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_store_resource_nodecay:
forall (jm: juicy_mem) (m': mem)
(ch: memory_chunk) (b: block) (ofs: Z) (v: val)
(STORE: store ch (m_dry jm) b ofs v = Some m')
(PERM: forall z, ofs <= z < ofs + size_chunk ch ->
perm_order'' (perm_of_res (m_phi jm @ (b,z))) (Some Writable))
phi',
inflate_store m' (m_phi jm) = phi' -> resource_nodecay (nextblock (m_dry jm)) (m_phi jm) phi'.