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 juicy_store_nodecay:
forall jm m' ch b ofs v
(H: 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)),
resource_nodecay (nextblock (m_dry jm)) (m_phi jm) (m_phi (store_juicy_mem jm _ _ _ _ _ H)).