(** Preservation of loads. *)

(* Specifications: *)
Lemma getN_inj:
forall f m1 m2 b1 b2 delta,
mem_inj f m1 m2 ->
f b1 = Some(b2, delta) ->
forall n ofs,
range_perm m1 b1 ofs (ofs + Z.of_nat n) Cur Readable ->
list_forall2 (memval_inject f)
(getN n ofs (m1.(mem_contents)#b1))
(getN n (ofs + delta) (m2.(mem_contents)#b2)).
Lemma load_inj:
forall f m1 m2 chunk b1 ofs b2 delta v1,
mem_inj f m1 m2 ->
load chunk m1 b1 ofs = Some v1 ->
f b1 = Some (b2, delta) ->
exists v2, load chunk m2 b2 (ofs + delta) = Some v2 /\ Val.inject f v1 v2.
Lemma loadbytes_inj:
forall f m1 m2 len b1 ofs b2 delta bytes1,
mem_inj f m1 m2 ->
loadbytes m1 b1 ofs len = Some bytes1 ->
f b1 = Some (b2, delta) ->
exists bytes2, loadbytes m2 b2 (ofs + delta) len = Some bytes2
/\ list_forall2 (memval_inject f) bytes1 bytes2.