Definition AccessMap_IE_Property  j12 j12' m1 m1' m2 m3'
(AM:ZMap.t (Z -> perm_kind -> option permission)):Prop :=
forall b2,
(Mem.valid_block m2 b2 -> forall k ofs2,
match source j12 m1 b2 ofs2 with
Some(b1,ofs1) =>  PMap.get b2 AM ofs2 k =
PMap.get b1 m1'.(Mem.mem_access) ofs1 k
| None => PMap.get b2 AM ofs2 k =
PMap.get b2 m2.(Mem.mem_access) ofs2 k
end)
/\ (~ Mem.valid_block m2 b2 -> forall k ofs2,
match source j12' m1' b2 ofs2 with
Some(b1,ofs1) => PMap.get b2 AM ofs2 k =
PMap.get b1 m1'.(Mem.mem_access) ofs1 k
| None => PMap.get b2 AM ofs2 k =
PMap.get b2 m3'.(Mem.mem_access) ofs2 k
end).
Definition Content_IE_Property j12 (m1 m1' m2 m3':Mem.mem)
(CM:ZMap.t (ZMap.t memval)):=
forall b2,
(Mem.valid_block m2 b2 -> forall ofs2,
match source j12 m1 b2 ofs2 with
Some(b1,ofs1) => ZMap.get ofs2 (PMap.get b2 CM) =
ZMap.get ofs2 (PMap.get b2 m3'.(Mem.mem_contents))
| None => ZMap.get ofs2 (PMap.get b2 CM) =
ZMap.get ofs2 (PMap.get b2 m2.(Mem.mem_contents))
end)
/\ (~ Mem.valid_block m2 b2 -> forall (HM3': Mem.valid_block m3' b2) ofs2,
ZMap.get ofs2 (PMap.get b2 CM) =
ZMap.get ofs2 (PMap.get b2 m3'.(Mem.mem_contents)))
/\ fst CM !! b2 = Undef.
Definition AccessMap_IE_FUN (j12 j12':meminj) (m1 m1' m2 m3':Mem.mem) (b2:block):
Z -> perm_kind -> option permission :=
if plt b2 (Mem.nextblock m2)
then (fun ofs2 k =>
match source j12 m1 b2 ofs2 with
Some(b1,ofs1) => PMap.get b1 m1'.(Mem.mem_access) ofs1 k
| None => PMap.get b2 m2.(Mem.mem_access) ofs2 k
end)
else (fun ofs2 k =>
match source j12' m1' b2 ofs2 with
Some(b1,ofs1) => PMap.get b1 m1'.(Mem.mem_access) ofs1 k
| None => PMap.get b2 m3'.(Mem.mem_access) ofs2 k
end).
Definition ContentMap_IE_ValidBlock_FUN (j12:meminj) m1 m2 m3'
b2 ofs2: memval :=
match source j12 m1 b2 ofs2 with
Some(b1,ofs1) => ZMap.get ofs2 (PMap.get b2 m3'.(Mem.mem_contents))
| None => ZMap.get ofs2 (PMap.get b2 m2.(Mem.mem_contents))
end.
Definition ContentMap_IE_InvalidBlock_FUN m3' b2 ofs2: memval :=
ZMap.get ofs2 (PMap.get b2 m3'.(Mem.mem_contents)).
Definition ContentMap_IE_Block_FUN j12 m1 m2 m3' b ofs : memval:=
if plt b (Mem.nextblock m2)
then ContentMap_IE_ValidBlock_FUN j12 m1 m2 m3' b ofs
else ContentMap_IE_InvalidBlock_FUN m3' b ofs.
Definition ContentsMap_IE_FUN (j12:meminj) (m1 m2 m3':Mem.mem) (b:block):
ZMap.t memval.
destruct (plt b (Mem.nextblock m3')).
apply(CM_block_IE_existsT j12 m1 m2 m3' b).
apply (ZMap.init Undef).
Defined.

Lemma ContentsMap_IE_existsT: forall (j12:meminj) (m1 m2 m3':Mem.mem),
{ M : PMap.t (ZMap.t memval) |
fst M = ZMap.init Undef /\
forall b, PMap.get b M = ContentsMap_IE_FUN j12 m1 m2 m3' b}.