(** * Properties of operations over types *)

Remark transl_params_types:
  forall params,
  map typ_of_type (map snd params) = typlist_of_typelist (type_of_params params).

(* Specifications: *)
Lemma transl_fundef_sig1: forall f tf args res, transl_fundef f = OK tf -> classify_fun (type_of_fundef f) = fun_case_f args res -> funsig tf = signature_of_type args res.
Lemma transl_fundef_sig2: forall f tf args res, transl_fundef f = OK tf -> type_of_fundef f = Tfunction args res -> funsig tf = signature_of_type args res.
Lemma transl_expr_lvalue: forall ge e le m a loc ofs ta, Clight.eval_lvalue ge e le m a loc ofs -> transl_expr a = OK ta -> (exists tb, transl_lvalue a = OK tb /\ make_load tb (typeof a) = OK ta).
Lemma transl_lbl_stmt_1: forall tyret nbrk ncnt n sl tsl, transl_lbl_stmt tyret nbrk ncnt sl = OK tsl -> transl_lbl_stmt tyret nbrk ncnt (Clight.select_switch n sl) = OK (select_switch n tsl).
Lemma transl_lbl_stmt_2: forall tyret nbrk ncnt sl tsl, transl_lbl_stmt tyret nbrk ncnt sl = OK tsl -> transl_statement tyret nbrk ncnt (seq_of_labeled_statement sl) = OK (seq_of_lbl_stmt tsl).
Lemma make_intconst_correct: forall n e le m, eval_expr ge e le m (make_intconst n) (Vint n).
Lemma make_floatconst_correct: forall n e le m, eval_expr ge e le m (make_floatconst n) (Vfloat n).
Lemma make_longconst_correct: forall n e le m, eval_expr ge e le m (make_longconst n) (Vlong n).
Lemma make_floatofint_correct: forall a n sg sz e le m, eval_expr ge e le m a (Vint n) -> eval_expr ge e le m (make_floatofint a sg sz) (Vfloat(cast_int_float sg sz n)).
Lemma make_intoffloat_correct: forall e le m a sg f i, eval_expr ge e le m a (Vfloat f) -> cast_float_int sg f = Some i -> eval_expr ge e le m (make_intoffloat a sg) (Vint i).
Lemma make_longofint_correct: forall a n sg e le m, eval_expr ge e le m a (Vint n) -> eval_expr ge e le m (make_longofint a sg) (Vlong(cast_int_long sg n)).
Lemma make_floatoflong_correct: forall a n sg sz e le m, eval_expr ge e le m a (Vlong n) -> eval_expr ge e le m (make_floatoflong a sg sz) (Vfloat(cast_long_float sg sz n)).
Lemma make_longoffloat_correct: forall e le m a sg f i, eval_expr ge e le m a (Vfloat f) -> cast_float_long sg f = Some i -> eval_expr ge e le m (make_longoffloat a sg) (Vlong i).
Lemma make_cmp_ne_zero_correct: forall e le m a n, eval_expr ge e le m a (Vint n) -> eval_expr ge e le m (make_cmp_ne_zero a) (Vint (if Int.eq n Int.zero then Int.zero else Int.one)).
Lemma make_cast_int_correct: forall e le m a n sz si, eval_expr ge e le m a (Vint n) -> eval_expr ge e le m (make_cast_int a sz si) (Vint (cast_int_int sz si n)).
Lemma make_cast_float_correct: forall e le m a n sz, eval_expr ge e le m a (Vfloat n) -> eval_expr ge e le m (make_cast_float a sz) (Vfloat (cast_float_float sz n)).
Lemma make_cast_correct: forall e le m a b v ty1 ty2 v', make_cast ty1 ty2 a = OK b -> eval_expr ge e le m a v -> sem_cast v ty1 ty2 = Some v' -> eval_expr ge e le m b v'.
Lemma make_neg_correct: forall a tya c va v e le m, sem_neg va tya = Some v -> make_neg a tya = OK c -> eval_expr ge e le m a va -> eval_expr ge e le m c v.
Lemma make_notbool_correct: forall a tya c va v e le m, sem_notbool va tya = Some v -> make_notbool a tya = OK c -> eval_expr ge e le m a va -> eval_expr ge e le m c v.
Lemma make_notint_correct: forall a tya c va v e le m, sem_notint va tya = Some v -> make_notint a tya = OK c -> eval_expr ge e le m a va -> eval_expr ge e le m c v.