Definition canonic_exp x :=
  fexp (ln_beta beta x).Definition canonic (f : float beta) :=
  Fexp f = canonic_exp (F2R f).Definition scaled_mantissa x :=
  (x * bpow (- canonic_exp x))%R.Definition generic_format (x : R) :=
  x = F2R (Float beta (Ztrunc (scaled_mantissa x)) (canonic_exp x)).

(* Specifications: *)
Theorem generic_format_0 : generic_format 0.
Theorem canonic_exp_opp : forall x, canonic_exp (-x) = canonic_exp x.
Theorem canonic_exp_abs : forall x, canonic_exp (Rabs x) = canonic_exp x.
Theorem generic_format_bpow : forall e, (fexp (e + 1) <= e)%Z -> generic_format (bpow e).
Theorem generic_format_bpow' : forall e, (fexp e <= e)%Z -> generic_format (bpow e).
Theorem generic_format_F2R : forall m e, ( m <> 0 -> canonic_exp (F2R (Float beta m e)) <= e )%Z -> generic_format (F2R (Float beta m e)).
Lemma generic_format_F2R': forall (x:R) (f:float beta), F2R f = x -> ((x <> 0)%R -> (canonic_exp x <= Fexp f)%Z) -> generic_format x.
Theorem canonic_opp : forall m e, canonic (Float beta m e) -> canonic (Float beta (-m) e).
Theorem canonic_abs : forall m e, canonic (Float beta m e) -> canonic (Float beta (Zabs m) e).
Theorem canonic_0: canonic (Float beta 0 (fexp (ln_beta beta 0%R))).
Theorem canonic_unicity : forall f1 f2, canonic f1 -> canonic f2 -> F2R f1 = F2R f2 -> f1 = f2.
Theorem scaled_mantissa_generic : forall x, generic_format x -> scaled_mantissa x = Z2R (Ztrunc (scaled_mantissa x)).
Theorem scaled_mantissa_mult_bpow : forall x, (scaled_mantissa x * bpow (canonic_exp x))%R = x.
Theorem scaled_mantissa_0 : scaled_mantissa 0 = 0%R.
Theorem scaled_mantissa_opp : forall x, scaled_mantissa (-x) = (-scaled_mantissa x)%R.
Theorem scaled_mantissa_abs : forall x, scaled_mantissa (Rabs x) = Rabs (scaled_mantissa x).
Theorem generic_format_opp : forall x, generic_format x -> generic_format (-x).
Theorem generic_format_abs : forall x, generic_format x -> generic_format (Rabs x).
Theorem generic_format_abs_inv : forall x, generic_format (Rabs x) -> generic_format x.
Theorem canonic_exp_fexp : forall x ex, (bpow (ex - 1) <= Rabs x < bpow ex)%R -> canonic_exp x = fexp ex.
Theorem canonic_exp_fexp_pos : forall x ex, (bpow (ex - 1) <= x < bpow ex)%R -> canonic_exp x = fexp ex.
Theorem mantissa_small_pos : forall x ex, (bpow (ex - 1) <= x < bpow ex)%R -> (ex <= fexp ex)%Z -> (0 < x * bpow (- fexp ex) < 1)%R.
Theorem scaled_mantissa_small : forall x ex, (Rabs x < bpow ex)%R -> (ex <= fexp ex)%Z -> (Rabs (scaled_mantissa x) < 1)%R.
Theorem abs_scaled_mantissa_lt_bpow : forall x, (Rabs (scaled_mantissa x) < bpow (ln_beta beta x - canonic_exp x))%R.
Theorem ln_beta_generic_gt : forall x, (x <> 0)%R -> generic_format x -> (canonic_exp x < ln_beta beta x)%Z.
Theorem mantissa_DN_small_pos : forall x ex, (bpow (ex - 1) <= x < bpow ex)%R -> (ex <= fexp ex)%Z -> Zfloor (x * bpow (- fexp ex)) = Z0.
Theorem mantissa_UP_small_pos : forall x ex, (bpow (ex - 1) <= x < bpow ex)%R -> (ex <= fexp ex)%Z -> Zceil (x * bpow (- fexp ex)) = 1%Z.
Theorem generic_format_discrete : forall x m, let e := canonic_exp x in (F2R (Float beta m e) < x < F2R (Float beta (m + 1) e))%R -> ~ generic_format x.
Theorem generic_format_canonic : forall f, canonic f -> generic_format (F2R f).
Theorem generic_format_ge_bpow : forall emin, ( forall e, (emin <= fexp e)%Z ) -> forall x, (0 < x)%R -> generic_format x -> (bpow emin <= x)%R.
Theorem abs_lt_bpow_prec: forall prec, (forall e, (e - prec <= fexp e)%Z) -> (* OK with FLX, FLT and FTZ *) forall x, (Rabs x < bpow (prec + canonic_exp x))%R.
Theorem generic_format_bpow_inv' : forall e, generic_format (bpow e) -> (fexp (e + 1) <= e)%Z.
Theorem generic_format_bpow_inv : forall e, generic_format (bpow e) -> (fexp e <= e)%Z.
Theorem generic_format_0 : generic_format 0.
Theorem canonic_exp_opp : forall x, canonic_exp (-x) = canonic_exp x.
Theorem canonic_exp_abs : forall x, canonic_exp (Rabs x) = canonic_exp x.
Theorem generic_format_bpow : forall e, (fexp (e + 1) <= e)%Z -> generic_format (bpow e).
Theorem generic_format_bpow' : forall e, (fexp e <= e)%Z -> generic_format (bpow e).
Theorem generic_format_F2R : forall m e, ( m <> 0 -> canonic_exp (F2R (Float beta m e)) <= e )%Z -> generic_format (F2R (Float beta m e)).
Lemma generic_format_F2R': forall (x:R) (f:float beta), F2R f = x -> ((x <> 0)%R -> (canonic_exp x <= Fexp f)%Z) -> generic_format x.
Theorem canonic_opp : forall m e, canonic (Float beta m e) -> canonic (Float beta (-m) e).
Theorem canonic_abs : forall m e, canonic (Float beta m e) -> canonic (Float beta (Zabs m) e).
Theorem canonic_0: canonic (Float beta 0 (fexp (ln_beta beta 0%R))).
Theorem canonic_unicity : forall f1 f2, canonic f1 -> canonic f2 -> F2R f1 = F2R f2 -> f1 = f2.
Theorem scaled_mantissa_generic : forall x, generic_format x -> scaled_mantissa x = Z2R (Ztrunc (scaled_mantissa x)).
Theorem scaled_mantissa_mult_bpow : forall x, (scaled_mantissa x * bpow (canonic_exp x))%R = x.
Theorem scaled_mantissa_0 : scaled_mantissa 0 = 0%R.
Theorem scaled_mantissa_opp : forall x, scaled_mantissa (-x) = (-scaled_mantissa x)%R.
Theorem scaled_mantissa_abs : forall x, scaled_mantissa (Rabs x) = Rabs (scaled_mantissa x).
Theorem generic_format_opp : forall x, generic_format x -> generic_format (-x).
Theorem generic_format_abs : forall x, generic_format x -> generic_format (Rabs x).
Theorem generic_format_abs_inv : forall x, generic_format (Rabs x) -> generic_format x.
Theorem canonic_exp_fexp : forall x ex, (bpow (ex - 1) <= Rabs x < bpow ex)%R -> canonic_exp x = fexp ex.
Theorem canonic_exp_fexp_pos : forall x ex, (bpow (ex - 1) <= x < bpow ex)%R -> canonic_exp x = fexp ex.
Theorem mantissa_small_pos : forall x ex, (bpow (ex - 1) <= x < bpow ex)%R -> (ex <= fexp ex)%Z -> (0 < x * bpow (- fexp ex) < 1)%R.
Theorem scaled_mantissa_small : forall x ex, (Rabs x < bpow ex)%R -> (ex <= fexp ex)%Z -> (Rabs (scaled_mantissa x) < 1)%R.
Theorem abs_scaled_mantissa_lt_bpow : forall x, (Rabs (scaled_mantissa x) < bpow (ln_beta beta x - canonic_exp x))%R.
Theorem ln_beta_generic_gt : forall x, (x <> 0)%R -> generic_format x -> (canonic_exp x < ln_beta beta x)%Z.
Theorem mantissa_DN_small_pos : forall x ex, (bpow (ex - 1) <= x < bpow ex)%R -> (ex <= fexp ex)%Z -> Zfloor (x * bpow (- fexp ex)) = Z0.
Theorem mantissa_UP_small_pos : forall x ex, (bpow (ex - 1) <= x < bpow ex)%R -> (ex <= fexp ex)%Z -> Zceil (x * bpow (- fexp ex)) = 1%Z.
Theorem generic_format_discrete : forall x m, let e := canonic_exp x in (F2R (Float beta m e) < x < F2R (Float beta (m + 1) e))%R -> ~ generic_format x.
Theorem generic_format_canonic : forall f, canonic f -> generic_format (F2R f).
Theorem generic_format_ge_bpow : forall emin, ( forall e, (emin <= fexp e)%Z ) -> forall x, (0 < x)%R -> generic_format x -> (bpow emin <= x)%R.
Theorem abs_lt_bpow_prec: forall prec, (forall e, (e - prec <= fexp e)%Z) -> (* OK with FLX, FLT and FTZ *) forall x, (Rabs x < bpow (prec + canonic_exp x))%R.
Theorem generic_format_bpow_inv' : forall e, generic_format (bpow e) -> (fexp (e + 1) <= e)%Z.
Theorem generic_format_bpow_inv : forall e, generic_format (bpow e) -> (fexp e <= e)%Z.