(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(************************************************************************)
(*********************************************************)
(** * Basic lemmas for the classical real numbers        *)
(*********************************************************)
Require Export Raxioms.
Require Export ZArithRing.
Require Export RealField.
Local Open Scope Z_scope.
Local Open Scope R_scope.
Implicit Type r : R.
(*********************************************************)
(** ** Relation between orders and equality              *)
(*********************************************************)
(** Reflexivity of the large order *)
Hint Immediate Rle_refl: rorders.
Hint Resolve Rlt_irrefl: real.
Hint Resolve Rlt_dichotomy_converse: real.
(** Reasoning by case on equality and order *)
Hint Resolve Req_dec: real.
(*********************************************************)
(** ** Relating [<], [>], [<=] and [>=]                  *)
(*********************************************************)
(*********************************************************)
(** ** Order                                             *)
(*********************************************************)
(** *** Relating strict and large orders *)
Hint Resolve Rlt_le: real.
Hint Immediate Rle_ge: real.
Hint Resolve Rle_ge: rorders.
Hint Resolve Rge_le: real.
Hint Immediate Rge_le: rorders.
Hint Resolve Rlt_gt: rorders.
Hint Immediate Rgt_lt: rorders.
(**********)
Hint Immediate Rnot_le_lt: real.
Hint Immediate Rlt_not_le: real.
Hint Immediate Req_le: real.
Hint Immediate Req_ge: real.
Hint Immediate Req_le_sym: real.
Hint Immediate Req_ge_sym: real.
(** *** Asymmetry *)
(** Remark: [Rlt_asym] is an axiom *)
Hint Resolve Rle_antisym: real.
(** *** Compatibility with equality *)
(*********************************************************)
(** ** Addition                                          *)
(*********************************************************)
(** Remark: [Rplus_0_l] is an axiom *)
Hint Resolve Rplus_0_r: real.
Hint Resolve Rplus_ne: real.
(**********)
(** Remark: [Rplus_opp_r] is an axiom *)
Hint Resolve Rplus_opp_l: real.
Definition f_equal_R := (f_equal (A:=R)).
Hint Resolve f_equal_R : real.
Hint Resolve Rplus_eq_reg_l: real.
(*********************************************************)
(** ** Multiplication                                    *)
(*********************************************************)
Hint Resolve Rinv_r: real.
Hint Resolve Rinv_l_sym: real.
Hint Resolve Rinv_r_sym: real.
Hint Resolve Rmult_0_r: real.
Hint Resolve Rmult_0_l: real.
Hint Resolve Rmult_ne: real.
Hint Resolve Rmult_1_r: real.
Hint Resolve Rmult_eq_0_compat: real.
Hint Resolve Rmult_integral_contrapositive: real.
(*********************************************************)
(** ** Square function                                   *)
(*********************************************************)
(***********)
Definition Rsqr r : R := r * r.
Notation "r ²" := (Rsqr r) (at level 1, format "r ²") : R_scope.
unfold Rsqr; auto with real.
Qed.
unfold Rsqr; intros; elim (Rmult_integral r r H); trivial.
Qed.
(*********************************************************)
(** ** Opposite                                          *)
(*********************************************************)
Hint Resolve Ropp_eq_compat: real.
Hint Resolve Ropp_0: real.
Hint Resolve Ropp_eq_0_compat: real.
Hint Resolve Ropp_involutive: real.
Hint Resolve Ropp_neq_0_compat: real.
Hint Resolve Ropp_plus_distr: real.
(*********************************************************)
(** ** Opposite and multiplication                       *)
(*********************************************************)
Hint Resolve Ropp_mult_distr_l_reverse: real.
Hint Resolve Rmult_opp_opp: real.
(*********************************************************)
(** ** Subtraction                                       *)
(*********************************************************)
Hint Resolve Rminus_0_r: real.
Hint Resolve Rminus_0_l: real.
Hint Resolve Ropp_minus_distr: real.
Hint Resolve Rminus_diag_eq: real.
Hint Immediate Rminus_diag_uniq: real.
Hint Immediate Rminus_diag_uniq_sym: real.
Hint Resolve Rplus_minus: real.
Hint Resolve Rminus_eq_contra: real.
Hint Resolve Rminus_not_eq: real.
Hint Resolve Rminus_not_eq_right: real.
(*********************************************************)
(** ** Inverse                                           *)
(*********************************************************)
Hint Resolve Rinv_1: real.
Hint Resolve Rinv_neq_0_compat: real.
Hint Resolve Rinv_involutive: real.
Hint Resolve Rinv_r_simpl_l Rinv_r_simpl_r Rinv_r_simpl_m: real.
(*********************************************************)
(** ** Order and addition                                *)
(*********************************************************)
(** *** Compatibility *)
(** Remark: [Rplus_lt_compat_l] is an axiom *)
Hint Resolve Rplus_lt_compat_r: real.

Lemma Rplus_ge_compat_l : forall r r1 r2, r1 >= r2 -> r + r1 >= r + r2.