(*CompCert imports*)
(* A minimal preservation property we sometimes require.*)
Definition mem_forward (m1 m2:mem) :=
(forall b, Mem.valid_block m1 b ->
Mem.valid_block m2 b /\
forall ofs p, Mem.perm m2 b ofs Max p -> Mem.perm m1 b ofs Max p).
Definition val_inject_opt (j: meminj) (v1 v2: option val) :=
match v1, v2 with Some v1', Some v2' => val_inject j v1' v2'
| None, None => True
| _, _ => False
end.

Lemma loadbytes_D: forall m b ofs n bytes
(LD: Mem.loadbytes m b ofs n = Some bytes),
Mem.range_perm m b ofs (ofs + n) Cur Readable /\
bytes = Mem.getN (nat_of_Z n) ofs (PMap.get b (Mem.mem_contents m)).