(** Definition and basic properties about the ulp *)
(** Now includes a nice ulp(0): ulp(0) is now 0 when there is no minimal exponent, such as in FLX, and beta^(fexp n) when there is a n such that n <= fexp n. For instance, the value of ulp(O) is then beta^emin in FIX and FLT. The main lemma to use is ulp_neq_0 that is equivalent to the previous "unfold ulp" provided the value is not zero. *)

(* Specifications: *)
Lemma ulp_neq_0 : forall x:R, (x <> 0)%R -> ulp x = bpow (canonic_exp beta fexp x).
Notation F := (generic_format beta fexp).
Theorem ulp_opp :
forall x, ulp (- x) = ulp x.
Theorem ulp_abs :
forall x, ulp (Rabs x) = ulp x.
Theorem ulp_ge_0:
forall x, (0 <= ulp x)%R.
Theorem ulp_le_id:
forall x,
(0 < x)%R ->
F x ->
(ulp x <= x)%R.
Theorem ulp_le_abs:
forall x,
(x <> 0)%R ->
F x ->
(ulp x <= Rabs x)%R.
(* was ulp_DN_UP *)
Theorem round_UP_DN_ulp :
forall x, ~ F x ->
round beta fexp Zceil x = (round beta fexp Zfloor x + ulp x)%R.
Theorem ulp_bpow :
forall e, ulp (bpow e) = bpow (fexp (e + 1)).
Lemma generic_format_ulp_0:
F (ulp 0).
Lemma generic_format_bpow_ge_ulp_0:  forall e,
(ulp 0 <= bpow e)%R -> F (bpow e).