Program Definition p2p (p:(pred rmap)) : K.predicate :=
    fun phi_e => p (fst phi_e).Program Definition p2p' (p:K.predicate) : (pred rmap) :=
    fun (v:rmap) => p (v, tt).Definition squash (n_rm:nat * rmap') : rmap :=
    match n_rm with (n,rm) => K.squash (n, fmap p2p (rmap'2pre_rmap rm)) end.Definition unsquash (phi:rmap) : (nat * rmap') :=
    match K.unsquash phi with (n,rm) => (n, pre_rmap2rmap' (fmap p2p' rm)) end.Definition rmap_level (phi:rmap) : nat := fst (unsquash phi).Definition resource_at (phi:rmap) : address -> resource := proj1_sig (snd (unsquash phi)).Infix "@" := resource_at (at level 50, no associativity).

Lemma squash_unsquash : forall phi, squash (unsquash phi) = phi.