Proof with (try discriminate).
unfold comparison_type, sem_cmp; intros.
assert (X: forall b, wt_val (Val.of_bool b) (Tint I32 Signed noattr)).
{
intros b; destruct b; constructor; exact I.
}
assert (Y: forall ob, option_map Val.of_bool ob = Some v -> wt_val v (Tint I32 Signed noattr)).
{
intros ob EQ. destruct ob as [b|]; inv EQ. eauto.
}
destruct (classify_cmp ty1 ty2).
- inv H; eauto.
- DestructCases; eauto.
- DestructCases; eauto.
- DestructCases; eauto.
- DestructCases; eauto.
- unfold sem_binarith in H0.
set (ty' := Cop.binarith_type (classify_binarith ty1 ty2)) in *.
destruct (sem_cast v1 ty1 ty') as [v1'|]...
destruct (sem_cast v2 ty2 ty') as [v2'|]...
DestructCases; auto.
Qed.

(* Specifications: *)
Lemma pres_sem_binop:
forall ce op ty1 ty2 ty v1 v2 v m,
type_binop op ty1 ty2 = OK ty ->
sem_binary_operation ce op v1 ty1 v2 ty2 m = Some v ->
wt_val v1 ty1 -> wt_val v2 ty2 ->
wt_val v ty.
Lemma pres_sem_unop:
forall op ty1 ty v1 m v,
type_unop op ty1 = OK ty ->
sem_unary_operation op v1 ty1 m = Some v ->
wt_val v1 ty1 ->
wt_val v ty.
Lemma wt_load_result:
forall ty chunk v,
access_mode ty = By_value chunk ->
wt_val (Val.load_result chunk v) ty.
Lemma wt_decode_val:
forall ty chunk vl,
access_mode ty = By_value chunk ->
wt_val (decode_val chunk vl) ty.
Lemma wt_deref_loc:
forall ge ty m b ofs t v,
deref_loc ge ty m b ofs t v ->
wt_val v ty.
Lemma wt_bool_cast:
forall ty, wt_bool ty -> wt_cast ty type_bool.
Lemma wt_cast_self:
forall t1 t2, wt_cast t1 t2 -> wt_cast t2 t2.
Lemma binarith_type_int32s:
forall ty1 msg ty2,
binarith_type ty1 type_int32s msg = OK ty2 ->
ty2 = incrdecr_type ty1.
Lemma type_add_int32s:
forall ty1 ty2,
type_binop Oadd ty1 type_int32s = OK ty2 ->
ty2 = incrdecr_type ty1.
Lemma type_sub_int32s:
forall ty1 ty2,
type_binop Osub ty1 type_int32s = OK ty2 ->
ty2 = incrdecr_type ty1.
Lemma wt_rred:
forall ge tenv a m t a' m',
rred ge a m t a' m' -> wt_rvalue ge tenv a -> wt_rvalue ge tenv a'.
Lemma wt_lred:
forall tenv ge e a m a' m',
lred ge e a m a' m' -> wt_lvalue ge tenv a -> wt_lvalue ge tenv a'.
Lemma rred_same_type:
forall ge a m t a' m',
rred ge a m t a' m' -> typeof a' = typeof a.
Lemma lred_same_type:
forall ge e a m a' m',
lred ge e a m a' m' -> typeof a' = typeof a.