Hint Resolve valid_val_sub valid_val_subl : wd.
Hint Immediate  valid_val_int valid_val_long valid_val_one valid_val_undef
valid_val_single valid_val_float valid_val_hiword valid_val_loword
valid_val_add valid_val_addl valid_val_offset_ptr
valid_val_mul valid_val_mulhu valid_val_mulhs
valid_val_mull valid_val_mullhu valid_val_mullhs
valid_val_and valid_val_or valid_val_xor
valid_val_andl valid_val_orl valid_val_xorl
valid_intoffloat valid_intofsingle
valid_singleofint valid_floatofint
valid_longoffloat valid_longofsingle
valid_singleoflong valid_floatoflong
valid_val_singleoffloat valid_val_floatofsingle
valid_val_neg valid_val_negl valid_val_longofintu valid_val_longofint valid_val_sign_ext valid_val_zero_ext
valid_val_divu valid_val_modu
valid_val_divs valid_val_mods
valid_val_divlu valid_val_modlu
valid_val_divls valid_val_modls
valid_val_notint valid_val_notl valid_val_vzero
valid_val_shl valid_val_shru valid_val_shr
valid_val_shll valid_val_shrlu valid_val_shrl
valid_val_ror valid_val_rorl valid_val_addf valid_val_mulf
valid_val_subf valid_val_divf
valid_val_addfs valid_val_mulfs
valid_val_subfs valid_val_divfs
valid_val_negf valid_val_absf
valid_val_negfs valid_val_absfs
valid_val_of_optbool valid_val_sub_overflow valid_val_subl_overflow
valid_val_negative valid_val_negativel valid_val_of_bool : wd.
End ValueWD.
(** ** Well-defined Memories*)
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.

Lemma getN_wd :
forall (f : memren) (m : mem) b,
Mem.valid_block m b ->
valid_mem m ->
domain_memren f m ->
forall (n : nat) (ofs : Z),
valid_memval_list f (Mem.getN n ofs (Mem.mem_contents m) # b).