Section X86WD.
Variable f: memren.
Definition regset_wd rs : Prop :=
forall r, valid_val f (Pregmap.get r rs).
Definition core_wd c : Prop :=
match c with State rs _ => regset_wd rs end.
Definition ge_wd (the_ge: genv) : Prop :=
(forall b, Maps.PTree.get b (genv_defs the_ge) ->
f b) /\
(forall id ofs v, Senv.symbol_address the_ge id ofs = v ->
valid_val f v).
End X86WD.
(* Lemma decode_longs_valid_val: forall f vals tys, valid_val_list f vals -> valid_val_list f (val_casted.decode_longs tys vals). *)
Hint Extern 1 (valid_val _ (@Pregmap.set _ _ _ _ _)) => eapply regset_wd_set : wd.
Hint Resolve regset_wd_set regset_wd_set_res : wd.
Proof with eauto with wd.
intros.
induction regs as [|r regs]; simpl; auto.
intros r'.
rewrite undef_regs_comm;
rewrite Pregmap.gsspec;
unfold Pregmap.get;
destruct (Pregmap.elt_eq r' r); simpl...
Qed.
Hint Extern 0 (valid_val _ (undef_regs _ _ # _ <- _ _)) => eapply regset_wd_set : wd.
Hint Resolve regset_wd_domain
valid_val_list_incr valid_val_domain
valid_val_list_domain regset_wd_undef : wd.
Proof with eauto with wd.
intros.
destruct Hge_wd as (H1 & H2).
unfold symbol_address, Senv.symbol_address in *;
simpl in *.
specialize (H2 id i _ ltac:(reflexivity)).
destruct (find_symbol g id); auto.
eapply valid_val_incr; eauto.
Qed.
Hint Resolve valid_symb : wd.
Proof with eauto with wd.
intros.
destruct v1,v2; simpl; auto;
unfold Val.cmpu, Val.cmpu_bool...
Qed.
Hint Immediate valid_val_cmpu :wd.
Proof with eauto with wd.
intros.
destruct v1,v2; simpl; auto;
unfold Val.cmpu, Val.cmpu_bool...
Qed.
Hint Immediate valid_val_cmplu :wd.
Proof with eauto 10 with wd.
intros.
unfold compare_ints...
Qed.
Hint Resolve valid_val_compare_ints : wd.
Proof with eauto 10 with wd.
intros.
unfold compare_longs...
Qed.
Hint Resolve valid_val_compare_longs : wd.
Proof with eauto with wd.
intros.
intro r.
unfold Pregmap.get...
Qed.
Proof with eauto with wd.
intros.
intro r.
unfold Pregmap.get...
Qed.
Proof with eauto 10 with wd.
intros.
unfold compare_floats.
destruct v1; try (apply regset_wd_undef; eauto with wd).
destruct v2;
try (apply regset_wd_undef; eauto with wd).
eauto 8 with wd.
Qed.
Hint Resolve valid_val_compare_floats : wd.
Proof with eauto with wd.
intros.
intro r.
unfold Pregmap.get...
Qed.
Proof with eauto 10 with wd.
intros.
unfold compare_floats32.
destruct v1; try (apply regset_wd_undef; eauto with wd).
destruct v2;
try (apply regset_wd_undef; eauto with wd)...
Qed.
Hint Resolve valid_val_compare_floats32 : wd.

Lemma regset_wd_compare_floats32:
forall f rs v1 v2,
regset_wd f rs ->
regset_wd f (compare_floats32 v1 v2 rs).