eapply In_valid_memval_list in Hmval_wd; eauto.
simpl in Hmval_wd.
eapply wd_val_valid; eauto.
unfold domain_memren in *.
intros b.
split; intros Hb;
[eapply Mem.storebytes_valid_block_2 in Hb; eauto|
eapply Mem.storebytes_valid_block_1; eauto];
eapply Hdomain; eauto.
+ apply Intv.range_notin in n.
erewrite Mem.setN_outside by eauto.
specialize (Hmem_wd _ Hvalid ofs0 _ ltac:(reflexivity)).
destruct (ZMap.get ofs0 (Mem.mem_contents m) # b0); auto.
eapply valid_val_storebytes; eauto.
simpl.
zify; omega.
- erewrite Maps.PMap.gso by eauto.
specialize (Hmem_wd _ Hvalid ofs0 _ ltac:(reflexivity)).
destruct (ZMap.get ofs0 (Mem.mem_contents m) # b0); subst; auto.
eapply valid_val_storebytes; eauto. }
{ split.
intros. eapply Mem.storebytes_valid_block_2 in H; eauto.
eapply Hdomain; auto.
intros. eapply Mem.storebytes_valid_block_1; eauto.
apply Hdomain; auto.
}
Qed.

Lemma storev_wd_domain:
forall (m m' : mem) (chunk : memory_chunk) (vptr v : val) f,
domain_memren f m ->
Mem.storev chunk m vptr v = Some m' ->
mem_wd.val_valid v m ->
valid_mem m ->
valid_mem m' /\ domain_memren f m'.