Module ValueWD.
Hint Immediate ren_domain_incr_refl : wd.
(** Valid values are the ones that have no pointers outside the domain of f*)
Definition valid_val (f: memren) (v : val) : Prop :=
match v with
| Vptr b _ =>
exists b', f b = Some b'
| _ => True
end.
Inductive valid_val_list (f: memren) : seq val -> Prop :=
| vs_nil: valid_val_list f [::]
| vs_cons: forall v vs,
valid_val f v ->
valid_val_list f vs ->
valid_val_list f (v :: vs).
Definition valid_memval (f: memren) (mv : memval) : Prop :=
match mv with
| Fragment v _ _ =>
valid_val f v
| _ => True
end.
Inductive valid_memval_list (f : memren) : seq memval -> Prop :=
|  mvs_nil : valid_memval_list f [::]
| mvs_cons : forall (v : memval) (vs : seq memval),
valid_memval f v ->
valid_memval_list f vs -> valid_memval_list f (v :: vs).

Lemma valid_val_domain:
forall f f' m v,
valid_val f v ->
domain_memren f m ->
domain_memren f' m ->
valid_val f' v.