Definition AccessMap_EI_FUN (j:meminj) (m1 m1' m2 : mem) (b2:block):
Z -> perm_kind -> option permission :=
if plt b2 (Mem.nextblock m2)
then (fun ofs2 k =>
match j b2 with
None => PMap.get b2 m2.(Mem.mem_access) ofs2 k
| Some (b3,d3) =>
if Mem.perm_dec m1 b2 ofs2 Max Nonempty
then PMap.get b2 m1'.(Mem.mem_access) ofs2 k
else PMap.get b2 m2.(Mem.mem_access) ofs2 k
end)
else (fun ofs2 k =>
if Mem.perm_dec m1' b2 ofs2 Max Nonempty
then PMap.get b2 m1'.(Mem.mem_access) ofs2 k
else None).

Lemma mkAccessMap_EI_existsT: forall j (m1 m1' m2:Mem.mem)
(VB : (Mem.nextblock m2 <= Mem.nextblock m1')%positive),
{ M : PMap.t (Z -> perm_kind -> option permission) |
fst M = (fun k ofs => None) /\
forall b, PMap.get b M = AccessMap_EI_FUN j m1 m1' m2 b}.