(*********************************************************)
(** ** Multiplication                                    *)
(*********************************************************)

(* Specifications: *)
Lemma Rmult_eq_compat_l : forall r r1 r2, r1 = r2 -> r * r1 = r * r2.
Lemma Rmult_eq_reg_r : forall r r1 r2, r1 * r = r2 * r -> r <> 0 -> r1 = r2.
Lemma Rmult_plus_distr_r :
forall r1 r2 r3, (r1 + r2) * r3 = r1 * r3 + r2 * r3.
Lemma Rmult_0_r : forall r, r * 0 = 0.
#[global]
Hint Resolve Rmult_0_r: real.
Lemma Rmult_0_l : forall r, 0 * r = 0.
Lemma Rmult_eq_0_compat : forall r1 r2, r1 = 0 \/ r2 = 0 -> r1 * r2 = 0.
Lemma Rmult_integral_contrapositive :
forall r1 r2, r1 <> 0 /\ r2 <> 0 -> r1 * r2 <> 0.
Lemma Ropp_mult_distr_r : forall r1 r2, - (r1 * r2) = r1 * - r2.
#[global]
Hint Resolve Rmult_opp_opp: real.
Lemma Ropp_mult_distr_r_reverse : forall r1 r2, r1 * - r2 = - (r1 * r2).
Lemma Rminus_eq_compat_r : forall r r1 r2, r1 = r2 -> r1 - r = r2 - r.
Lemma Rminus_eq_reg_r : forall r r1 r2, r1 - r = r2 - r -> r1 = r2.
#[global]
Hint Resolve Ropp_minus_distr: real.
Lemma Rminus_diag_eq : forall r1 r2, r1 = r2 -> r1 - r2 = 0.
#[global]
Hint Immediate Rminus_diag_uniq: 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 Rminus_diag_uniq_sym : forall r1 r2, r2 - r1 = 0 -> r1 = r2.
#[global]
Hint Resolve Rplus_minus: real.
Lemma Rminus_eq_contra : forall r1 r2, r1 <> r2 -> r1 - r2 <> 0.
Lemma Rmult_minus_distr_r :
forall r1 r2 r3, (r2 - r3) * r1 = r2 * r1 - r3 * r1.
Lemma Rplus_minus_r : forall r1 r2, r1 + r2 - r2 = r1.
Lemma Rplus_minus_l : forall r1 r2, r1 + r2 - r1 = r2.
Lemma Rminus_plus_distr : forall r1 r2 r3, r1 - (r2 + r3) = (r1 - r2) - r3.
Lemma Rminus_plus_r_r : forall r r1 r2, (r1 + r) - (r2 + r) = r1 - r2.
Lemma Rminus_plus_l_r : forall r r1 r2, (r + r1) - (r2 + r) = r1 - r2.
Lemma Rmult_inv_r_uniq :
forall r1 r2, r1 <> 0 -> r1 * r2 = 1 -> r2 = / r1.
Lemma Rinv_eq_compat : forall r1 r2, r1 = r2 -> / r1 = / r2.
#[global]
Hint Resolve Rinv_1: real.
Lemma Rinv_neq_0_compat : forall r, r <> 0 -> / r <> 0.
#[global]
Hint Resolve Rinv_neq_0_compat: real.
Lemma Rinv_inv r : / / r = r.
#[global]
Hint Resolve Rinv_inv: real.
Lemma Rinv_eq_reg : forall r1 r2, / r1 = / r2 -> r1 = r2.
Lemma Rinv_opp r : / - r = - / r.
Lemma Rmult_inv_m_id_r : forall r1 r2, r1 <> 0 -> r1 * / r1 * r2 = r2.
#[global]
Hint Resolve Rplus_lt_compat_r: real.
Lemma Rplus_gt_compat_r : forall r r1 r2, r1 > r2 -> r1 + r > r2 + r.
Lemma Rplus_ge_compat_l : forall r r1 r2, r1 >= r2 -> r + r1 >= r + r2.
#[global]
Hint Resolve Rplus_le_compat_l Rplus_le_compat_r: real.
Lemma Rplus_ge_compat_r : forall r r1 r2, r1 >= r2 -> r1 + r >= r2 + r.
#[global]
Hint Immediate Rplus_lt_compat: real.
Lemma Rplus_le_compat :
forall r1 r2 r3 r4, r1 <= r2 -> r3 <= r4 -> r1 + r3 <= r2 + r4.