(* This is a rather vacuous lemma, since the premise is simply True *)
(* Lemma Int64_eq_repr_signed32_nonzero: forall i, Int.eq i Int.zero = false -> Int64.eq (Int64.repr (Int.signed i)) Int64.zero = false. *)
(*  Lemma Int64_eq_repr_unsigned32_nonzero: forall i, Int.eq i Int.zero = false -> Int64.eq (Int64.repr (Int.unsigned i)) Int64.zero = false. *)
(* Lemma Int64_eq_repr_int_nonzero: forall s i, Int.eq i Int.zero = false -> Int64.eq (cast_int_long s i) Int64.zero = false. *)
Inductive tc_val_PM: type -> val -> Prop :=
| tc_val_PM_Tint: forall sz sg a v, is_int sz sg v -> tc_val_PM (Tint sz sg a) v
| tc_val_PM_Tlong: forall s a v, is_long v -> tc_val_PM (Tlong s a) v
| tc_val_PM_Tfloat_single: forall a v, is_single v -> tc_val_PM (Tfloat F32 a) v
| tc_val_PM_Tfloat_double: forall a v, is_float v -> tc_val_PM (Tfloat F64 a) v
| tc_val_PM_Tpointer: forall t a v,
(if eqb_type (Tpointer t a) int_or_ptr_type
then is_pointer_or_integer
else is_pointer_or_null) v ->
tc_val_PM (Tpointer t a) v
| tc_val_PM_Tarray: forall t n a v, is_pointer_or_null v -> tc_val_PM (Tarray t n a) v
| tc_val_PM_Tfunction: forall ts t a v, is_pointer_or_null v -> tc_val_PM (Tfunction ts t a) v
| tc_val_PM_Tstruct: forall i a v, isptr v -> tc_val_PM (Tstruct i a) v
| tc_val_PM_Tunion: forall i a v, isptr v -> tc_val_PM (Tunion i a) v.
Inductive tc_val_PM': type -> val -> Prop :=
| tc_val_PM'_Tint: forall t0 sz sg a v, t0 = Tint sz sg a -> is_int sz sg v -> tc_val_PM' t0 v
| tc_val_PM'_Tlong: forall t0 s a v, stupid_typeconv t0 = Tlong s a -> is_long v -> tc_val_PM' t0 v
| tc_val_PM'_Tfloat_single: forall t0 a v, stupid_typeconv t0 = Tfloat F32 a -> is_single v -> tc_val_PM' t0 v
| tc_val_PM'_Tfloat_double: forall t0 a v, stupid_typeconv t0 = Tfloat F64 a -> is_float v -> tc_val_PM' t0 v
| tc_val_PM'_Tpointer: forall t0 t a v,
stupid_typeconv t0 = Tpointer t a ->
(if eqb_type t0 int_or_ptr_type
then is_pointer_or_integer
else is_pointer_or_null) v ->
tc_val_PM' t0 v
| tc_val_PM'_Tstruct: forall t0 i a v, stupid_typeconv t0 = Tstruct i a -> isptr v -> tc_val_PM' t0 v
| tc_val_PM'_Tunion: forall t0 i a v, stupid_typeconv t0 = Tunion i a -> isptr v -> tc_val_PM' t0 v.
Ltac solve_tc_val H :=
rewrite tc_val_tc_val_PM in H; inv H.
Ltac solve_tc_val' H :=
rewrite tc_val_tc_val_PM' in H; inv H.

Lemma typecheck_Osub_sound:
forall {CS: compspecs} (rho : environ) m (e1 e2 : expr) (t : type)
(IBR: denote_tc_assert (isBinOpResultType Osub e1 e2 t) rho m)
(TV2: tc_val (typeof e2) (eval_expr e2 rho))
(TV1: tc_val (typeof e1) (eval_expr e1 rho)),
tc_val t
(eval_binop Osub (typeof e1) (typeof e2)
(eval_expr e1 rho) (eval_expr e2 rho)).