Proof with (try discriminate).
intros. unfold sem_binarith, binarith_type in *.
set (ty' := Cop.binarith_type (classify_binarith ty1 ty2)) in *.
destruct (sem_cast v1 ty1 ty' m) as [v1'|] eqn:CAST1...
destruct (sem_cast v2 ty2 ty' m) as [v2'|] eqn:CAST2...
DestructCases.
- specialize (H s i i0). rewrite H3 in H.
destruct v; auto with ty; contradiction.
- specialize (H0 s i i0). rewrite H3 in H0.
destruct v; auto with ty; contradiction.
- specialize (H1 f f0). rewrite H3 in H1.
destruct v; auto with ty; contradiction.
- specialize (H2 f f0). rewrite H3 in H2.
destruct v; auto with ty; contradiction.
Qed.

(* Specifications: *)
Lemma pres_sem_binarith_int:
forall
(sem_int: signedness -> int -> int -> option val)
(sem_long: signedness -> int64 -> int64 -> option val)
v1 ty1 v2 ty2 m v ty msg,
(forall sg n1 n2,
match sem_int sg n1 n2 with None | Some (Vint _) | Some Vundef => True | _ => False end) ->
(forall sg n1 n2,
match sem_long sg n1 n2 with None | Some (Vlong _) | Some Vundef => True | _ => False end) ->
sem_binarith sem_int sem_long (fun n1 n2 => None) (fun n1 n2 => None) v1 ty1 v2 ty2 m = Some v ->
binarith_int_type ty1 ty2 msg = OK ty ->
wt_val v ty.
Lemma pres_sem_shift:
forall sem_int sem_long ty1 ty2 m ty v1 v2 v,
shift_op_type ty1 ty2 m = OK ty ->
sem_shift sem_int sem_long v1 ty1 v2 ty2 = Some v ->
wt_val v ty.
Lemma pres_sem_cmp:
forall ty1 ty2 msg ty c v1 v2 m v,
comparison_type ty1 ty2 msg = OK ty ->
sem_cmp c v1 ty1 v2 ty2 m = Some v ->
wt_val v ty.