Definition AccessMap_EE_Property  (m1 m1' m2:Mem.mem)
(AM:ZMap.t (Z -> perm_kind -> option permission)):Prop :=
forall b,
(Mem.valid_block m2 b -> forall k ofs,
(Mem.perm m1 b ofs Max Nonempty ->
PMap.get b AM ofs k = PMap.get b m1'.(Mem.mem_access) ofs k) /\
(~Mem.perm m1 b ofs Max Nonempty ->
PMap.get b AM ofs k = PMap.get b m2.(Mem.mem_access) ofs k))
/\ (~ Mem.valid_block m2 b -> forall k ofs,
PMap.get b AM ofs k = PMap.get b m1'.(Mem.mem_access) ofs k).
Definition Content_EE_Property
(m1 m1' m2:Mem.mem) (CM:ZMap.t (ZMap.t memval)):=
forall b,
(Mem.valid_block m2 b -> forall ofs,
(Mem.perm m1 b ofs Max Nonempty ->
ZMap.get ofs (PMap.get b CM) =
ZMap.get ofs (PMap.get b m1'.(Mem.mem_contents))) /\
(~Mem.perm m1 b ofs Max Nonempty ->
ZMap.get ofs (PMap.get b CM) =
ZMap.get ofs (PMap.get b m2.(Mem.mem_contents))))
/\ (~ Mem.valid_block m2 b -> forall (HM1': Mem.valid_block m1' b) ofs,
ZMap.get ofs (PMap.get b CM) =
ZMap.get ofs (PMap.get b m1'.(Mem.mem_contents)))
/\ fst CM !! b = Undef.
Definition AccessMap_EE_FUN'  (m1 m1' m2:Mem.mem) (b:block):
Z -> perm_kind -> option permission :=
if plt b (Mem.nextblock m1')
then
if plt b (Mem.nextblock m2)
then (fun ofs k =>
if Mem.perm_dec m1 b ofs Max Nonempty
then PMap.get b m1'.(Mem.mem_access) ofs k
else PMap.get b m2.(Mem.mem_access) ofs k)
else PMap.get b m1'.(Mem.mem_access)
else (fun ofs k => None).
Definition AccessMap_EE_FUN  (m1 m1' m2:Mem.mem) (b:block):
Z -> perm_kind -> option permission :=
if plt b (Mem.nextblock m2)
then (fun ofs k =>
if Mem.perm_dec m1 b ofs Max Nonempty
then PMap.get b m1'.(Mem.mem_access) ofs k
else PMap.get b m2.(Mem.mem_access) ofs k)
else PMap.get b m1'.(Mem.mem_access).

Lemma mkAccessMap_EE_exists: forall (m1 m1' m2:Mem.mem),
exists M : PMap.t (Z -> perm_kind -> option permission),
fst M = (fun k ofs => None) /\
forall b, PMap.get b M = AccessMap_EE_FUN' m1 m1' m2 b.