Notation bpow e := (bpow beta e).

(* Specifications: *)
Theorem round_repr_same_exp : forall m e, exists m', round beta fexp rnd (F2R (Float beta m e)) = F2R (Float beta m' e).
Lemma relative_error_lt_conversion : forall x b, (0 < b)%R -> (x <> 0 -> Rabs (round beta fexp rnd x - x) < b * Rabs x)%R -> exists eps, (Rabs eps < b)%R /\ round beta fexp rnd x = (x * (1 + eps))%R.
Lemma relative_error_le_conversion : forall x b, (0 <= b)%R -> (Rabs (round beta fexp rnd x - x) <= b * Rabs x)%R -> exists eps, (Rabs eps <= b)%R /\ round beta fexp rnd x = (x * (1 + eps))%R.
Theorem relative_error : forall x, (bpow emin <= Rabs x)%R -> (Rabs (round beta fexp rnd x - x) < bpow (-p + 1) * Rabs x)%R.
Theorem relative_error_ex : forall x, (bpow emin <= Rabs x)%R -> exists eps, (Rabs eps < bpow (-p + 1))%R /\ round beta fexp rnd x = (x * (1 + eps))%R.
Theorem relative_error_F2R_emin : forall m, let x := F2R (Float beta m emin) in (x <> 0)%R -> (Rabs (round beta fexp rnd x - x) < bpow (-p + 1) * Rabs x)%R.
Theorem relative_error_F2R_emin_ex : forall m, let x := F2R (Float beta m emin) in exists eps, (Rabs eps < bpow (-p + 1))%R /\ round beta fexp rnd x = (x * (1 + eps))%R.
Theorem relative_error_round : (0 < p)%Z -> forall x, (bpow emin <= Rabs x)%R -> (Rabs (round beta fexp rnd x - x) < bpow (-p + 1) * Rabs (round beta fexp rnd x))%R.
Theorem relative_error_round_F2R_emin : (0 < p)%Z -> forall m, let x := F2R (Float beta m emin) in (x <> 0)%R -> (Rabs (round beta fexp rnd x - x) < bpow (-p + 1) * Rabs (round beta fexp rnd x))%R.
Theorem relative_error_N : forall x, (bpow emin <= Rabs x)%R -> (Rabs (round beta fexp (Znearest choice) x - x) <= /2 * bpow (-p + 1) * Rabs x)%R.
Theorem relative_error_N_ex : forall x, (bpow emin <= Rabs x)%R -> exists eps, (Rabs eps <= /2 * bpow (-p + 1))%R /\ round beta fexp (Znearest choice) x = (x * (1 + eps))%R.
Theorem relative_error_N_F2R_emin : forall m, let x := F2R (Float beta m emin) in (Rabs (round beta fexp (Znearest choice) x - x) <= /2 * bpow (-p + 1) * Rabs x)%R.
Theorem relative_error_N_F2R_emin_ex : forall m, let x := F2R (Float beta m emin) in exists eps, (Rabs eps <= /2 * bpow (-p + 1))%R /\ round beta fexp (Znearest choice) x = (x * (1 + eps))%R.
Theorem relative_error_N_round : (0 < p)%Z -> forall x, (bpow emin <= Rabs x)%R -> (Rabs (round beta fexp (Znearest choice) x - x) <= /2 * bpow (-p + 1) * Rabs (round beta fexp (Znearest choice) x))%R.
Theorem relative_error_N_round_F2R_emin : (0 < p)%Z -> forall m, let x := F2R (Float beta m emin) in (Rabs (round beta fexp (Znearest choice) x - x) <= /2 * bpow (-p + 1) * Rabs (round beta fexp (Znearest choice) x))%R.
Lemma relative_error_FLT_aux : forall k, (emin + prec - 1 < k)%Z -> (prec <= k - FLT_exp emin prec k)%Z.
Theorem relative_error_FLT : forall x, (bpow (emin + prec - 1) <= Rabs x)%R -> (Rabs (round beta (FLT_exp emin prec) rnd x - x) < bpow (-prec + 1) * Rabs x)%R.
Theorem relative_error_FLT_F2R_emin : forall m, let x := F2R (Float beta m emin) in (x <> 0)%R -> (Rabs (round beta (FLT_exp emin prec) rnd x - x) < bpow (-prec + 1) * Rabs x)%R.
Theorem relative_error_FLT_F2R_emin_ex : forall m, let x := F2R (Float beta m emin) in exists eps, (Rabs eps < bpow (-prec + 1))%R /\ round beta (FLT_exp emin prec) rnd x = (x * (1 + eps))%R.
Theorem relative_error_FLT_ex : forall x, (bpow (emin + prec - 1) <= Rabs x)%R -> exists eps, (Rabs eps < bpow (-prec + 1))%R /\ round beta (FLT_exp emin prec) rnd x = (x * (1 + eps))%R.
Theorem relative_error_N_FLT : forall x, (bpow (emin + prec - 1) <= Rabs x)%R -> (Rabs (round beta (FLT_exp emin prec) (Znearest choice) x - x) <= /2 * bpow (-prec + 1) * Rabs x)%R.
Theorem relative_error_N_FLT_ex : forall x, (bpow (emin + prec - 1) <= Rabs x)%R -> exists eps, (Rabs eps <= /2 * bpow (-prec + 1))%R /\ round beta (FLT_exp emin prec) (Znearest choice) x = (x * (1 + eps))%R.
Theorem relative_error_N_FLT_round : forall x, (bpow (emin + prec - 1) <= Rabs x)%R -> (Rabs (round beta (FLT_exp emin prec) (Znearest choice) x - x) <= /2 * bpow (-prec + 1) * Rabs (round beta (FLT_exp emin prec) (Znearest choice) x))%R.
Theorem relative_error_N_FLT_F2R_emin : forall m, let x := F2R (Float beta m emin) in (Rabs (round beta (FLT_exp emin prec) (Znearest choice) x - x) <= /2 * bpow (-prec + 1) * Rabs x)%R.
Theorem relative_error_N_FLT_F2R_emin_ex : forall m, let x := F2R (Float beta m emin) in exists eps, (Rabs eps <= /2 * bpow (-prec + 1))%R /\ round beta (FLT_exp emin prec) (Znearest choice) x = (x * (1 + eps))%R.
Theorem relative_error_N_FLT_round_F2R_emin : forall m, let x := F2R (Float beta m emin) in (Rabs (round beta (FLT_exp emin prec) (Znearest choice) x - x) <= /2 * bpow (-prec + 1) * Rabs (round beta (FLT_exp emin prec) (Znearest choice) x))%R.
Lemma error_N_FLT_aux : forall x, (0 < x)%R -> exists eps, exists eta, (Rabs eps <= /2 * bpow (-prec + 1))%R /\ (Rabs eta <= /2 * bpow (emin))%R /\ (eps*eta=0)%R /\ round beta (FLT_exp emin prec) (Znearest choice) x = (x * (1 + eps) + eta)%R.
Lemma error_N_FLT : forall (emin prec : Z), (0 < prec)%Z -> forall (choice : Z -> bool), forall (x : R), exists eps eta : R, (Rabs eps <= /2 * bpow (-prec + 1))%R /\ (Rabs eta <= /2 * bpow emin)%R /\ (eps * eta = 0)%R /\ (round beta (FLT_exp emin prec) (Znearest choice) x = x * (1 + eps) + eta)%R.
Lemma relative_error_FLX_aux : forall k, (prec <= k - FLX_exp prec k)%Z.
Theorem relative_error_FLX : forall x, (x <> 0)%R -> (Rabs (round beta (FLX_exp prec) rnd x - x) < bpow (-prec + 1) * Rabs x)%R.
Theorem relative_error_FLX_ex : forall x, exists eps, (Rabs eps < bpow (-prec + 1))%R /\ round beta (FLX_exp prec) rnd x = (x * (1 + eps))%R.
Theorem relative_error_FLX_round : forall x, (x <> 0)%R -> (Rabs (round beta (FLX_exp prec) rnd x - x) < bpow (-prec + 1) * Rabs (round beta (FLX_exp prec) rnd x))%R.
Theorem relative_error_N_FLX : forall x, (Rabs (round beta (FLX_exp prec) (Znearest choice) x - x) <= /2 * bpow (-prec + 1) * Rabs x)%R.
Theorem relative_error_N_FLX_ex : forall x, exists eps, (Rabs eps <= /2 * bpow (-prec + 1))%R /\ round beta (FLX_exp prec) (Znearest choice) x = (x * (1 + eps))%R.
Theorem relative_error_N_FLX_round : forall x, (Rabs (round beta (FLX_exp prec) (Znearest choice) x - x) <= /2 * bpow (-prec + 1) * Rabs (round beta (FLX_exp prec) (Znearest choice) x))%R.
Theorem generic_format_plus_prec: forall fexp, (forall e, (fexp e <= e - prec)%Z) -> forall x y (fx fy: float beta), (x = F2R fx)%R -> (y = F2R fy)%R -> (Rabs (x+y) < bpow (prec+Fexp fx))%R -> (Rabs (x+y) < bpow (prec+Fexp fy))%R -> generic_format beta fexp (x+y)%R.
Theorem ex_Fexp_canonic: forall fexp, forall x, generic_format beta fexp x -> exists fx:float beta, (x=F2R fx)%R /\ Fexp fx = canonic_exp beta fexp x.
Theorem Rcompare_F2R : forall e m1 m2 : Z, Rcompare (F2R (Float beta m1 e)) (F2R (Float beta m2 e)) = Zcompare m1 m2.
Theorem F2R_le_reg : forall e m1 m2 : Z, (F2R (Float beta m1 e) <= F2R (Float beta m2 e))%R -> (m1 <= m2)%Z.
Theorem F2R_le_compat : forall m1 m2 e : Z, (m1 <= m2)%Z -> (F2R (Float beta m1 e) <= F2R (Float beta m2 e))%R.
Theorem F2R_lt_reg : forall e m1 m2 : Z, (F2R (Float beta m1 e) < F2R (Float beta m2 e))%R -> (m1 < m2)%Z.
Theorem F2R_lt_compat : forall e m1 m2 : Z, (m1 < m2)%Z -> (F2R (Float beta m1 e) < F2R (Float beta m2 e))%R.
Theorem F2R_eq_compat : forall e m1 m2 : Z, (m1 = m2)%Z -> (F2R (Float beta m1 e) = F2R (Float beta m2 e))%R.
Theorem F2R_eq_reg : forall e m1 m2 : Z, F2R (Float beta m1 e) = F2R (Float beta m2 e) -> m1 = m2.
Theorem F2R_Zabs: forall m e : Z, F2R (Float beta (Zabs m) e) = Rabs (F2R (Float beta m e)).
Theorem F2R_Zopp : forall m e : Z, F2R (Float beta (Zopp m) e) = Ropp (F2R (Float beta m e)).
Theorem F2R_0 : forall e : Z, F2R (Float beta 0 e) = 0%R.
Theorem F2R_eq_0_reg : forall m e : Z, F2R (Float beta m e) = 0%R -> m = Z0.
Theorem F2R_ge_0_reg : forall m e : Z, (0 <= F2R (Float beta m e))%R -> (0 <= m)%Z.
Theorem F2R_le_0_reg : forall m e : Z, (F2R (Float beta m e) <= 0)%R -> (m <= 0)%Z.
Theorem F2R_gt_0_reg : forall m e : Z, (0 < F2R (Float beta m e))%R -> (0 < m)%Z.
Theorem F2R_lt_0_reg : forall m e : Z, (F2R (Float beta m e) < 0)%R -> (m < 0)%Z.
Theorem F2R_ge_0_compat : forall f : float beta, (0 <= Fnum f)%Z -> (0 <= F2R f)%R.
Theorem F2R_le_0_compat : forall f : float beta, (Fnum f <= 0)%Z -> (F2R f <= 0)%R.
Theorem F2R_gt_0_compat : forall f : float beta, (0 < Fnum f)%Z -> (0 < F2R f)%R.
Theorem F2R_lt_0_compat : forall f : float beta, (Fnum f < 0)%Z -> (F2R f < 0)%R.
Theorem F2R_neq_0_compat : forall f : float beta, (Fnum f <> 0)%Z -> (F2R f <> 0)%R.
Lemma Fnum_ge_0_compat: forall (f : float beta), (0 <= F2R f)%R -> (0 <= Fnum f)%Z.
Lemma Fnum_le_0_compat: forall (f : float beta), (F2R f <= 0)%R -> (Fnum f <= 0)%Z.
Theorem F2R_bpow : forall e : Z, F2R (Float beta 1 e) = bpow e.
Theorem bpow_le_F2R : forall m e : Z, (0 < m)%Z -> (bpow e <= F2R (Float beta m e))%R.
Theorem F2R_p1_le_bpow : forall m e1 e2 : Z, (0 < m)%Z -> (F2R (Float beta m e1) < bpow e2)%R -> (F2R (Float beta (m + 1) e1) <= bpow e2)%R.
Theorem bpow_le_F2R_m1 : forall m e1 e2 : Z, (1 < m)%Z -> (bpow e2 < F2R (Float beta m e1))%R -> (bpow e2 <= F2R (Float beta (m - 1) e1))%R.
Theorem F2R_lt_bpow : forall f : float beta, forall e', (Zabs (Fnum f) < Zpower beta (e' - Fexp f))%Z -> (Rabs (F2R f) < bpow e')%R.
Theorem F2R_change_exp : forall e' m e : Z, (e' <= e)%Z -> F2R (Float beta m e) = F2R (Float beta (m * Zpower beta (e - e')) e').
Theorem F2R_prec_normalize : forall m e e' p : Z, (Zabs m < Zpower beta p)%Z -> (bpow (e' - 1)%Z <= Rabs (F2R (Float beta m e)))%R -> F2R (Float beta m e) = F2R (Float beta (m * Zpower beta (e - e' + p)) (e' - p)).
Theorem ln_beta_F2R_bounds : forall x m e, (0 < m)%Z -> (F2R (Float beta m e) <= x < F2R (Float beta (m + 1) e))%R -> ln_beta beta x = ln_beta beta (F2R (Float beta m e)) :> Z.
Theorem ln_beta_F2R : forall m e : Z, m <> Z0 -> (ln_beta beta (F2R (Float beta m e)) = ln_beta beta (Z2R m) + e :> Z)%Z.
Theorem float_distribution_pos : forall m1 e1 m2 e2 : Z, (0 < m1)%Z -> (F2R (Float beta m1 e1) < F2R (Float beta m2 e2) < F2R (Float beta (m1 + 1) e1))%R -> (e2 < e1)%Z /\ (e1 + ln_beta beta (Z2R m1) = e2 + ln_beta beta (Z2R m2))%Z.
Theorem F2R_cond_Zopp : forall b m e, F2R (Float beta (cond_Zopp b m) e) = cond_Ropp b (F2R (Float beta m e)).
Lemma Z_le_dec_aux: forall x y : Z, (x <= y)%Z \/ ~ (x <= y)%Z.
Theorem Zdigits_ln_beta : forall n, n <> Z0 -> Zdigits beta n = ln_beta beta (Z2R n).
Theorem ln_beta_F2R_Zdigits : forall m e, m <> Z0 -> (ln_beta beta (F2R (Float beta m e)) = Zdigits beta m + e :> Z)%Z.