End MEMORY_CONSTRUCTION_EFF.
Section MINMAX_EFF.
Variable nu12: SM_Injection.
Variable j12' :meminj.
Variable m1' m2: mem.
Definition MINMAX_Offset (b2:block) : option (Z * Z) :=
if plt b2 (Mem.nextblock m2)
then match (zmap_finite_c _ (PMap.get b2 m2.(Mem.mem_contents)))
with (min2, max2) =>
match minmax m1' (as_inj nu12) b2 with
Some(min1, max1) =>
Some(Z.min min1 min2, Z.max max1 max2)
| None => Some(min2,max2)
end
end
else minmax m1' j12' b2.
Hypothesis inc12: inject_incr (as_inj nu12) j12'.
Hypothesis VBj12'_1: forall b1 b2 delta,
j12' b1 = Some (b2, delta) ->
Mem.valid_block m1' b1.
Hypothesis JJ: forall b1 b2 delta,
j12' b1 = Some (b2, delta) ->
Mem.valid_block m2 b2 ->
as_inj nu12 b1 = Some (b2, delta).

Lemma MINMAX: forall b2 ,
match MINMAX_Offset b2 with
Some(mn,mx) =>
(forall ofs, ofs < mn \/ ofs > mx ->
Plt b2 (Mem.nextblock m2) ->
ZMap.get ofs (Mem.mem_contents m2)!!b2 = Undef) /\
forall b1 delta, as_inj nu12 b1 = Some(b2,delta) \/
j12' b1 = Some(b2,delta)->
forall z, z + delta < mn \/ z + delta > mx ->
ZMap.get z (Mem.mem_contents m1')!!b1 = Undef
| None =>
(Plt b2 (Mem.nextblock m2) ->
forall ofs, ZMap.get ofs (Mem.mem_contents m2)!!b2 = Undef)
/\ forall b1 delta,
as_inj nu12 b1 = Some(b2,delta) \/ j12' b1 = Some(b2,delta)->
forall z, ZMap.get z (Mem.mem_contents m1')!!b1 = Undef
end.