(** *** Sign of inverse *)

(* Specifications: *)
Lemma Rinv_pos : forall r, r > 0 -> / r > 0.
#[global]
Hint Resolve Rlt_minus: real.
Lemma Rgt_minus : forall r1 r2, r1 > r2 -> r1 - r2 > 0.
Lemma Rle_minus : forall r1 r2, r1 <= r2 -> r1 - r2 <= 0.
Lemma Rge_minus : forall r1 r2, r1 >= r2 -> r1 - r2 >= 0.
Lemma Rminus_lt : forall r1 r2, r1 - r2 < 0 -> r1 < r2.
Lemma Rminus_gt : forall r1 r2, r1 - r2 > 0 -> r1 > r2.
Lemma Rlt_minus_0 : forall r1 r2, r1 - r2 < 0 <-> r1 < r2.
Lemma Rlt_0_minus : forall r1 r2, 0 < r2 - r1 <-> r1 < r2.
Lemma Rminus_le : forall r1 r2, r1 - r2 <= 0 -> r1 <= r2.
Lemma Rminus_ge : forall r1 r2, r1 - r2 >= 0 -> r1 >= r2.
Lemma Rgt_minus_pos : forall r1 r2, 0 < r2 -> r1 > r1 - r2.
(*********************************************************)
(** ** Division                                          *)
(*********************************************************)
Lemma Rdiv_def : forall r1 r2, r1 / r2 = r1 * / r2.
Lemma Rdiv_eq_compat_r : forall r r1 r2, r1 = r2 -> r1 / r = r2 / r.
Lemma Rdiv_eq_reg_r : forall r r1 r2, r1 / r = r2 / r -> r <> 0 -> r1 = r2.
Lemma Rdiv_0_l : forall r, 0 / r = 0.
Lemma Rmult_div_r : forall r1 r2, r1 <> 0 -> r1 * r2 / r1 = r2.
Lemma Rdiv_diag_uniq : forall r1 r2, r1 / r2 = 1 -> r1 = r2.
Lemma Rdiv_mult_distr : forall r1 r2 r3, r1 / (r2 * r3) = r1 / r2 / r3.
Lemma Rdiv_mult_l_r :
forall r r1 r2, r <> 0 -> (r * r1) / (r2 * r) = r1 / r2.
Lemma Rdiv_mult_l_l :
forall r r1 r2, r <> 0 -> (r * r1) / (r * r2) = r1 / r2.
Lemma Rdiv_mult_r_l :
forall r r1 r2, r <> 0 -> (r1 * r) / (r * r2) = r1 / r2.
Lemma Ropp_div_distr_l : forall r1 r2, - (r1 / r2) = - r1 / r2.
(* NOTE: keeping inconsistent variable names for backward compatibility. *)
Lemma Rinv_div x y : / (x / y) = y / x.
Lemma Rdiv_opp_l : forall r1 r2, - r1 / r2 = - (r1 / r2).
(*********************************************************)
(** ** Miscellaneous                                     *)
(*********************************************************)
(* This can't be moved to "Order and addition" because of Rlt_0_1 which is proved using a sign rule. *)
(* TODO: We may want to deprecate it but cannot because of the hint used in external libs (the stdlib can already be compiled without it) *)
Lemma Rle_lt_0_plus_1 : forall r, 0 <= r -> 0 < r + 1.
#[global]
Hint Resolve Rle_lt_0_plus_1: real.
(* TODO: We may want to deprecate it but cannot because of the hint used in external libs (the stdlib can already be compiled without it) *)
Lemma Rlt_plus_1 : forall r, r < r + 1.
#[global]
Hint Resolve Rlt_plus_1: real.
Lemma Rlt_0_2 : 0 < 2.
Lemma Rplus_diag : forall r, r + r = 2 * r.
Lemma Rplus_half_diag : forall r, r / 2 + r / 2 = r.
Lemma Rlt_half_plus : forall r1 r2, r1 < r2 -> r1 < (r1 + r2) / 2 < r2.
Lemma Rle_half_plus : forall r1 r2, r1 <= r2 -> r1 <= (r1 + r2) / 2 <= r2.
Lemma Rexists_between : forall r1 r2, r1 < r2 -> exists r, r1 < r < r2.
Lemma Rle_plus_epsilon :
forall r1 r2, (forall eps:R, 0 < eps -> r1 <= r2 + eps) -> r1 <= r2.
(** Remark : a sigma-type version, called [completeness] is in [Raxioms.v] *)
Lemma upper_bound_thm :
forall E : R -> Prop,
bound E -> (exists x : R, E x) ->  exists m : R, is_lub E m.