(* Blocks that are not mapped by f are set to empty permission. This makes the invariant preservation easier. *)
Definition projectMap (f : memren) (pmap : access_map) : access_map :=
(pmap#1, Maps.PTree.fold (fun acc b bperm =>
match f b with
| Some b' =>
Maps.PTree.set b' bperm acc
| None =>
acc end)
pmap.2 (Maps.PTree.empty _)).

Lemma delta_content_inj_correct:
forall f pmapc pmapf dmap mc mf
(Hf_injective: forall b1 b1' b2,
f b1 = Some b2 ->
f b1' = Some b2 ->
b1 = b1')
(Hdelta_inj: delta_inj f dmap (projectAngel f dmap))
(Hltc: permMapLt (computeMap pmapc dmap) (getMaxPerm mc))
(Hltf: permMapLt (computeMap pmapf (projectAngel f dmap)) (getMaxPerm mf))
(Hobs_eq: mem_obs_eq f (restrPermMap Hltc) (restrPermMap Hltf)),
delta_content_inj f (build_delta_content dmap mc)
(build_delta_content (projectAngel f dmap) mf).