Module ValObsEq.
(** Strong injections on values *)
Inductive val_obs (mi : memren) : val -> val -> Prop :=
obs_int : forall i : int, val_obs mi (Vint i) (Vint i)
| obs_long : forall i : int64, val_obs mi (Vlong i) (Vlong i)
| obs_float : forall f : Floats.float,
val_obs mi (Vfloat f) (Vfloat f)
| obs_single : forall f : Floats.float32,
val_obs mi (Vsingle f) (Vsingle f)
| obs_ptr : forall (b1 b2 : block) (ofs : ptrofs),
mi b1 = Some b2 ->
val_obs mi (Vptr b1 ofs) (Vptr b2 ofs)
| obs_undef : val_obs mi Vundef Vundef.
(** Strong injections on memory values*)
Inductive memval_obs_eq (f : memren) : memval -> memval -> Prop :=
| memval_obs_byte : forall n : byte,
memval_obs_eq f (Byte n) (Byte n)
| memval_obs_frag : forall (v1 v2 : val) (q : quantity) (n : nat)
(Hval_obs: val_obs f v1 v2),
memval_obs_eq f (Fragment v1 q n) (Fragment v2 q n)
| memval_obs_undef : memval_obs_eq f Undef Undef.
Inductive val_obs_list (mi : memren) : seq val -> seq val -> Prop :=
val_obs_list_nil : val_obs_list mi [::] [::]
| val_obs_list_cons : forall (v v' : val) (vl vl' : seq val),
val_obs mi v v' ->
val_obs_list mi vl vl' ->
val_obs_list mi (v :: vl) (v' :: vl').
Hint Constructors val_obs : val_renamings.
Proof with eauto with val_renamings.
intros.
destruct v; inversion Hval_obs; subst...
Qed.
Proof with eauto with val_renamings.
intros v v' v'' f f' f'' Hval'' Hval' Hf.
inversion Hval'; subst; inversion Hval''; subst...
Qed.
Proof with eauto with val_renamings.
intros.
destruct v...
destruct Hvalid as [b' Hf].
specialize (Hid _ _ Hf);
subst...
Qed.
Proof with eauto with val_renamings.
intros;
destruct v; inversion H; subst;
simpl...
Qed.
Proof with eauto with val_renamings.
intros;
destruct v; inversion H; subst;
simpl...
Qed.
Proof with eauto with val_renamings.
intros;
destruct vhi; inversion Hobs_hi; subst; simpl...
destruct vlo; inversion Hobs_lo...
Qed.
Proof with eauto with val_renamings.
intros;
destruct v; inversion Hval_obs; subst;
destruct chunk; simpl...
Qed.
Proof with eauto with val_renamings.
intros; destruct v; inversion Hval_obs; subst; simpl...
Qed.
Definition val_obsC f v :=
match v with
| Vptr b n => match f b with
| Some b' => Vptr b' n
| None => Vundef
end
| _ => v
end.

Lemma val_obsC_correct:
forall f v,
valid_val f v ->
val_obs f v (val_obsC f v).