Module MemoryWD.
(** Valid memories are the ones that do not contain any dangling pointers*)
Definition valid_mem m :=
forall b,
Mem.valid_block m b ->
forall ofs mv,
Maps.ZMap.get ofs (Mem.mem_contents m) # b = mv ->
match mv with
| Fragment v q n =>
mem_wd.val_valid v m
| _ => True
end.
Transparent  Mem.storebytes.

Lemma storebytes_wd_domain:
forall (m m' : mem) mv b ofs f
(Hdomain: domain_memren f m)
(Hmval_wd: valid_memval_list f mv)
(Hstore: Mem.storebytes m b ofs mv = Some m')
(Hmem_wd: valid_mem m),
valid_mem m' /\ domain_memren f m'.