Local Open Scope logic.
Definition int_type_min_max (type_i type_hi: type): option (Z * Z) :=
match type_i, type_hi with
| Tint I32 s_i _, Tint i_hi s_hi _ =>
Some match s_i with
| Signed => (match i_hi, s_hi with
| I32, Unsigned => 0
| _, _ => Int.min_signed
end, Int.max_signed)
| Unsigned => (0, Int.max_unsigned)
end
| Tint I32 s_i _, Tlong s_hi _ =>
Some match s_i with
| Signed => match s_hi with
| Unsigned => (0, Int.max_signed)
| _ => (Int.min_signed, Int.max_signed)
end
| Unsigned => (0, Int.max_unsigned)
end
| _, _ => None
end.
Inductive range_init_hl (type_lo type_i type_hi: type): (Z -> Z -> Prop) -> Prop :=
| construct_range_init_hl:
forall int_min int_max,
is_int_type type_lo = true ->
int_type_min_max type_i type_hi = Some (int_min, int_max) ->
range_init_hl type_lo type_i type_hi (fun m n => int_min <= m <= n /\ n <= int_max).
(* Lemma range_init_hl_spec: forall (type_lo type_i type_hi: type) range, range_init_hl type_lo type_i type_hi range -> exists int_min_lo int_max_lo int_min_i int_max_i int_min_hi int_max_hi int_min int_max, is_int32_type type_lo = true /\ is_int32_type type_i = true /\ int_type_min_max type_lo = Some (int_min_lo, int_max_lo) /\ int_type_min_max type_i = Some (int_min_i, int_max_i) /\ int_type_min_max type_hi = Some (int_min_hi, int_max_hi) /\ int_min = Z.max (Z.max int_min_lo int_min_i) int_min_hi /\ int_max = Z.min int_max_i int_max_hi /\ forall m n, range m n -> m <= int_max_lo /\ int_min <= m <= n /\ int_min_hi <= n <= int_max. *)
Inductive range_init_h (type_i type_hi: type): Z -> (Z -> Prop) -> Prop :=
| construct_range_init_h:
forall int_min int_max,
int_type_min_max type_i type_hi = Some (int_min, int_max) ->
range_init_h type_i type_hi int_min (fun n =>
int_min <= n <= int_max).
Inductive Int_eqm_unsigned: int -> Z -> Prop :=
| Int_eqm_unsigned_repr: forall z, Int_eqm_unsigned (Int.repr z) z.
Inductive Int64_eqm_unsigned: int64 -> Z -> Prop :=
| Int64_eqm_unsigned_repr: forall z, Int64_eqm_unsigned (Int64.repr z) z.
Inductive Int6432_val: type -> val -> Z -> Prop :=
| Int_64_eqm_unsigned_repr: forall s i64 z,
Int64_eqm_unsigned i64 z ->
Int6432_val (Tlong s noattr) (Vlong i64) z
| Int_32_eqm_unsigned_repr: forall s i i32 z,
Int_eqm_unsigned i32 z ->
Int6432_val (Tint s i noattr) (Vint i32) z.

(* Specifications: *)
Lemma Int_eqm_unsigned_repr': forall i z,
i = Int.repr z ->
Int_eqm_unsigned i z.
Lemma Int64_eqm_unsigned_repr': forall i z,
i = Int64.repr z ->
Int64_eqm_unsigned i z.
Lemma Int_eqm_unsigned_spec: forall i z,
Int_eqm_unsigned i z -> Int.eqm (Int.unsigned i) z.
Lemma Int64_eqm_unsigned_spec: forall i z,
Int64_eqm_unsigned i z -> Int64.eqm (Int64.unsigned i) z.