Proof with eauto with val_renamings.
intros.
destruct v1, v1'; inversion Hval_obs;
inversion Hval_obs'; subst; simpl; eauto with val_renamings;
unfold Val.cmpu,Val.of_optbool, Val.cmpu_bool, Vtrue, Vfalse...
- destruct (Int.cmpu comp i0 i2)...
- assert (Int.eq i0 Int.zero &&
(Mem.valid_pointer m b1 (Ptrofs.unsigned ofs)
|| Mem.valid_pointer m b1 (Ptrofs.unsigned ofs - 1))
= Int.eq i0 Int.zero &&
(Mem.valid_pointer m' b2 (Ptrofs.unsigned ofs)
|| Mem.valid_pointer m' b2 (Ptrofs.unsigned ofs - 1))).
{ destruct (Int.eq i0 Int.zero); simpl; try reflexivity.
erewrite valid_pointer_ren; eauto.
erewrite valid_pointer_ren with (ofs := (Ptrofs.unsigned ofs - 1)%Z);
eauto.
}
rewrite H.
repeat match goal with
| [|- context[match ?Expr with _ => _ end]] =>
destruct Expr eqn:?
end...
- assert (Int.eq i1 Int.zero &&
(Mem.valid_pointer m b (Ptrofs.unsigned i0)
|| Mem.valid_pointer m b (Ptrofs.unsigned i0 - 1))
= Int.eq i1 Int.zero &&
(Mem.valid_pointer m' b0 (Ptrofs.unsigned i0)
|| Mem.valid_pointer m' b0 (Ptrofs.unsigned i0 - 1))).
{ destruct (Int.eq i1 Int.zero); simpl; try reflexivity.
erewrite valid_pointer_ren; eauto.
erewrite valid_pointer_ren with (ofs := (Ptrofs.unsigned i0 - 1)%Z);
eauto.
}
rewrite H.
repeat match goal with
| [|- context[match ?Expr with _ => _ end]] =>
destruct Expr eqn:?
end...
- assert (Hequiv: (eq_block b b3) <-> (eq_block b0 b4)).
{ split.
- intros Heq.
destruct (eq_block b b3); subst.
+ rewrite H4 in H0; inversion H0; subst.
destruct (eq_block b0 b0); auto.
+ by exfalso.
- intros Heq.
destruct (eq_block b b3); subst.
+ rewrite H4 in H0; inversion H0; subst.
destruct (eq_block b0 b0); auto.
+ destruct (eq_block b0 b4); subst; auto.
assert (Hinjective := injective (weak_obs_eq Hmem_obs_eq)).
specialize (Hinjective _ _ _ H4 H0); subst.
by exfalso.
}
destruct (eq_block b b3) eqn:Hb;
destruct (eq_block b0 b4) eqn:Hb0; simpl in *; subst;
destruct Hequiv; try (by exfalso; eauto).
assert (Hif: (Mem.valid_pointer m b3 (Ptrofs.unsigned i0)
|| Mem.valid_pointer m b3 (Ptrofs.unsigned i0 - 1))
&&
(Mem.valid_pointer m b3 (Ptrofs.unsigned ofs0)
|| Mem.valid_pointer m b3 (Ptrofs.unsigned ofs0 - 1))
=
(Mem.valid_pointer m' b4 (Ptrofs.unsigned i0)
|| Mem.valid_pointer m' b4 (Ptrofs.unsigned i0 - 1))
&&
(Mem.valid_pointer m' b4 (Ptrofs.unsigned ofs0)
|| Mem.valid_pointer m' b4 (Ptrofs.unsigned ofs0 - 1))).
{ erewrite valid_pointer_ren; eauto.
erewrite valid_pointer_ren with
(m := m) (b1:=b3) (ofs := (Ptrofs.unsigned i0 - 1)%Z); eauto.
erewrite valid_pointer_ren with
(m := m) (b1:=b3) (ofs := Ptrofs.unsigned ofs0); eauto.
erewrite valid_pointer_ren with
(m := m) (b1:=b3) (ofs := (Ptrofs.unsigned ofs0 - 1)%Z); eauto.
}
rewrite Hif.
repeat match goal with
| [|- context[match ?Expr with _ => _ end]] =>
destruct Expr eqn:?
end...
erewrite valid_pointer_ren; eauto.
erewrite valid_pointer_ren with (b1 := b3); eauto.
repeat match goal with
| [|- context[match ?Expr with _ => _ end]] =>
destruct Expr eqn:?
end...
Qed.
Hint Resolve val_obs_cmpu : val_renamings.

Lemma val_obs_cmplu:
forall f v1 v2 v1' v2' m m' (comp : comparison)
(Hval_obs': val_obs f v2 v2')
(Hval_obs: val_obs f v1 v1')
(Hmem_obs_eq: mem_obs_eq f m m'),
val_obs f (Val.maketotal (Val.cmplu (Mem.valid_pointer m) comp v1 v2))
(Val.maketotal (Val.cmplu (Mem.valid_pointer m') comp v1' v2')).