Definition juicy_mem_core (j: juicy_mem) : rmap := core (m_phi j).
(*Lemma inflate_initial_mem_empty: forall lev, emp (inflate_initial_mem Mem.empty lev). intro lev. unfold inflate_initial_mem. destruct (make_rmap (inflate_initial_mem' Mem.empty lev) (core (ghost_of lev)) (inflate_initial_mem'_valid Mem.empty lev) (level lev) (inflate_initial_mem'_fmap Mem.empty lev)); simpl. { rewrite core_ghost_of, <- level_core; apply ghost_of_approx. } destruct a. apply resource_at_empty2. intro l; rewrite H0. unfold inflate_initial_mem'. destruct l. unfold access_at; unfold empty at 1. simpl. rewrite PMap.gi. destruct (max_access_at empty (b,z)); try destruct p; try apply NO_identity. Qed. Local Hint Resolve inflate_initial_mem_empty : core.*)
(* fancy initial mem *)
(* TODO: move this somewhere more appropriate *)
Definition no_VALs (phi: rmap) := forall loc,
match phi @ loc with
| YES _ _ (VAL _) _ => False | _ => True
end.
(* coherence lemmas *)

Lemma perm_order'_trans: forall p1 p2 p3,
perm_order' (Some p1) p2 -> perm_order' (Some p2) p3 -> perm_order' (Some p1) p3.