diff options
author | 2012-08-20 18:27:02 +0200 | |
---|---|---|
committer | 2012-08-20 18:27:02 +0200 | |
commit | 595aa062e10b8d7100ec2ad9b766f9e624e47295 (patch) | |
tree | 963f9c948173de70209cba5828b372f184afc306 /theories/Reals | |
parent | ab08ae9f0f944d9f801c44e4ffd3e6b7fcf4b024 (diff) | |
parent | e0d682ec25282a348d35c5b169abafec48555690 (diff) |
Merge tag 'upstream/8.4dfsg' into experimental/master
Upstream version 8.4dfsg
Diffstat (limited to 'theories/Reals')
64 files changed, 9663 insertions, 6504 deletions
diff --git a/theories/Reals/Alembert.v b/theories/Reals/Alembert.v index 18612a68..13b33301 100644 --- a/theories/Reals/Alembert.v +++ b/theories/Reals/Alembert.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -13,7 +13,7 @@ Require Import SeqProp. Require Import PartSum. Require Import Max. -Open Local Scope R_scope. +Local Open Scope R_scope. (***************************************************) (* Various versions of the criterion of D'Alembert *) @@ -31,23 +31,23 @@ Proof. { l:R | Un_cv (fun N:nat => sum_f_R0 An N) l }). intro X; apply X. apply completeness. - unfold Un_cv in H0; unfold bound in |- *; cut (0 < / 2); + unfold Un_cv in H0; unfold bound; cut (0 < / 2); [ intro | apply Rinv_0_lt_compat; prove_sup0 ]. elim (H0 (/ 2) H1); intros. exists (sum_f_R0 An x + 2 * An (S x)). - unfold is_upper_bound in |- *; intros; unfold EUn in H3; elim H3; intros. + unfold is_upper_bound; intros; unfold EUn in H3; elim H3; intros. rewrite H4; assert (H5 := lt_eq_lt_dec x1 x). elim H5; intros. elim a; intro. replace (sum_f_R0 An x) with (sum_f_R0 An x1 + sum_f_R0 (fun i:nat => An (S x1 + i)%nat) (x - S x1)). - pattern (sum_f_R0 An x1) at 1 in |- *; rewrite <- Rplus_0_r; + pattern (sum_f_R0 An x1) at 1; rewrite <- Rplus_0_r; rewrite Rplus_assoc; apply Rplus_le_compat_l. left; apply Rplus_lt_0_compat. apply tech1; intros; apply H. apply Rmult_lt_0_compat; [ prove_sup0 | apply H ]. - symmetry in |- *; apply tech2; assumption. - rewrite b; pattern (sum_f_R0 An x) at 1 in |- *; rewrite <- Rplus_0_r; + symmetry ; apply tech2; assumption. + rewrite b; pattern (sum_f_R0 An x) at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l. left; apply Rmult_lt_0_compat; [ prove_sup0 | apply H ]. replace (sum_f_R0 An x1) with @@ -64,14 +64,14 @@ Proof. left; apply H. rewrite tech3. replace (1 - / 2) with (/ 2). - unfold Rdiv in |- *; rewrite Rinv_involutive. - pattern 2 at 3 in |- *; rewrite <- Rmult_1_r; rewrite <- (Rmult_comm 2); + unfold Rdiv; rewrite Rinv_involutive. + pattern 2 at 3; rewrite <- Rmult_1_r; rewrite <- (Rmult_comm 2); apply Rmult_le_compat_l. left; prove_sup0. left; apply Rplus_lt_reg_r with ((/ 2) ^ S (x1 - S x)). replace ((/ 2) ^ S (x1 - S x) + (1 - (/ 2) ^ S (x1 - S x))) with 1; [ idtac | ring ]. - rewrite <- (Rplus_comm 1); pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; + rewrite <- (Rplus_comm 1); pattern 1 at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l. apply pow_lt; apply Rinv_0_lt_compat; prove_sup0. discrR. @@ -80,14 +80,14 @@ Proof. ring. discrR. discrR. - pattern 1 at 3 in |- *; replace 1 with (/ 1); + pattern 1 at 3; replace 1 with (/ 1); [ apply tech7; discrR | apply Rinv_1 ]. replace (An (S x)) with (An (S x + 0)%nat). apply (tech6 (fun i:nat => An (S x + i)%nat) (/ 2)). left; apply Rinv_0_lt_compat; prove_sup0. intro; cut (forall n:nat, (n >= x)%nat -> An (S n) < / 2 * An n). intro; replace (S x + S i)%nat with (S (S x + i)). - apply H6; unfold ge in |- *; apply tech8. + apply H6; unfold ge; apply tech8. apply INR_eq; rewrite S_INR; do 2 rewrite plus_INR; do 2 rewrite S_INR; ring. intros; unfold R_dist in H2; apply Rmult_lt_reg_l with (/ An n). apply Rinv_0_lt_compat; apply H. @@ -96,20 +96,20 @@ Proof. rewrite Rmult_1_r; replace (An (S n) * / An n) with (Rabs (Rabs (An (S n) / An n) - 0)). apply H2; assumption. - unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; + unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite Rabs_Rabsolu; rewrite Rabs_right. - unfold Rdiv in |- *; reflexivity. - left; unfold Rdiv in |- *; change (0 < An (S n) * / An n) in |- *; + unfold Rdiv; reflexivity. + left; unfold Rdiv; change (0 < An (S n) * / An n); apply Rmult_lt_0_compat; [ apply H | apply Rinv_0_lt_compat; apply H ]. - red in |- *; intro; assert (H8 := H n); rewrite H7 in H8; + red; intro; assert (H8 := H n); rewrite H7 in H8; elim (Rlt_irrefl _ H8). replace (S x + 0)%nat with (S x); [ reflexivity | ring ]. - symmetry in |- *; apply tech2; assumption. - exists (sum_f_R0 An 0); unfold EUn in |- *; exists 0%nat; reflexivity. + symmetry ; apply tech2; assumption. + exists (sum_f_R0 An 0); unfold EUn; exists 0%nat; reflexivity. intro X; elim X; intros. exists x; apply Un_cv_crit_lub; - [ unfold Un_growing in |- *; intro; rewrite tech5; - pattern (sum_f_R0 An n) at 1 in |- *; rewrite <- Rplus_0_r; + [ unfold Un_growing; intro; rewrite tech5; + pattern (sum_f_R0 An n) at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; apply H | apply p ]. Defined. @@ -131,14 +131,14 @@ Proof. assert (H6 := Alembert_C1 Wn H2 H4). elim H5; intros. elim H6; intros. - exists (x - x0); unfold Un_cv in |- *; unfold Un_cv in p; + exists (x - x0); unfold Un_cv; unfold Un_cv in p; unfold Un_cv in p0; intros; cut (0 < eps / 2). intro; elim (p (eps / 2) H8); clear p; intros. elim (p0 (eps / 2) H8); clear p0; intros. set (N := max x1 x2). exists N; intros; replace (sum_f_R0 An n) with (sum_f_R0 Vn n - sum_f_R0 Wn n). - unfold R_dist in |- *; + unfold R_dist; replace (sum_f_R0 Vn n - sum_f_R0 Wn n - (x - x0)) with (sum_f_R0 Vn n - x + - (sum_f_R0 Wn n - x0)); [ idtac | ring ]; apply Rle_lt_trans with @@ -146,29 +146,29 @@ Proof. apply Rabs_triang. rewrite Rabs_Ropp; apply Rlt_le_trans with (eps / 2 + eps / 2). apply Rplus_lt_compat. - unfold R_dist in H9; apply H9; unfold ge in |- *; apply le_trans with N; - [ unfold N in |- *; apply le_max_l | assumption ]. - unfold R_dist in H10; apply H10; unfold ge in |- *; apply le_trans with N; - [ unfold N in |- *; apply le_max_r | assumption ]. - right; symmetry in |- *; apply double_var. - symmetry in |- *; apply tech11; intro; unfold Vn, Wn in |- *; - unfold Rdiv in |- *; do 2 rewrite <- (Rmult_comm (/ 2)); + unfold R_dist in H9; apply H9; unfold ge; apply le_trans with N; + [ unfold N; apply le_max_l | assumption ]. + unfold R_dist in H10; apply H10; unfold ge; apply le_trans with N; + [ unfold N; apply le_max_r | assumption ]. + right; symmetry ; apply double_var. + symmetry ; apply tech11; intro; unfold Vn, Wn; + unfold Rdiv; do 2 rewrite <- (Rmult_comm (/ 2)); apply Rmult_eq_reg_l with 2. rewrite Rmult_minus_distr_l; repeat rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. ring. discrR. discrR. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. cut (forall n:nat, / 2 * Rabs (An n) <= Wn n <= 3 * / 2 * Rabs (An n)). intro; cut (forall n:nat, / Wn n <= 2 * / Rabs (An n)). intro; cut (forall n:nat, Wn (S n) / Wn n <= 3 * Rabs (An (S n) / An n)). - intro; unfold Un_cv in |- *; intros; unfold Un_cv in H0; cut (0 < eps / 3). + intro; unfold Un_cv; intros; unfold Un_cv in H0; cut (0 < eps / 3). intro; elim (H0 (eps / 3) H8); intros. exists x; intros. assert (H11 := H9 n H10). - unfold R_dist in |- *; unfold Rminus in |- *; rewrite Ropp_0; + unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite Rabs_Rabsolu; unfold R_dist in H11; unfold Rminus in H11; rewrite Ropp_0 in H11; rewrite Rplus_0_r in H11; rewrite Rabs_Rabsolu in H11; rewrite Rabs_right. @@ -179,13 +179,13 @@ Proof. rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym; [ idtac | discrR ]; rewrite Rmult_1_l; rewrite <- (Rmult_comm eps); unfold Rdiv in H11; exact H11. - left; change (0 < Wn (S n) / Wn n) in |- *; unfold Rdiv in |- *; + left; change (0 < Wn (S n) / Wn n); unfold Rdiv; apply Rmult_lt_0_compat. apply H2. apply Rinv_0_lt_compat; apply H2. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. - intro; unfold Rdiv in |- *; rewrite Rabs_mult; rewrite <- Rmult_assoc; + intro; unfold Rdiv; rewrite Rabs_mult; rewrite <- Rmult_assoc; replace 3 with (2 * (3 * / 2)); [ idtac | rewrite <- Rmult_assoc; apply Rinv_r_simpl_m; discrR ]; apply Rle_trans with (Wn (S n) * 2 * / Rabs (An n)). @@ -218,32 +218,32 @@ Proof. rewrite Rmult_1_l; elim (H4 n); intros; assumption. discrR. apply Rabs_no_R0; apply H. - red in |- *; intro; assert (H6 := H2 n); rewrite H5 in H6; + red; intro; assert (H6 := H2 n); rewrite H5 in H6; elim (Rlt_irrefl _ H6). intro; split. - unfold Wn in |- *; unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); + unfold Wn; unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; prove_sup0. - pattern (Rabs (An n)) at 1 in |- *; rewrite <- Rplus_0_r; rewrite double; - unfold Rminus in |- *; rewrite Rplus_assoc; apply Rplus_le_compat_l. + pattern (Rabs (An n)) at 1; rewrite <- Rplus_0_r; rewrite double; + unfold Rminus; rewrite Rplus_assoc; apply Rplus_le_compat_l. apply Rplus_le_reg_l with (An n). rewrite Rplus_0_r; rewrite (Rplus_comm (An n)); rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; apply RRle_abs. - unfold Wn in |- *; unfold Rdiv in |- *; repeat rewrite <- (Rmult_comm (/ 2)); + unfold Wn; unfold Rdiv; repeat rewrite <- (Rmult_comm (/ 2)); repeat rewrite Rmult_assoc; apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; prove_sup0. - unfold Rminus in |- *; rewrite double; + unfold Rminus; rewrite double; replace (3 * Rabs (An n)) with (Rabs (An n) + Rabs (An n) + Rabs (An n)); [ idtac | ring ]; repeat rewrite Rplus_assoc; repeat apply Rplus_le_compat_l. rewrite <- Rabs_Ropp; apply RRle_abs. cut (forall n:nat, / 2 * Rabs (An n) <= Vn n <= 3 * / 2 * Rabs (An n)). intro; cut (forall n:nat, / Vn n <= 2 * / Rabs (An n)). intro; cut (forall n:nat, Vn (S n) / Vn n <= 3 * Rabs (An (S n) / An n)). - intro; unfold Un_cv in |- *; intros; unfold Un_cv in H1; cut (0 < eps / 3). + intro; unfold Un_cv; intros; unfold Un_cv in H1; cut (0 < eps / 3). intro; elim (H0 (eps / 3) H7); intros. exists x; intros. assert (H10 := H8 n H9). - unfold R_dist in |- *; unfold Rminus in |- *; rewrite Ropp_0; + unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite Rabs_Rabsolu; unfold R_dist in H10; unfold Rminus in H10; rewrite Ropp_0 in H10; rewrite Rplus_0_r in H10; rewrite Rabs_Rabsolu in H10; rewrite Rabs_right. @@ -254,13 +254,13 @@ Proof. rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym; [ idtac | discrR ]; rewrite Rmult_1_l; rewrite <- (Rmult_comm eps); unfold Rdiv in H10; exact H10. - left; change (0 < Vn (S n) / Vn n) in |- *; unfold Rdiv in |- *; + left; change (0 < Vn (S n) / Vn n); unfold Rdiv; apply Rmult_lt_0_compat. apply H1. apply Rinv_0_lt_compat; apply H1. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. - intro; unfold Rdiv in |- *; rewrite Rabs_mult; rewrite <- Rmult_assoc; + intro; unfold Rdiv; rewrite Rabs_mult; rewrite <- Rmult_assoc; replace 3 with (2 * (3 * / 2)); [ idtac | rewrite <- Rmult_assoc; apply Rinv_r_simpl_m; discrR ]; apply Rle_trans with (Vn (S n) * 2 * / Rabs (An n)). @@ -293,44 +293,44 @@ Proof. rewrite Rmult_1_l; elim (H3 n); intros; assumption. discrR. apply Rabs_no_R0; apply H. - red in |- *; intro; assert (H5 := H1 n); rewrite H4 in H5; + red; intro; assert (H5 := H1 n); rewrite H4 in H5; elim (Rlt_irrefl _ H5). intro; split. - unfold Vn in |- *; unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); + unfold Vn; unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; prove_sup0. - pattern (Rabs (An n)) at 1 in |- *; rewrite <- Rplus_0_r; rewrite double; + pattern (Rabs (An n)) at 1; rewrite <- Rplus_0_r; rewrite double; rewrite Rplus_assoc; apply Rplus_le_compat_l. apply Rplus_le_reg_l with (- An n); rewrite Rplus_0_r; rewrite <- (Rplus_comm (An n)); rewrite <- Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_l; rewrite <- Rabs_Ropp; apply RRle_abs. - unfold Vn in |- *; unfold Rdiv in |- *; repeat rewrite <- (Rmult_comm (/ 2)); + unfold Vn; unfold Rdiv; repeat rewrite <- (Rmult_comm (/ 2)); repeat rewrite Rmult_assoc; apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; prove_sup0. - unfold Rminus in |- *; rewrite double; + unfold Rminus; rewrite double; replace (3 * Rabs (An n)) with (Rabs (An n) + Rabs (An n) + Rabs (An n)); [ idtac | ring ]; repeat rewrite Rplus_assoc; repeat apply Rplus_le_compat_l; apply RRle_abs. - intro; unfold Wn in |- *; unfold Rdiv in |- *; rewrite <- (Rmult_0_r (/ 2)); + intro; unfold Wn; unfold Rdiv; rewrite <- (Rmult_0_r (/ 2)); rewrite <- (Rmult_comm (/ 2)); apply Rmult_lt_compat_l. apply Rinv_0_lt_compat; prove_sup0. - apply Rplus_lt_reg_r with (An n); rewrite Rplus_0_r; unfold Rminus in |- *; + apply Rplus_lt_reg_r with (An n); rewrite Rplus_0_r; unfold Rminus; rewrite (Rplus_comm (An n)); rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; apply Rle_lt_trans with (Rabs (An n)). apply RRle_abs. - rewrite double; pattern (Rabs (An n)) at 1 in |- *; rewrite <- Rplus_0_r; + rewrite double; pattern (Rabs (An n)) at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; apply Rabs_pos_lt; apply H. - intro; unfold Vn in |- *; unfold Rdiv in |- *; rewrite <- (Rmult_0_r (/ 2)); + intro; unfold Vn; unfold Rdiv; rewrite <- (Rmult_0_r (/ 2)); rewrite <- (Rmult_comm (/ 2)); apply Rmult_lt_compat_l. apply Rinv_0_lt_compat; prove_sup0. - apply Rplus_lt_reg_r with (- An n); rewrite Rplus_0_r; unfold Rminus in |- *; + apply Rplus_lt_reg_r with (- An n); rewrite Rplus_0_r; unfold Rminus; rewrite (Rplus_comm (- An n)); rewrite Rplus_assoc; rewrite Rplus_opp_r; rewrite Rplus_0_r; apply Rle_lt_trans with (Rabs (An n)). rewrite <- Rabs_Ropp; apply RRle_abs. - rewrite double; pattern (Rabs (An n)) at 1 in |- *; rewrite <- Rplus_0_r; + rewrite double; pattern (Rabs (An n)) at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; apply Rabs_pos_lt; apply H. Defined. @@ -347,11 +347,11 @@ Proof. intro; assert (H4 := Alembert_C2 Bn H2 H3). elim H4; intros. exists x0; unfold Bn in p; apply tech12; assumption. - unfold Un_cv in |- *; intros; unfold Un_cv in H1; cut (0 < eps / Rabs x). + unfold Un_cv; intros; unfold Un_cv in H1; cut (0 < eps / Rabs x). intro; elim (H1 (eps / Rabs x) H4); intros. - exists x0; intros; unfold R_dist in |- *; unfold Rminus in |- *; + exists x0; intros; unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite Rabs_Rabsolu; - unfold Bn in |- *; + unfold Bn; replace (An (S n) * x ^ S n / (An n * x ^ n)) with (An (S n) / An n * x). rewrite Rabs_mult; apply Rmult_lt_reg_l with (/ Rabs x). apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption. @@ -360,22 +360,22 @@ Proof. rewrite Rmult_1_l; rewrite <- (Rmult_comm eps); unfold Rdiv in H5; replace (Rabs (An (S n) / An n)) with (R_dist (Rabs (An (S n) * / An n)) 0). apply H5; assumption. - unfold R_dist in |- *; unfold Rminus in |- *; rewrite Ropp_0; - rewrite Rplus_0_r; rewrite Rabs_Rabsolu; unfold Rdiv in |- *; + unfold R_dist; unfold Rminus; rewrite Ropp_0; + rewrite Rplus_0_r; rewrite Rabs_Rabsolu; unfold Rdiv; reflexivity. apply Rabs_no_R0; assumption. replace (S n) with (n + 1)%nat; [ idtac | ring ]; rewrite pow_add; - unfold Rdiv in |- *; rewrite Rinv_mult_distr. + unfold Rdiv; rewrite Rinv_mult_distr. replace (An (n + 1)%nat * (x ^ n * x ^ 1) * (/ An n * / x ^ n)) with (An (n + 1)%nat * x ^ 1 * / An n * (x ^ n * / x ^ n)); [ idtac | ring ]; rewrite <- Rinv_r_sym. - simpl in |- *; ring. + simpl; ring. apply pow_nonzero; assumption. apply H0. apply pow_nonzero; assumption. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption ]. - intro; unfold Bn in |- *; apply prod_neq_R0; + intro; unfold Bn; apply prod_neq_R0; [ apply H0 | apply pow_nonzero; assumption ]. Defined. @@ -383,14 +383,14 @@ Lemma AlembertC3_step2 : forall (An:nat -> R) (x:R), x = 0 -> { l:R | Pser An x l }. Proof. intros; exists (An 0%nat). - unfold Pser in |- *; unfold infinite_sum in |- *; intros; exists 0%nat; intros; + unfold Pser; unfold infinite_sum; intros; exists 0%nat; intros; replace (sum_f_R0 (fun n0:nat => An n0 * x ^ n0) n) with (An 0%nat). - unfold R_dist in |- *; unfold Rminus in |- *; rewrite Rplus_opp_r; + unfold R_dist; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. induction n as [| n Hrecn]. - simpl in |- *; ring. + simpl; ring. rewrite tech5; rewrite Hrecn; - [ rewrite H; simpl in |- *; ring | unfold ge in |- *; apply le_O_n ]. + [ rewrite H; simpl; ring | unfold ge; apply le_O_n ]. Qed. (** A useful criterion of convergence for power series *) @@ -404,11 +404,11 @@ Proof. elim s; intro. cut (x <> 0). intro; apply AlembertC3_step1; assumption. - red in |- *; intro; rewrite H1 in a; elim (Rlt_irrefl _ a). + red; intro; rewrite H1 in a; elim (Rlt_irrefl _ a). apply AlembertC3_step2; assumption. cut (x <> 0). intro; apply AlembertC3_step1; assumption. - red in |- *; intro; rewrite H1 in r; elim (Rlt_irrefl _ r). + red; intro; rewrite H1 in r; elim (Rlt_irrefl _ r). Defined. Lemma Alembert_C4 : @@ -428,8 +428,8 @@ Proof. elim H1; intros. elim H2; intros. elim H4; intros. - unfold bound in |- *; exists (sum_f_R0 An x0 + / (1 - x) * An (S x0)). - unfold is_upper_bound in |- *; intros; unfold EUn in H6. + unfold bound; exists (sum_f_R0 An x0 + / (1 - x) * An (S x0)). + unfold is_upper_bound; intros; unfold EUn in H6. elim H6; intros. rewrite H7. assert (H8 := lt_eq_lt_dec x2 x0). @@ -437,7 +437,7 @@ Proof. elim a; intro. replace (sum_f_R0 An x0) with (sum_f_R0 An x2 + sum_f_R0 (fun i:nat => An (S x2 + i)%nat) (x0 - S x2)). - pattern (sum_f_R0 An x2) at 1 in |- *; rewrite <- Rplus_0_r. + pattern (sum_f_R0 An x2) at 1; rewrite <- Rplus_0_r. rewrite Rplus_assoc; apply Rplus_le_compat_l. left; apply Rplus_lt_0_compat. apply tech1. @@ -446,8 +446,8 @@ Proof. apply Rinv_0_lt_compat; apply Rplus_lt_reg_r with x; rewrite Rplus_0_r; replace (x + (1 - x)) with 1; [ elim H3; intros; assumption | ring ]. apply H. - symmetry in |- *; apply tech2; assumption. - rewrite b; pattern (sum_f_R0 An x0) at 1 in |- *; rewrite <- Rplus_0_r; + symmetry ; apply tech2; assumption. + rewrite b; pattern (sum_f_R0 An x0) at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l. left; apply Rmult_lt_0_compat. apply Rinv_0_lt_compat; apply Rplus_lt_reg_r with x; rewrite Rplus_0_r; @@ -465,7 +465,7 @@ Proof. rewrite <- (Rmult_comm (An (S x0))); apply Rmult_le_compat_l. left; apply H. rewrite tech3. - unfold Rdiv in |- *; apply Rmult_le_reg_l with (1 - x). + unfold Rdiv; apply Rmult_le_reg_l with (1 - x). apply Rplus_lt_reg_r with x; rewrite Rplus_0_r. replace (x + (1 - x)) with 1; [ elim H3; intros; assumption | ring ]. do 2 rewrite (Rmult_comm (1 - x)). @@ -473,17 +473,17 @@ Proof. rewrite Rmult_1_r; apply Rplus_le_reg_l with (x ^ S (x2 - S x0)). replace (x ^ S (x2 - S x0) + (1 - x ^ S (x2 - S x0))) with 1; [ idtac | ring ]. - rewrite <- (Rplus_comm 1); pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; + rewrite <- (Rplus_comm 1); pattern 1 at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l. left; apply pow_lt. apply Rle_lt_trans with k. elim Hyp; intros; assumption. elim H3; intros; assumption. apply Rminus_eq_contra. - red in |- *; intro. + red; intro. elim H3; intros. rewrite H10 in H12; elim (Rlt_irrefl _ H12). - red in |- *; intro. + red; intro. elim H3; intros. rewrite H10 in H12; elim (Rlt_irrefl _ H12). replace (An (S x0)) with (An (S x0 + 0)%nat). @@ -496,7 +496,7 @@ Proof. intro. replace (S x0 + S i)%nat with (S (S x0 + i)). apply H9. - unfold ge in |- *. + unfold ge. apply tech8. apply INR_eq; rewrite S_INR; do 2 rewrite plus_INR; do 2 rewrite S_INR; ring. @@ -510,21 +510,21 @@ Proof. replace (An (S n) * / An n) with (Rabs (An (S n) / An n)). apply H5; assumption. rewrite Rabs_right. - unfold Rdiv in |- *; reflexivity. - left; unfold Rdiv in |- *; change (0 < An (S n) * / An n) in |- *; + unfold Rdiv; reflexivity. + left; unfold Rdiv; change (0 < An (S n) * / An n); apply Rmult_lt_0_compat. apply H. apply Rinv_0_lt_compat; apply H. - red in |- *; intro. + red; intro. assert (H11 := H n). rewrite H10 in H11; elim (Rlt_irrefl _ H11). replace (S x0 + 0)%nat with (S x0); [ reflexivity | ring ]. - symmetry in |- *; apply tech2; assumption. - exists (sum_f_R0 An 0); unfold EUn in |- *; exists 0%nat; reflexivity. + symmetry ; apply tech2; assumption. + exists (sum_f_R0 An 0); unfold EUn; exists 0%nat; reflexivity. intro X; elim X; intros. exists x; apply Un_cv_crit_lub; - [ unfold Un_growing in |- *; intro; rewrite tech5; - pattern (sum_f_R0 An n) at 1 in |- *; rewrite <- Rplus_0_r; + [ unfold Un_growing; intro; rewrite tech5; + pattern (sum_f_R0 An n) at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; apply H | apply p ]. Qed. @@ -551,9 +551,9 @@ Proof. apply (Alembert_C4 (fun i:nat => Rabs (An i)) k). assumption. intro; apply Rabs_pos_lt; apply H0. - unfold Un_cv in |- *. + unfold Un_cv. unfold Un_cv in H1. - unfold Rdiv in |- *. + unfold Rdiv. intros. elim (H1 eps H2); intros. exists x; intros. @@ -590,22 +590,22 @@ Lemma Alembert_C6 : elim s; intro. eapply Alembert_C5 with (k * Rabs x). split. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Rdiv; apply Rmult_le_pos. left; assumption. left; apply Rabs_pos_lt. - red in |- *; intro; rewrite H3 in a; elim (Rlt_irrefl _ a). + red; intro; rewrite H3 in a; elim (Rlt_irrefl _ a). apply Rmult_lt_reg_l with (/ k). apply Rinv_0_lt_compat; assumption. rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. rewrite Rmult_1_r; assumption. - red in |- *; intro; rewrite H3 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H3 in H; elim (Rlt_irrefl _ H). intro; apply prod_neq_R0. apply H0. apply pow_nonzero. - red in |- *; intro; rewrite H3 in a; elim (Rlt_irrefl _ a). - unfold Un_cv in |- *; unfold Un_cv in H1. + red; intro; rewrite H3 in a; elim (Rlt_irrefl _ a). + unfold Un_cv; unfold Un_cv in H1. intros. cut (0 < eps / Rabs x). intro. @@ -613,7 +613,7 @@ Lemma Alembert_C6 : exists x0. intros. replace (An (S n) * x ^ S n / (An n * x ^ n)) with (An (S n) / An n * x). - unfold R_dist in |- *. + unfold R_dist. rewrite Rabs_mult. replace (Rabs (An (S n) / An n) * Rabs x - k * Rabs x) with (Rabs x * (Rabs (An (S n) / An n) - k)); [ idtac | ring ]. @@ -621,18 +621,18 @@ Lemma Alembert_C6 : rewrite Rabs_Rabsolu. apply Rmult_lt_reg_l with (/ Rabs x). apply Rinv_0_lt_compat; apply Rabs_pos_lt. - red in |- *; intro; rewrite H7 in a; elim (Rlt_irrefl _ a). + red; intro; rewrite H7 in a; elim (Rlt_irrefl _ a). rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. rewrite <- (Rmult_comm eps). unfold R_dist in H5. - unfold Rdiv in |- *; unfold Rdiv in H5; apply H5; assumption. + unfold Rdiv; unfold Rdiv in H5; apply H5; assumption. apply Rabs_no_R0. - red in |- *; intro; rewrite H7 in a; elim (Rlt_irrefl _ a). - unfold Rdiv in |- *; replace (S n) with (n + 1)%nat; [ idtac | ring ]. + red; intro; rewrite H7 in a; elim (Rlt_irrefl _ a). + unfold Rdiv; replace (S n) with (n + 1)%nat; [ idtac | ring ]. rewrite pow_add. - simpl in |- *. + simpl. rewrite Rmult_1_r. rewrite Rinv_mult_distr. replace (An (n + 1)%nat * (x ^ n * x) * (/ An n * / x ^ n)) with @@ -641,46 +641,46 @@ Lemma Alembert_C6 : rewrite <- Rinv_r_sym. rewrite Rmult_1_r; reflexivity. apply pow_nonzero. - red in |- *; intro; rewrite H7 in a; elim (Rlt_irrefl _ a). + red; intro; rewrite H7 in a; elim (Rlt_irrefl _ a). apply H0. apply pow_nonzero. - red in |- *; intro; rewrite H7 in a; elim (Rlt_irrefl _ a). - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + red; intro; rewrite H7 in a; elim (Rlt_irrefl _ a). + unfold Rdiv; apply Rmult_lt_0_compat. assumption. apply Rinv_0_lt_compat; apply Rabs_pos_lt. - red in |- *; intro H7; rewrite H7 in a; elim (Rlt_irrefl _ a). + red; intro H7; rewrite H7 in a; elim (Rlt_irrefl _ a). exists (An 0%nat). - unfold Un_cv in |- *. + unfold Un_cv. intros. exists 0%nat. intros. - unfold R_dist in |- *. + unfold R_dist. replace (sum_f_R0 (fun i:nat => An i * x ^ i) n) with (An 0%nat). - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. induction n as [| n Hrecn]. - simpl in |- *; ring. + simpl; ring. rewrite tech5. rewrite <- Hrecn. - rewrite b; simpl in |- *; ring. - unfold ge in |- *; apply le_O_n. + rewrite b; simpl; ring. + unfold ge; apply le_O_n. eapply Alembert_C5 with (k * Rabs x). split. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Rdiv; apply Rmult_le_pos. left; assumption. left; apply Rabs_pos_lt. - red in |- *; intro; rewrite H3 in r; elim (Rlt_irrefl _ r). + red; intro; rewrite H3 in r; elim (Rlt_irrefl _ r). apply Rmult_lt_reg_l with (/ k). apply Rinv_0_lt_compat; assumption. rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. rewrite Rmult_1_r; assumption. - red in |- *; intro; rewrite H3 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H3 in H; elim (Rlt_irrefl _ H). intro; apply prod_neq_R0. apply H0. apply pow_nonzero. - red in |- *; intro; rewrite H3 in r; elim (Rlt_irrefl _ r). - unfold Un_cv in |- *; unfold Un_cv in H1. + red; intro; rewrite H3 in r; elim (Rlt_irrefl _ r). + unfold Un_cv; unfold Un_cv in H1. intros. cut (0 < eps / Rabs x). intro. @@ -688,7 +688,7 @@ Lemma Alembert_C6 : exists x0. intros. replace (An (S n) * x ^ S n / (An n * x ^ n)) with (An (S n) / An n * x). - unfold R_dist in |- *. + unfold R_dist. rewrite Rabs_mult. replace (Rabs (An (S n) / An n) * Rabs x - k * Rabs x) with (Rabs x * (Rabs (An (S n) / An n) - k)); [ idtac | ring ]. @@ -696,18 +696,18 @@ Lemma Alembert_C6 : rewrite Rabs_Rabsolu. apply Rmult_lt_reg_l with (/ Rabs x). apply Rinv_0_lt_compat; apply Rabs_pos_lt. - red in |- *; intro; rewrite H7 in r; elim (Rlt_irrefl _ r). + red; intro; rewrite H7 in r; elim (Rlt_irrefl _ r). rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. rewrite <- (Rmult_comm eps). unfold R_dist in H5. - unfold Rdiv in |- *; unfold Rdiv in H5; apply H5; assumption. + unfold Rdiv; unfold Rdiv in H5; apply H5; assumption. apply Rabs_no_R0. - red in |- *; intro; rewrite H7 in r; elim (Rlt_irrefl _ r). - unfold Rdiv in |- *; replace (S n) with (n + 1)%nat; [ idtac | ring ]. + red; intro; rewrite H7 in r; elim (Rlt_irrefl _ r). + unfold Rdiv; replace (S n) with (n + 1)%nat; [ idtac | ring ]. rewrite pow_add. - simpl in |- *. + simpl. rewrite Rmult_1_r. rewrite Rinv_mult_distr. replace (An (n + 1)%nat * (x ^ n * x) * (/ An n * / x ^ n)) with @@ -716,12 +716,12 @@ Lemma Alembert_C6 : rewrite <- Rinv_r_sym. rewrite Rmult_1_r; reflexivity. apply pow_nonzero. - red in |- *; intro; rewrite H7 in r; elim (Rlt_irrefl _ r). + red; intro; rewrite H7 in r; elim (Rlt_irrefl _ r). apply H0. apply pow_nonzero. - red in |- *; intro; rewrite H7 in r; elim (Rlt_irrefl _ r). - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + red; intro; rewrite H7 in r; elim (Rlt_irrefl _ r). + unfold Rdiv; apply Rmult_lt_0_compat. assumption. apply Rinv_0_lt_compat; apply Rabs_pos_lt. - red in |- *; intro H7; rewrite H7 in r; elim (Rlt_irrefl _ r). + red; intro H7; rewrite H7 in r; elim (Rlt_irrefl _ r). Qed. diff --git a/theories/Reals/AltSeries.v b/theories/Reals/AltSeries.v index 07a26929..69f29781 100644 --- a/theories/Reals/AltSeries.v +++ b/theories/Reals/AltSeries.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -12,7 +12,7 @@ Require Import Rseries. Require Import SeqProp. Require Import PartSum. Require Import Max. -Open Local Scope R_scope. +Local Open Scope R_scope. (**********) (** * Formalization of alternated series *) @@ -24,13 +24,13 @@ Lemma CV_ALT_step0 : Un_decreasing Un -> Un_growing (fun N:nat => sum_f_R0 (tg_alt Un) (S (2 * N))). Proof. - intros; unfold Un_growing in |- *; intro. + intros; unfold Un_growing; intro. cut ((2 * S n)%nat = S (S (2 * n))). intro; rewrite H0. do 4 rewrite tech5; repeat rewrite Rplus_assoc; apply Rplus_le_compat_l. - pattern (tg_alt Un (S (2 * n))) at 1 in |- *; rewrite <- Rplus_0_r. + pattern (tg_alt Un (S (2 * n))) at 1; rewrite <- Rplus_0_r. apply Rplus_le_compat_l. - unfold tg_alt in |- *; rewrite <- H0; rewrite pow_1_odd; rewrite pow_1_even; + unfold tg_alt; rewrite <- H0; rewrite pow_1_odd; rewrite pow_1_even; rewrite Rmult_1_l. apply Rplus_le_reg_l with (Un (S (2 * S n))). rewrite Rplus_0_r; @@ -46,12 +46,12 @@ Lemma CV_ALT_step1 : Un_decreasing Un -> Un_decreasing (fun N:nat => sum_f_R0 (tg_alt Un) (2 * N)). Proof. - intros; unfold Un_decreasing in |- *; intro. + intros; unfold Un_decreasing; intro. cut ((2 * S n)%nat = S (S (2 * n))). intro; rewrite H0; do 2 rewrite tech5; repeat rewrite Rplus_assoc. - pattern (sum_f_R0 (tg_alt Un) (2 * n)) at 2 in |- *; rewrite <- Rplus_0_r. + pattern (sum_f_R0 (tg_alt Un) (2 * n)) at 2; rewrite <- Rplus_0_r. apply Rplus_le_compat_l. - unfold tg_alt in |- *; rewrite <- H0; rewrite pow_1_odd; rewrite pow_1_even; + unfold tg_alt; rewrite <- H0; rewrite pow_1_odd; rewrite pow_1_even; rewrite Rmult_1_l. apply Rplus_le_reg_l with (Un (S (2 * n))). rewrite Rplus_0_r; @@ -70,7 +70,7 @@ Lemma CV_ALT_step2 : sum_f_R0 (fun i:nat => tg_alt Un (S i)) (S (2 * N)) <= 0. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; unfold tg_alt in |- *; simpl in |- *; rewrite Rmult_1_r. + simpl; unfold tg_alt; simpl; rewrite Rmult_1_r. replace (-1 * -1 * Un 2%nat) with (Un 2%nat); [ idtac | ring ]. apply Rplus_le_reg_l with (Un 1%nat); rewrite Rplus_0_r. replace (Un 1%nat + (-1 * Un 1%nat + Un 2%nat)) with (Un 2%nat); @@ -78,10 +78,10 @@ Proof. cut (S (2 * S N) = S (S (S (2 * N)))). intro; rewrite H1; do 2 rewrite tech5. apply Rle_trans with (sum_f_R0 (fun i:nat => tg_alt Un (S i)) (S (2 * N))). - pattern (sum_f_R0 (fun i:nat => tg_alt Un (S i)) (S (2 * N))) at 2 in |- *; + pattern (sum_f_R0 (fun i:nat => tg_alt Un (S i)) (S (2 * N))) at 2; rewrite <- Rplus_0_r. rewrite Rplus_assoc; apply Rplus_le_compat_l. - unfold tg_alt in |- *; rewrite <- H1. + unfold tg_alt; rewrite <- H1. rewrite pow_1_odd. cut (S (S (2 * S N)) = (2 * S (S N))%nat). intro; rewrite H2; rewrite pow_1_even; rewrite Rmult_1_l; rewrite <- H2. @@ -102,7 +102,7 @@ Lemma CV_ALT_step3 : positivity_seq Un -> sum_f_R0 (fun i:nat => tg_alt Un (S i)) N <= 0. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; unfold tg_alt in |- *; simpl in |- *; rewrite Rmult_1_r. + simpl; unfold tg_alt; simpl; rewrite Rmult_1_r. apply Rplus_le_reg_l with (Un 1%nat). rewrite Rplus_0_r; replace (Un 1%nat + -1 * Un 1%nat) with 0; [ apply H0 | ring ]. @@ -112,10 +112,10 @@ Proof. rewrite H3; apply CV_ALT_step2; assumption. rewrite H3; rewrite tech5. apply Rle_trans with (sum_f_R0 (fun i:nat => tg_alt Un (S i)) (S (2 * x))). - pattern (sum_f_R0 (fun i:nat => tg_alt Un (S i)) (S (2 * x))) at 2 in |- *; + pattern (sum_f_R0 (fun i:nat => tg_alt Un (S i)) (S (2 * x))) at 2; rewrite <- Rplus_0_r. apply Rplus_le_compat_l. - unfold tg_alt in |- *; simpl in |- *. + unfold tg_alt; simpl. replace (x + (x + 0))%nat with (2 * x)%nat; [ idtac | ring ]. rewrite pow_1_even. replace (-1 * (-1 * (-1 * 1)) * Un (S (S (S (2 * x))))) with @@ -133,15 +133,15 @@ Lemma CV_ALT_step4 : positivity_seq Un -> has_ub (fun N:nat => sum_f_R0 (tg_alt Un) (S (2 * N))). Proof. - intros; unfold has_ub in |- *; unfold bound in |- *. + intros; unfold has_ub; unfold bound. exists (Un 0%nat). - unfold is_upper_bound in |- *; intros; elim H1; intros. + unfold is_upper_bound; intros; elim H1; intros. rewrite H2; rewrite decomp_sum. replace (tg_alt Un 0) with (Un 0%nat). - pattern (Un 0%nat) at 2 in |- *; rewrite <- Rplus_0_r. + pattern (Un 0%nat) at 2; rewrite <- Rplus_0_r. apply Rplus_le_compat_l. apply CV_ALT_step3; assumption. - unfold tg_alt in |- *; simpl in |- *; ring. + unfold tg_alt; simpl; ring. apply lt_O_Sn. Qed. @@ -159,11 +159,11 @@ Proof. assert (X := growing_cv _ H2 H3). elim X; intros. exists x. - unfold Un_cv in |- *; unfold R_dist in |- *; unfold Un_cv in H1; + unfold Un_cv; unfold R_dist; unfold Un_cv in H1; unfold R_dist in H1; unfold Un_cv in p; unfold R_dist in p. intros; cut (0 < eps / 2); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ] ]. elim (H1 (eps / 2) H5); intros N2 H6. elim (p (eps / 2) H5); intros N1 H7. @@ -180,32 +180,32 @@ Proof. apply Rabs_triang. rewrite (double_var eps); apply Rplus_lt_compat. rewrite H12; apply H7; assumption. - rewrite Rabs_Ropp; unfold tg_alt in |- *; rewrite Rabs_mult; + rewrite Rabs_Ropp; unfold tg_alt; rewrite Rabs_mult; rewrite pow_1_abs; rewrite Rmult_1_l; unfold Rminus in H6; rewrite Ropp_0 in H6; rewrite <- (Rplus_0_r (Un (S n))); apply H6. - unfold ge in |- *; apply le_trans with n. - apply le_trans with N; [ unfold N in |- *; apply le_max_r | assumption ]. + unfold ge; apply le_trans with n. + apply le_trans with N; [ unfold N; apply le_max_r | assumption ]. apply le_n_Sn. rewrite tech5; ring. rewrite H12; apply Rlt_trans with (eps / 2). apply H7; assumption. - unfold Rdiv in |- *; apply Rmult_lt_reg_l with 2. + unfold Rdiv; apply Rmult_lt_reg_l with 2. prove_sup0. rewrite (Rmult_comm 2); rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ rewrite Rmult_1_r | discrR ]. rewrite double. - pattern eps at 1 in |- *; rewrite <- (Rplus_0_r eps); apply Rplus_lt_compat_l; + pattern eps at 1; rewrite <- (Rplus_0_r eps); apply Rplus_lt_compat_l; assumption. elim H10; intro; apply le_double. rewrite <- H11; apply le_trans with N. - unfold N in |- *; apply le_trans with (S (2 * N1)); + unfold N; apply le_trans with (S (2 * N1)); [ apply le_n_Sn | apply le_max_l ]. assumption. apply lt_n_Sm_le. rewrite <- H11. apply lt_le_trans with N. - unfold N in |- *; apply lt_le_trans with (S (2 * N1)). + unfold N; apply lt_le_trans with (S (2 * N1)). apply lt_n_Sn. apply le_max_l. assumption. @@ -222,7 +222,7 @@ Theorem alternated_series : Proof. intros; apply CV_ALT. assumption. - unfold positivity_seq in |- *; apply decreasing_ineq; assumption. + unfold positivity_seq; apply decreasing_ineq; assumption. assumption. Qed. @@ -243,31 +243,31 @@ Proof. apply (decreasing_ineq (fun N:nat => sum_f_R0 (tg_alt Un) (2 * N))). apply CV_ALT_step1; assumption. assumption. - unfold Un_cv in |- *; unfold R_dist in |- *; unfold Un_cv in H1; + unfold Un_cv; unfold R_dist; unfold Un_cv in H1; unfold R_dist in H1; intros. elim (H1 eps H2); intros. exists x; intros. apply H3. - unfold ge in |- *; apply le_trans with (2 * n)%nat. + unfold ge; apply le_trans with (2 * n)%nat. apply le_trans with n. assumption. assert (H5 := mult_O_le n 2). elim H5; intro. cut (0%nat <> 2%nat); - [ intro; elim H7; symmetry in |- *; assumption | discriminate ]. + [ intro; elim H7; symmetry ; assumption | discriminate ]. assumption. apply le_n_Sn. - unfold Un_cv in |- *; unfold R_dist in |- *; unfold Un_cv in H1; + unfold Un_cv; unfold R_dist; unfold Un_cv in H1; unfold R_dist in H1; intros. elim (H1 eps H2); intros. exists x; intros. apply H3. - unfold ge in |- *; apply le_trans with n. + unfold ge; apply le_trans with n. assumption. assert (H5 := mult_O_le n 2). elim H5; intro. cut (0%nat <> 2%nat); - [ intro; elim H7; symmetry in |- *; assumption | discriminate ]. + [ intro; elim H7; symmetry ; assumption | discriminate ]. assumption. Qed. @@ -279,13 +279,13 @@ Definition PI_tg (n:nat) := / INR (2 * n + 1). Lemma PI_tg_pos : forall n:nat, 0 <= PI_tg n. Proof. - intro; unfold PI_tg in |- *; left; apply Rinv_0_lt_compat; apply lt_INR_0; + intro; unfold PI_tg; left; apply Rinv_0_lt_compat; apply lt_INR_0; replace (2 * n + 1)%nat with (S (2 * n)); [ apply lt_O_Sn | ring ]. Qed. Lemma PI_tg_decreasing : Un_decreasing PI_tg. Proof. - unfold PI_tg, Un_decreasing in |- *; intro. + unfold PI_tg, Un_decreasing; intro. apply Rmult_le_reg_l with (INR (2 * n + 1)). apply lt_INR_0. replace (2 * n + 1)%nat with (S (2 * n)); [ apply lt_O_Sn | ring ]. @@ -306,7 +306,7 @@ Qed. Lemma PI_tg_cv : Un_cv PI_tg 0. Proof. - unfold Un_cv in |- *; unfold R_dist in |- *; intros. + unfold Un_cv; unfold R_dist; intros. cut (0 < 2 * eps); [ intro | apply Rmult_lt_0_compat; [ prove_sup0 | assumption ] ]. assert (H1 := archimed (/ (2 * eps))). @@ -316,9 +316,9 @@ Proof. cut (0 < N)%nat. intro; exists N; intros. cut (0 < n)%nat. - intro; unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; + intro; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite Rabs_right. - unfold PI_tg in |- *; apply Rlt_trans with (/ INR (2 * n)). + unfold PI_tg; apply Rlt_trans with (/ INR (2 * n)). apply Rmult_lt_reg_l with (INR (2 * n)). apply lt_INR_0. replace (2 * n)%nat with (n + n)%nat; [ idtac | ring ]. @@ -337,27 +337,27 @@ Proof. [ discriminate | ring ]. replace n with (S (pred n)). apply not_O_INR; discriminate. - symmetry in |- *; apply S_pred with 0%nat. + symmetry ; apply S_pred with 0%nat. assumption. apply Rle_lt_trans with (/ INR (2 * N)). apply Rmult_le_reg_l with (INR (2 * N)). rewrite mult_INR; apply Rmult_lt_0_compat; - [ simpl in |- *; prove_sup0 | apply lt_INR_0; assumption ]. + [ simpl; prove_sup0 | apply lt_INR_0; assumption ]. rewrite <- Rinv_r_sym. apply Rmult_le_reg_l with (INR (2 * n)). rewrite mult_INR; apply Rmult_lt_0_compat; - [ simpl in |- *; prove_sup0 | apply lt_INR_0; assumption ]. + [ simpl; prove_sup0 | apply lt_INR_0; assumption ]. rewrite (Rmult_comm (INR (2 * n))); rewrite Rmult_assoc; rewrite <- Rinv_l_sym. do 2 rewrite Rmult_1_r; apply le_INR. apply (fun m n p:nat => mult_le_compat_l p n m); assumption. replace n with (S (pred n)). apply not_O_INR; discriminate. - symmetry in |- *; apply S_pred with 0%nat. + symmetry ; apply S_pred with 0%nat. assumption. replace N with (S (pred N)). apply not_O_INR; discriminate. - symmetry in |- *; apply S_pred with 0%nat. + symmetry ; apply S_pred with 0%nat. assumption. rewrite mult_INR. rewrite Rinv_mult_distr. @@ -374,17 +374,17 @@ Proof. replace (/ (2 * eps) * (INR N * (2 * eps))) with (INR N * (2 * eps * / (2 * eps))); [ idtac | ring ]. rewrite <- Rinv_r_sym. - rewrite Rmult_1_r; replace (INR N) with (IZR (Z_of_nat N)). + rewrite Rmult_1_r; replace (INR N) with (IZR (Z.of_nat N)). rewrite <- H4. elim H1; intros; assumption. - symmetry in |- *; apply INR_IZR_INZ. + symmetry ; apply INR_IZR_INZ. apply prod_neq_R0; - [ discrR | red in |- *; intro; rewrite H8 in H; elim (Rlt_irrefl _ H) ]. + [ discrR | red; intro; rewrite H8 in H; elim (Rlt_irrefl _ H) ]. apply not_O_INR. - red in |- *; intro; rewrite H8 in H5; elim (lt_irrefl _ H5). + red; intro; rewrite H8 in H5; elim (lt_irrefl _ H5). replace (INR 2) with 2; [ discrR | reflexivity ]. apply not_O_INR. - red in |- *; intro; rewrite H8 in H5; elim (lt_irrefl _ H5). + red; intro; rewrite H8 in H5; elim (lt_irrefl _ H5). apply Rle_ge; apply PI_tg_pos. apply lt_le_trans with N; assumption. elim H1; intros H5 _. @@ -399,7 +399,7 @@ Proof. elim (Rlt_irrefl _ (Rlt_trans _ _ _ H7 H5)). elim (lt_n_O _ b). apply le_IZR. - simpl in |- *. + simpl. left; apply Rlt_trans with (/ (2 * eps)). apply Rinv_0_lt_compat; assumption. elim H1; intros; assumption. @@ -414,41 +414,41 @@ Proof. Qed. (** Now, PI is defined *) -Definition PI : R := 4 * (let (a,_) := exist_PI in a). +Definition Alt_PI : R := 4 * (let (a,_) := exist_PI in a). (** We can get an approximation of PI with the following inequality *) -Lemma PI_ineq : +Lemma Alt_PI_ineq : forall N:nat, - sum_f_R0 (tg_alt PI_tg) (S (2 * N)) <= PI / 4 <= + sum_f_R0 (tg_alt PI_tg) (S (2 * N)) <= Alt_PI / 4 <= sum_f_R0 (tg_alt PI_tg) (2 * N). Proof. intro; apply alternated_series_ineq. apply PI_tg_decreasing. apply PI_tg_cv. - unfold PI in |- *; case exist_PI; intro. + unfold Alt_PI; case exist_PI; intro. replace (4 * x / 4) with x. trivial. - unfold Rdiv in |- *; rewrite (Rmult_comm 4); rewrite Rmult_assoc; + unfold Rdiv; rewrite (Rmult_comm 4); rewrite Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_r; reflexivity | discrR ]. Qed. -Lemma PI_RGT_0 : 0 < PI. +Lemma Alt_PI_RGT_0 : 0 < Alt_PI. Proof. - assert (H := PI_ineq 0). + assert (H := Alt_PI_ineq 0). apply Rmult_lt_reg_l with (/ 4). apply Rinv_0_lt_compat; prove_sup0. rewrite Rmult_0_r; rewrite Rmult_comm. elim H; clear H; intros H _. unfold Rdiv in H; apply Rlt_le_trans with (sum_f_R0 (tg_alt PI_tg) (S (2 * 0))). - simpl in |- *; unfold tg_alt in |- *; simpl in |- *; rewrite Rmult_1_l; + simpl; unfold tg_alt; simpl; rewrite Rmult_1_l; rewrite Rmult_1_r; apply Rplus_lt_reg_r with (PI_tg 1). rewrite Rplus_0_r; replace (PI_tg 1 + (PI_tg 0 + -1 * PI_tg 1)) with (PI_tg 0); - [ unfold PI_tg in |- * | ring ]. - simpl in |- *; apply Rinv_lt_contravar. + [ unfold PI_tg | ring ]. + simpl; apply Rinv_lt_contravar. rewrite Rmult_1_l; replace (2 + 1) with 3; [ prove_sup0 | ring ]. - rewrite Rplus_comm; pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; + rewrite Rplus_comm; pattern 1 at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; prove_sup0. assumption. Qed. diff --git a/theories/Reals/ArithProp.v b/theories/Reals/ArithProp.v index 620561dc..c817bdfa 100644 --- a/theories/Reals/ArithProp.v +++ b/theories/Reals/ArithProp.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -12,12 +12,12 @@ Require Import Even. Require Import Div2. Require Import ArithRing. -Open Local Scope Z_scope. -Open Local Scope R_scope. +Local Open Scope Z_scope. +Local Open Scope R_scope. Lemma minus_neq_O : forall n i:nat, (i < n)%nat -> (n - i)%nat <> 0%nat. Proof. - intros; red in |- *; intro. + intros; red; intro. cut (forall n m:nat, (m <= n)%nat -> (n - m)%nat = 0%nat -> n = m). intro; assert (H2 := H1 _ _ (lt_le_weak _ _ H) H0); rewrite H2 in H; elim (lt_irrefl _ H). @@ -27,11 +27,11 @@ Proof. forall n0 m:nat, (m <= n0)%nat -> (n0 - m)%nat = 0%nat -> n0 = m). intro; apply H1. apply nat_double_ind. - unfold R in |- *; intros; inversion H2; reflexivity. - unfold R in |- *; intros; simpl in H3; assumption. - unfold R in |- *; intros; simpl in H4; assert (H5 := le_S_n _ _ H3); + unfold R; intros; inversion H2; reflexivity. + unfold R; intros; simpl in H3; assumption. + unfold R; intros; simpl in H4; assert (H5 := le_S_n _ _ H3); assert (H6 := H2 H5 H4); rewrite H6; reflexivity. - unfold R in |- *; intros; apply H1; assumption. + unfold R; intros; apply H1; assumption. Qed. Lemma le_minusni_n : forall n i:nat, (i <= n)%nat -> (n - i <= n)%nat. @@ -41,20 +41,20 @@ Proof. ((forall m n:nat, R m n) -> forall n i:nat, (i <= n)%nat -> (n - i <= n)%nat). intro; apply H. apply nat_double_ind. - unfold R in |- *; intros; simpl in |- *; apply le_n. - unfold R in |- *; intros; simpl in |- *; apply le_n. - unfold R in |- *; intros; simpl in |- *; apply le_trans with n. + unfold R; intros; simpl; apply le_n. + unfold R; intros; simpl; apply le_n. + unfold R; intros; simpl; apply le_trans with n. apply H0; apply le_S_n; assumption. apply le_n_Sn. - unfold R in |- *; intros; apply H; assumption. + unfold R; intros; apply H; assumption. Qed. Lemma lt_minus_O_lt : forall m n:nat, (m < n)%nat -> (0 < n - m)%nat. Proof. - intros n m; pattern n, m in |- *; apply nat_double_ind; + intros n m; pattern n, m; apply nat_double_ind; [ intros; rewrite <- minus_n_O; assumption | intros; elim (lt_n_O _ H) - | intros; simpl in |- *; apply H; apply lt_S_n; assumption ]. + | intros; simpl; apply H; apply lt_S_n; assumption ]. Qed. Lemma even_odd_cor : @@ -73,7 +73,7 @@ Proof. apply H3; assumption. right. apply H4; assumption. - unfold double in |- *;ring. + unfold double;ring. Qed. (* 2m <= 2n => m<=n *) @@ -105,9 +105,9 @@ Proof. exists (x - IZR k0 * y). split. ring. - unfold k0 in |- *; case (Rcase_abs y); intro. - assert (H0 := archimed (x / - y)); rewrite <- Z_R_minus; simpl in |- *; - unfold Rminus in |- *. + unfold k0; case (Rcase_abs y); intro. + assert (H0 := archimed (x / - y)); rewrite <- Z_R_minus; simpl; + unfold Rminus. replace (- ((1 + - IZR (up (x / - y))) * y)) with ((IZR (up (x / - y)) - 1) * y); [ idtac | ring ]. split. @@ -118,7 +118,7 @@ Proof. rewrite Rmult_assoc; repeat rewrite Ropp_mult_distr_r_reverse; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_r | assumption ]. apply Rplus_le_reg_l with (IZR (up (x / - y)) - x / - y). - rewrite Rplus_0_r; unfold Rdiv in |- *; pattern (/ - y) at 4 in |- *; + rewrite Rplus_0_r; unfold Rdiv; pattern (/ - y) at 4; rewrite <- Ropp_inv_permute; [ idtac | assumption ]. replace (IZR (up (x * / - y)) - x * - / y + @@ -138,11 +138,11 @@ Proof. replace (IZR (up (x / - y)) - 1 + (- (x * / y) + - (IZR (up (x / - y)) - 1))) with (- (x * / y)); [ idtac | ring ]. rewrite <- Ropp_mult_distr_r_reverse; rewrite (Ropp_inv_permute _ H); elim H0; - unfold Rdiv in |- *; intros H1 _; exact H1. + unfold Rdiv; intros H1 _; exact H1. apply Ropp_neq_0_compat; assumption. - assert (H0 := archimed (x / y)); rewrite <- Z_R_minus; simpl in |- *; + assert (H0 := archimed (x / y)); rewrite <- Z_R_minus; simpl; cut (0 < y). - intro; unfold Rminus in |- *; + intro; unfold Rminus; replace (- ((IZR (up (x / y)) + -1) * y)) with ((1 - IZR (up (x / y))) * y); [ idtac | ring ]. split. @@ -152,7 +152,7 @@ Proof. rewrite Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_r | assumption ]; apply Rplus_le_reg_l with (IZR (up (x / y)) - x / y); - rewrite Rplus_0_r; unfold Rdiv in |- *; + rewrite Rplus_0_r; unfold Rdiv; replace (IZR (up (x * / y)) - x * / y + (x * / y + (1 - IZR (up (x * / y))))) with 1; [ idtac | ring ]; elim H0; intros _ H2; unfold Rdiv in H2; @@ -166,12 +166,12 @@ Proof. replace (IZR (up (x / y)) - 1 + 1) with (IZR (up (x / y))); [ idtac | ring ]; replace (IZR (up (x / y)) - 1 + (x * / y + (1 - IZR (up (x / y))))) with - (x * / y); [ idtac | ring ]; elim H0; unfold Rdiv in |- *; + (x * / y); [ idtac | ring ]; elim H0; unfold Rdiv; intros H2 _; exact H2. case (total_order_T 0 y); intro. elim s; intro. assumption. - elim H; symmetry in |- *; exact b. + elim H; symmetry ; exact b. assert (H1 := Rge_le _ _ r); elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H1 r0)). Qed. diff --git a/theories/Reals/Binomial.v b/theories/Reals/Binomial.v index 412f6442..ad076c48 100644 --- a/theories/Reals/Binomial.v +++ b/theories/Reals/Binomial.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,14 +9,14 @@ Require Import Rbase. Require Import Rfunctions. Require Import PartSum. -Open Local Scope R_scope. +Local Open Scope R_scope. Definition C (n p:nat) : R := INR (fact n) / (INR (fact p) * INR (fact (n - p))). Lemma pascal_step1 : forall n i:nat, (i <= n)%nat -> C n i = C n (n - i). Proof. - intros; unfold C in |- *; replace (n - (n - i))%nat with i. + intros; unfold C; replace (n - (n - i))%nat with i. rewrite Rmult_comm. reflexivity. apply plus_minus; rewrite plus_comm; apply le_plus_minus; assumption. @@ -26,10 +26,10 @@ Lemma pascal_step2 : forall n i:nat, (i <= n)%nat -> C (S n) i = INR (S n) / INR (S n - i) * C n i. Proof. - intros; unfold C in |- *; replace (S n - i)%nat with (S (n - i)). + intros; unfold C; replace (S n - i)%nat with (S (n - i)). cut (forall n:nat, fact (S n) = (S n * fact n)%nat). intro; repeat rewrite H0. - unfold Rdiv in |- *; repeat rewrite mult_INR; repeat rewrite Rinv_mult_distr. + unfold Rdiv; repeat rewrite mult_INR; repeat rewrite Rinv_mult_distr. ring. apply INR_fact_neq_0. apply INR_fact_neq_0. @@ -46,13 +46,13 @@ Qed. Lemma pascal_step3 : forall n i:nat, (i < n)%nat -> C n (S i) = INR (n - i) / INR (S i) * C n i. Proof. - intros; unfold C in |- *. + intros; unfold C. cut (forall n:nat, fact (S n) = (S n * fact n)%nat). intro. cut ((n - i)%nat = S (n - S i)). intro. - pattern (n - i)%nat at 2 in |- *; rewrite H1. - repeat rewrite H0; unfold Rdiv in |- *; repeat rewrite mult_INR; + pattern (n - i)%nat at 2; rewrite H1. + repeat rewrite H0; unfold Rdiv; repeat rewrite mult_INR; repeat rewrite Rinv_mult_distr. rewrite <- H1; rewrite (Rmult_comm (/ INR (n - i))); repeat rewrite Rmult_assoc; rewrite (Rmult_comm (INR (n - i))); @@ -68,7 +68,7 @@ Proof. apply prod_neq_R0; [ apply not_O_INR; discriminate | apply INR_fact_neq_0 ]. apply INR_fact_neq_0. rewrite minus_Sn_m. - simpl in |- *; reflexivity. + simpl; reflexivity. apply lt_le_S; assumption. intro; reflexivity. Qed. @@ -95,13 +95,13 @@ Proof. rewrite <- minus_Sn_m. cut ((n - (n - i))%nat = i). intro; rewrite H0; reflexivity. - symmetry in |- *; apply plus_minus. + symmetry ; apply plus_minus. rewrite plus_comm; rewrite le_plus_minus_r. reflexivity. apply lt_le_weak; assumption. apply le_minusni_n; apply lt_le_weak; assumption. apply lt_le_weak; assumption. - unfold Rdiv in |- *. + unfold Rdiv. repeat rewrite S_INR. rewrite minus_INR. cut (INR i + 1 <> 0). @@ -125,18 +125,18 @@ Lemma binomial : (x + y) ^ n = sum_f_R0 (fun i:nat => C n i * x ^ i * y ^ (n - i)) n. Proof. intros; induction n as [| n Hrecn]. - unfold C in |- *; simpl in |- *; unfold Rdiv in |- *; + unfold C; simpl; unfold Rdiv; repeat rewrite Rmult_1_r; rewrite Rinv_1; ring. - pattern (S n) at 1 in |- *; replace (S n) with (n + 1)%nat; [ idtac | ring ]. + pattern (S n) at 1; replace (S n) with (n + 1)%nat; [ idtac | ring ]. rewrite pow_add; rewrite Hrecn. - replace ((x + y) ^ 1) with (x + y); [ idtac | simpl in |- *; ring ]. + replace ((x + y) ^ 1) with (x + y); [ idtac | simpl; ring ]. rewrite tech5. cut (forall p:nat, C p p = 1). cut (forall p:nat, C p 0 = 1). intros; rewrite H0; rewrite <- minus_n_n; rewrite Rmult_1_l. - replace (y ^ 0) with 1; [ rewrite Rmult_1_r | simpl in |- *; reflexivity ]. + replace (y ^ 0) with 1; [ rewrite Rmult_1_r | simpl; reflexivity ]. induction n as [| n Hrecn0]. - simpl in |- *; do 2 rewrite H; ring. + simpl; do 2 rewrite H; ring. (* N >= 1 *) set (N := S n). rewrite Rmult_plus_distr_l. @@ -158,7 +158,7 @@ Proof. rewrite (Rplus_comm (sum_f_R0 An n)). repeat rewrite Rplus_assoc. rewrite <- tech5. - fold N in |- *. + fold N. set (Cn := fun i:nat => C N i * x ^ i * y ^ (S N - i)). cut (forall i:nat, (i < N)%nat -> Cn (S i) = Bn i). intro; replace (sum_f_R0 Bn n) with (sum_f_R0 (fun i:nat => Cn (S i)) n). @@ -166,42 +166,42 @@ Proof. rewrite <- Rplus_assoc; rewrite (decomp_sum Cn N). replace (pred N) with n. ring. - unfold N in |- *; simpl in |- *; reflexivity. - unfold N in |- *; apply lt_O_Sn. - unfold Cn in |- *; rewrite H; simpl in |- *; ring. + unfold N; simpl; reflexivity. + unfold N; apply lt_O_Sn. + unfold Cn; rewrite H; simpl; ring. apply sum_eq. intros; apply H1. - unfold N in |- *; apply le_lt_trans with n; [ assumption | apply lt_n_Sn ]. - intros; unfold Bn, Cn in |- *. + unfold N; apply le_lt_trans with n; [ assumption | apply lt_n_Sn ]. + intros; unfold Bn, Cn. replace (S N - S i)%nat with (N - i)%nat; reflexivity. - unfold An in |- *; fold N in |- *; rewrite <- minus_n_n; rewrite H0; - simpl in |- *; ring. + unfold An; fold N; rewrite <- minus_n_n; rewrite H0; + simpl; ring. apply sum_eq. - intros; unfold An, Bn in |- *; replace (S N - S i)%nat with (N - i)%nat; + intros; unfold An, Bn; replace (S N - S i)%nat with (N - i)%nat; [ idtac | reflexivity ]. rewrite <- pascal; [ ring - | apply le_lt_trans with n; [ assumption | unfold N in |- *; apply lt_n_Sn ] ]. - unfold N in |- *; reflexivity. - unfold N in |- *; apply lt_O_Sn. + | apply le_lt_trans with n; [ assumption | unfold N; apply lt_n_Sn ] ]. + unfold N; reflexivity. + unfold N; apply lt_O_Sn. rewrite <- (Rmult_comm y); rewrite scal_sum; apply sum_eq. intros; replace (S N - i)%nat with (S (N - i)). replace (S (N - i)) with (N - i + 1)%nat; [ idtac | ring ]. - rewrite pow_add; replace (y ^ 1) with y; [ idtac | simpl in |- *; ring ]; + rewrite pow_add; replace (y ^ 1) with y; [ idtac | simpl; ring ]; ring. apply minus_Sn_m; assumption. rewrite <- (Rmult_comm x); rewrite scal_sum; apply sum_eq. intros; replace (S i) with (i + 1)%nat; [ idtac | ring ]; rewrite pow_add; - replace (x ^ 1) with x; [ idtac | simpl in |- *; ring ]; + replace (x ^ 1) with x; [ idtac | simpl; ring ]; ring. - intro; unfold C in |- *. + intro; unfold C. replace (INR (fact 0)) with 1; [ idtac | reflexivity ]. replace (p - 0)%nat with p; [ idtac | apply minus_n_O ]. - rewrite Rmult_1_l; unfold Rdiv in |- *; rewrite <- Rinv_r_sym; + rewrite Rmult_1_l; unfold Rdiv; rewrite <- Rinv_r_sym; [ reflexivity | apply INR_fact_neq_0 ]. - intro; unfold C in |- *. + intro; unfold C. replace (p - p)%nat with 0%nat; [ idtac | apply minus_n_n ]. replace (INR (fact 0)) with 1; [ idtac | reflexivity ]. - rewrite Rmult_1_r; unfold Rdiv in |- *; rewrite <- Rinv_r_sym; + rewrite Rmult_1_r; unfold Rdiv; rewrite <- Rinv_r_sym; [ reflexivity | apply INR_fact_neq_0 ]. Qed. diff --git a/theories/Reals/Cauchy_prod.v b/theories/Reals/Cauchy_prod.v index a9d5cde3..f6a48adc 100644 --- a/theories/Reals/Cauchy_prod.v +++ b/theories/Reals/Cauchy_prod.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -10,7 +10,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import Rseries. Require Import PartSum. -Open Local Scope R_scope. +Local Open Scope R_scope. (**********) Lemma sum_N_predN : @@ -21,7 +21,7 @@ Proof. replace N with (S (pred N)). rewrite tech5. reflexivity. - symmetry in |- *; apply S_pred with 0%nat; assumption. + symmetry ; apply S_pred with 0%nat; assumption. Qed. (**********) @@ -51,7 +51,7 @@ Proof. elim (lt_irrefl _ H). cut (N = 0%nat \/ (0 < N)%nat). intro; elim H0; intro. - rewrite H1; simpl in |- *; ring. + rewrite H1; simpl; ring. replace (pred (S N)) with (S (pred N)). do 5 rewrite tech5. rewrite Rmult_plus_distr_r; rewrite Rmult_plus_distr_l; rewrite (HrecN H1). @@ -66,7 +66,7 @@ Proof. repeat rewrite Rplus_assoc; apply Rplus_eq_compat_l. rewrite <- minus_n_n; cut (N = 1%nat \/ (2 <= N)%nat). intro; elim H2; intro. - rewrite H3; simpl in |- *; ring. + rewrite H3; simpl; ring. replace (sum_f_R0 (fun k:nat => @@ -147,7 +147,7 @@ Proof. (pred (pred N))). repeat rewrite Rplus_assoc; apply Rplus_eq_compat_l. replace (pred (N - pred N)) with 0%nat. - simpl in |- *; rewrite <- minus_n_O. + simpl; rewrite <- minus_n_O. replace (S (pred N)) with N. replace (sum_f_R0 (fun k:nat => An (S N) * Bn (S k)) (pred (pred N))) with (sum_f_R0 (fun k:nat => Bn (S k) * An (S N)) (pred (pred N))). @@ -161,11 +161,11 @@ Proof. apply S_pred with 0%nat; assumption. replace (N - pred N)%nat with 1%nat. reflexivity. - pattern N at 1 in |- *; replace N with (S (pred N)). + pattern N at 1; replace N with (S (pred N)). rewrite <- minus_Sn_m. rewrite <- minus_n_n; reflexivity. apply le_n. - symmetry in |- *; apply S_pred with 0%nat; assumption. + symmetry ; apply S_pred with 0%nat; assumption. apply sum_eq; intros; rewrite (sum_N_predN (fun l:nat => An (S (S (l + i))) * Bn (N - l)%nat) @@ -259,7 +259,7 @@ Proof. apply le_n. apply (fun p n m:nat => plus_le_reg_l n m p) with 1%nat. rewrite le_plus_minus_r. - simpl in |- *; assumption. + simpl; assumption. apply le_trans with 2%nat; [ apply le_n_Sn | assumption ]. apply le_trans with 2%nat; [ apply le_n_Sn | assumption ]. simpl; ring. @@ -274,7 +274,7 @@ Proof. apply le_trans with (pred (pred N)). assumption. apply le_pred_n. - symmetry in |- *; apply S_pred with 0%nat; assumption. + symmetry ; apply S_pred with 0%nat; assumption. apply INR_eq; rewrite S_INR; rewrite plus_INR; reflexivity. apply le_trans with (pred (pred N)). assumption. @@ -427,7 +427,7 @@ Proof. apply le_trans with (pred (pred N)). assumption. apply le_pred_n. - symmetry in |- *; apply S_pred with 0%nat; assumption. + symmetry ; apply S_pred with 0%nat; assumption. apply INR_eq; rewrite S_INR; rewrite plus_INR; simpl; ring. apply le_trans with (pred (pred N)). assumption. @@ -441,11 +441,11 @@ Proof. inversion H1. left; reflexivity. right; apply le_n_S; assumption. - simpl in |- *. + simpl. replace (S (pred N)) with N. reflexivity. apply S_pred with 0%nat; assumption. - simpl in |- *. + simpl. cut ((N - pred N)%nat = 1%nat). intro; rewrite H2; reflexivity. rewrite pred_of_minus. @@ -453,7 +453,7 @@ Proof. simpl; ring. apply lt_le_S; assumption. rewrite <- pred_of_minus; apply le_pred_n. - simpl in |- *; symmetry in |- *; apply S_pred with 0%nat; assumption. + simpl; symmetry ; apply S_pred with 0%nat; assumption. inversion H. left; reflexivity. right; apply lt_le_trans with 1%nat; [ apply lt_n_Sn | exact H1 ]. diff --git a/theories/Reals/Cos_plus.v b/theories/Reals/Cos_plus.v index ec1eeddf..c296d427 100644 --- a/theories/Reals/Cos_plus.v +++ b/theories/Reals/Cos_plus.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -12,8 +12,8 @@ Require Import SeqSeries. Require Import Rtrigo_def. Require Import Cos_rel. Require Import Max. -Open Local Scope nat_scope. -Open Local Scope R_scope. +Local Open Scope nat_scope. +Local Open Scope R_scope. Definition Majxy (x y:R) (n:nat) : R := Rmax 1 (Rmax (Rabs x) (Rabs y)) ^ (4 * S n) / INR (fact n). @@ -29,23 +29,23 @@ Proof. intro. assert (H1 := cv_speed_pow_fact C0). unfold Un_cv in H1; unfold R_dist in H1. - unfold Un_cv in |- *; unfold R_dist in |- *; intros. + unfold Un_cv; unfold R_dist; intros. cut (0 < eps / C0); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; assumption ] ]. elim (H1 (eps / C0) H3); intros N0 H4. exists N0; intros. replace (Majxy x y n) with (C0 ^ S n / INR (fact n)). - simpl in |- *. + simpl. apply Rmult_lt_reg_l with (Rabs (/ C0)). apply Rabs_pos_lt. apply Rinv_neq_0_compat. - red in |- *; intro; rewrite H6 in H0; elim (Rlt_irrefl _ H0). + red; intro; rewrite H6 in H0; elim (Rlt_irrefl _ H0). rewrite <- Rabs_mult. - unfold Rminus in |- *; rewrite Rmult_plus_distr_l. + unfold Rminus; rewrite Rmult_plus_distr_l. rewrite Ropp_0; rewrite Rmult_0_r. - unfold Rdiv in |- *; repeat rewrite <- Rmult_assoc. + unfold Rdiv; repeat rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. rewrite (Rabs_right (/ C0)). @@ -54,15 +54,15 @@ Proof. [ idtac | ring ]. unfold Rdiv in H4; apply H4; assumption. apply Rle_ge; left; apply Rinv_0_lt_compat; assumption. - red in |- *; intro; rewrite H6 in H0; elim (Rlt_irrefl _ H0). - unfold Majxy in |- *. - unfold C0 in |- *. + red; intro; rewrite H6 in H0; elim (Rlt_irrefl _ H0). + unfold Majxy. + unfold C0. rewrite pow_mult. - unfold C in |- *; reflexivity. - unfold C0 in |- *; apply pow_lt; assumption. + unfold C; reflexivity. + unfold C0; apply pow_lt; assumption. apply Rlt_le_trans with 1. apply Rlt_0_1. - unfold C in |- *. + unfold C. apply RmaxLess1. Qed. @@ -72,7 +72,7 @@ Lemma reste1_maj : Proof. intros. set (C := Rmax 1 (Rmax (Rabs x) (Rabs y))). - unfold Reste1 in |- *. + unfold Reste1. apply Rle_trans with (sum_f_R0 (fun k:nat => @@ -120,7 +120,7 @@ Proof. C ^ (2 * S (N + k))) (pred (N - k))) (pred N)). apply sum_Rle; intros. apply sum_Rle; intros. - unfold Rdiv in |- *; repeat rewrite Rabs_mult. + unfold Rdiv; repeat rewrite Rabs_mult. do 2 rewrite pow_1_abs. do 2 rewrite Rmult_1_l. rewrite (Rabs_right (/ INR (fact (2 * S (n0 + n))))). @@ -142,7 +142,7 @@ Proof. apply pow_incr. split. apply Rabs_pos. - unfold C in |- *. + unfold C. apply Rle_trans with (Rmax (Rabs x) (Rabs y)); apply RmaxLess2. apply Rle_trans with (C ^ (2 * S (n0 + n)) * C ^ (2 * (N - n0))). do 2 rewrite <- (Rmult_comm (C ^ (2 * (N - n0)))). @@ -150,11 +150,11 @@ Proof. apply pow_le. apply Rle_trans with 1. left; apply Rlt_0_1. - unfold C in |- *; apply RmaxLess1. + unfold C; apply RmaxLess1. apply pow_incr. split. apply Rabs_pos. - unfold C in |- *; apply Rle_trans with (Rmax (Rabs x) (Rabs y)). + unfold C; apply Rle_trans with (Rmax (Rabs x) (Rabs y)). apply RmaxLess1. apply RmaxLess2. right. @@ -203,7 +203,7 @@ Proof. left; apply Rinv_0_lt_compat. rewrite mult_INR; apply Rmult_lt_0_compat; apply INR_fact_lt_0. apply Rle_pow. - unfold C in |- *; apply RmaxLess1. + unfold C; apply RmaxLess1. replace (4 * N)%nat with (2 * (2 * N))%nat; [ idtac | ring ]. apply (fun m n p:nat => mult_le_compat_l p n m). replace (2 * N)%nat with (S (N + pred N)). @@ -223,33 +223,33 @@ Proof. apply pow_le. left; apply Rlt_le_trans with 1. apply Rlt_0_1. - unfold C in |- *; apply RmaxLess1. + unfold C; apply RmaxLess1. replace (/ INR (fact (2 * S (n0 + n)) * fact (2 * (N - n0)))) with (Binomial.C (2 * S (N + n)) (2 * S (n0 + n)) / INR (fact (2 * S (N + n)))). apply Rle_trans with (Binomial.C (2 * S (N + n)) (S (N + n)) / INR (fact (2 * S (N + n)))). - unfold Rdiv in |- *; + unfold Rdiv; do 2 rewrite <- (Rmult_comm (/ INR (fact (2 * S (N + n))))). apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. apply C_maj. omega. right. - unfold Rdiv in |- *; rewrite Rmult_comm. - unfold Binomial.C in |- *. - unfold Rdiv in |- *; repeat rewrite <- Rmult_assoc. + unfold Rdiv; rewrite Rmult_comm. + unfold Binomial.C. + unfold Rdiv; repeat rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. replace (2 * S (N + n) - S (N + n))%nat with (S (N + n)). rewrite Rinv_mult_distr. - unfold Rsqr in |- *; reflexivity. + unfold Rsqr; reflexivity. apply INR_fact_neq_0. apply INR_fact_neq_0. omega. apply INR_fact_neq_0. - unfold Rdiv in |- *; rewrite Rmult_comm. - unfold Binomial.C in |- *. - unfold Rdiv in |- *; repeat rewrite <- Rmult_assoc. + unfold Rdiv; rewrite Rmult_comm. + unfold Binomial.C. + unfold Rdiv; repeat rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. replace (2 * S (N + n) - 2 * S (n0 + n))%nat with (2 * (N - n0))%nat. @@ -271,17 +271,17 @@ Proof. apply pow_le. left; apply Rlt_le_trans with 1. apply Rlt_0_1. - unfold C in |- *; apply RmaxLess1. + unfold C; apply RmaxLess1. apply Rle_trans with (Rsqr (/ INR (fact (S (N + n)))) * INR N). apply Rmult_le_compat_l. apply Rle_0_sqr. apply le_INR. omega. - rewrite Rmult_comm; unfold Rdiv in |- *; apply Rmult_le_compat_l. + rewrite Rmult_comm; unfold Rdiv; apply Rmult_le_compat_l. apply pos_INR. apply Rle_trans with (/ INR (fact (S (N + n)))). - pattern (/ INR (fact (S (N + n)))) at 2 in |- *; rewrite <- Rmult_1_r. - unfold Rsqr in |- *. + pattern (/ INR (fact (S (N + n)))) at 2; rewrite <- Rmult_1_r. + unfold Rsqr. apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. apply Rmult_le_reg_l with (INR (fact (S (N + n)))). @@ -313,14 +313,14 @@ Proof. rewrite sum_cte. apply Rle_trans with (C ^ (4 * N) / INR (fact (pred N))). rewrite <- (Rmult_comm (C ^ (4 * N))). - unfold Rdiv in |- *; rewrite Rmult_assoc; apply Rmult_le_compat_l. + unfold Rdiv; rewrite Rmult_assoc; apply Rmult_le_compat_l. apply pow_le. left; apply Rlt_le_trans with 1. apply Rlt_0_1. - unfold C in |- *; apply RmaxLess1. + unfold C; apply RmaxLess1. cut (S (pred N) = N). intro; rewrite H0. - pattern N at 2 in |- *; rewrite <- H0. + pattern N at 2; rewrite <- H0. do 2 rewrite fact_simpl. rewrite H0. repeat rewrite mult_INR. @@ -329,7 +329,7 @@ Proof. repeat rewrite <- Rmult_assoc. rewrite <- Rinv_r_sym. rewrite Rmult_1_l. - pattern (/ INR (fact (pred N))) at 2 in |- *; rewrite <- Rmult_1_r. + pattern (/ INR (fact (pred N))) at 2; rewrite <- Rmult_1_r. rewrite Rmult_assoc. apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. @@ -340,19 +340,19 @@ Proof. apply le_INR; apply le_n_Sn. apply not_O_INR; discriminate. apply not_O_INR. - red in |- *; intro; rewrite H1 in H; elim (lt_irrefl _ H). + red; intro; rewrite H1 in H; elim (lt_irrefl _ H). apply not_O_INR. - red in |- *; intro; rewrite H1 in H; elim (lt_irrefl _ H). + red; intro; rewrite H1 in H; elim (lt_irrefl _ H). apply INR_fact_neq_0. apply not_O_INR; discriminate. apply prod_neq_R0. apply not_O_INR. - red in |- *; intro; rewrite H1 in H; elim (lt_irrefl _ H). + red; intro; rewrite H1 in H; elim (lt_irrefl _ H). apply INR_fact_neq_0. - symmetry in |- *; apply S_pred with 0%nat; assumption. + symmetry ; apply S_pred with 0%nat; assumption. right. - unfold Majxy in |- *. - unfold C in |- *. + unfold Majxy. + unfold C. replace (S (pred N)) with N. reflexivity. apply S_pred with 0%nat; assumption. @@ -363,7 +363,7 @@ Lemma reste2_maj : Proof. intros. set (C := Rmax 1 (Rmax (Rabs x) (Rabs y))). - unfold Reste2 in |- *. + unfold Reste2. apply Rle_trans with (sum_f_R0 (fun k:nat => @@ -415,7 +415,7 @@ Proof. pred N)). apply sum_Rle; intros. apply sum_Rle; intros. - unfold Rdiv in |- *; repeat rewrite Rabs_mult. + unfold Rdiv; repeat rewrite Rabs_mult. do 2 rewrite pow_1_abs. do 2 rewrite Rmult_1_l. rewrite (Rabs_right (/ INR (fact (2 * S (n0 + n) + 1)))). @@ -437,7 +437,7 @@ Proof. apply pow_incr. split. apply Rabs_pos. - unfold C in |- *. + unfold C. apply Rle_trans with (Rmax (Rabs x) (Rabs y)); apply RmaxLess2. apply Rle_trans with (C ^ (2 * S (n0 + n) + 1) * C ^ (2 * (N - n0) + 1)). do 2 rewrite <- (Rmult_comm (C ^ (2 * (N - n0) + 1))). @@ -445,11 +445,11 @@ Proof. apply pow_le. apply Rle_trans with 1. left; apply Rlt_0_1. - unfold C in |- *; apply RmaxLess1. + unfold C; apply RmaxLess1. apply pow_incr. split. apply Rabs_pos. - unfold C in |- *; apply Rle_trans with (Rmax (Rabs x) (Rabs y)). + unfold C; apply Rle_trans with (Rmax (Rabs x) (Rabs y)). apply RmaxLess1. apply RmaxLess2. right. @@ -477,7 +477,7 @@ Proof. left; apply Rinv_0_lt_compat. rewrite mult_INR; apply Rmult_lt_0_compat; apply INR_fact_lt_0. apply Rle_pow. - unfold C in |- *; apply RmaxLess1. + unfold C; apply RmaxLess1. replace (4 * S N)%nat with (2 * (2 * S N))%nat; [ idtac | ring ]. apply (fun m n p:nat => mult_le_compat_l p n m). replace (2 * S N)%nat with (S (S (N + N))). @@ -500,14 +500,14 @@ Proof. apply pow_le. left; apply Rlt_le_trans with 1. apply Rlt_0_1. - unfold C in |- *; apply RmaxLess1. + unfold C; apply RmaxLess1. replace (/ INR (fact (2 * S (n0 + n) + 1) * fact (2 * (N - n0) + 1))) with (Binomial.C (2 * S (S (N + n))) (2 * S (n0 + n) + 1) / INR (fact (2 * S (S (N + n))))). apply Rle_trans with (Binomial.C (2 * S (S (N + n))) (S (S (N + n))) / INR (fact (2 * S (S (N + n))))). - unfold Rdiv in |- *; + unfold Rdiv; do 2 rewrite <- (Rmult_comm (/ INR (fact (2 * S (S (N + n)))))). apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. @@ -518,21 +518,21 @@ Proof. ring. omega. right. - unfold Rdiv in |- *; rewrite Rmult_comm. - unfold Binomial.C in |- *. - unfold Rdiv in |- *; repeat rewrite <- Rmult_assoc. + unfold Rdiv; rewrite Rmult_comm. + unfold Binomial.C. + unfold Rdiv; repeat rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. replace (2 * S (S (N + n)) - S (S (N + n)))%nat with (S (S (N + n))). rewrite Rinv_mult_distr. - unfold Rsqr in |- *; reflexivity. + unfold Rsqr; reflexivity. apply INR_fact_neq_0. apply INR_fact_neq_0. omega. apply INR_fact_neq_0. - unfold Rdiv in |- *; rewrite Rmult_comm. - unfold Binomial.C in |- *. - unfold Rdiv in |- *; repeat rewrite <- Rmult_assoc. + unfold Rdiv; rewrite Rmult_comm. + unfold Binomial.C. + unfold Rdiv; repeat rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. replace (2 * S (S (N + n)) - (2 * S (n0 + n) + 1))%nat with @@ -556,7 +556,7 @@ Proof. apply pow_le. left; apply Rlt_le_trans with 1. apply Rlt_0_1. - unfold C in |- *; apply RmaxLess1. + unfold C; apply RmaxLess1. apply Rle_trans with (Rsqr (/ INR (fact (S (S (N + n))))) * INR N). apply Rmult_le_compat_l. apply Rle_0_sqr. @@ -564,11 +564,11 @@ Proof. apply le_INR. omega. omega. - rewrite Rmult_comm; unfold Rdiv in |- *; apply Rmult_le_compat_l. + rewrite Rmult_comm; unfold Rdiv; apply Rmult_le_compat_l. apply pos_INR. apply Rle_trans with (/ INR (fact (S (S (N + n))))). - pattern (/ INR (fact (S (S (N + n))))) at 2 in |- *; rewrite <- Rmult_1_r. - unfold Rsqr in |- *. + pattern (/ INR (fact (S (S (N + n))))) at 2; rewrite <- Rmult_1_r. + unfold Rsqr. apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. apply Rmult_le_reg_l with (INR (fact (S (S (N + n))))). @@ -599,11 +599,11 @@ Proof. rewrite sum_cte. apply Rle_trans with (C ^ (4 * S N) / INR (fact N)). rewrite <- (Rmult_comm (C ^ (4 * S N))). - unfold Rdiv in |- *; rewrite Rmult_assoc; apply Rmult_le_compat_l. + unfold Rdiv; rewrite Rmult_assoc; apply Rmult_le_compat_l. apply pow_le. left; apply Rlt_le_trans with 1. apply Rlt_0_1. - unfold C in |- *; apply RmaxLess1. + unfold C; apply RmaxLess1. cut (S (pred N) = N). intro; rewrite H0. do 2 rewrite fact_simpl. @@ -642,10 +642,10 @@ Proof. apply INR_fact_neq_0. apply not_O_INR; discriminate. apply prod_neq_R0; [ apply not_O_INR; discriminate | apply INR_fact_neq_0 ]. - symmetry in |- *; apply S_pred with 0%nat; assumption. + symmetry ; apply S_pred with 0%nat; assumption. right. - unfold Majxy in |- *. - unfold C in |- *. + unfold Majxy. + unfold C. reflexivity. Qed. @@ -654,10 +654,10 @@ Proof. intros. assert (H := Majxy_cv_R0 x y). unfold Un_cv in H; unfold R_dist in H. - unfold Un_cv in |- *; unfold R_dist in |- *; intros. + unfold Un_cv; unfold R_dist; intros. elim (H eps H0); intros N0 H1. exists (S N0); intros. - unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r. + unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r. apply Rle_lt_trans with (Rabs (Majxy x y (pred n))). rewrite (Rabs_right (Majxy x y (pred n))). apply reste1_maj. @@ -665,8 +665,8 @@ Proof. apply lt_O_Sn. assumption. apply Rle_ge. - unfold Majxy in |- *. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Majxy. + unfold Rdiv; apply Rmult_le_pos. apply pow_le. apply Rle_trans with 1. left; apply Rlt_0_1. @@ -674,7 +674,7 @@ Proof. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. replace (Majxy x y (pred n)) with (Majxy x y (pred n) - 0); [ idtac | ring ]. apply H1. - unfold ge in |- *; apply le_S_n. + unfold ge; apply le_S_n. replace (S (pred n)) with n. assumption. apply S_pred with 0%nat. @@ -686,10 +686,10 @@ Proof. intros. assert (H := Majxy_cv_R0 x y). unfold Un_cv in H; unfold R_dist in H. - unfold Un_cv in |- *; unfold R_dist in |- *; intros. + unfold Un_cv; unfold R_dist; intros. elim (H eps H0); intros N0 H1. exists (S N0); intros. - unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r. + unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r. apply Rle_lt_trans with (Rabs (Majxy x y n)). rewrite (Rabs_right (Majxy x y n)). apply reste2_maj. @@ -697,8 +697,8 @@ Proof. apply lt_O_Sn. assumption. apply Rle_ge. - unfold Majxy in |- *. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Majxy. + unfold Rdiv; apply Rmult_le_pos. apply pow_le. apply Rle_trans with 1. left; apply Rlt_0_1. @@ -706,7 +706,7 @@ Proof. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. replace (Majxy x y n) with (Majxy x y n - 0); [ idtac | ring ]. apply H1. - unfold ge in |- *; apply le_trans with (S N0). + unfold ge; apply le_trans with (S N0). apply le_n_Sn. exact H2. Qed. @@ -714,7 +714,7 @@ Qed. Lemma reste_cv_R0 : forall x y:R, Un_cv (Reste x y) 0. Proof. intros. - unfold Reste in |- *. + unfold Reste. set (An := fun n:nat => Reste2 x y n). set (Bn := fun n:nat => Reste1 x y (S n)). cut @@ -723,21 +723,21 @@ Proof. intro. apply H. apply CV_minus. - unfold An in |- *. + unfold An. replace (fun n:nat => Reste2 x y n) with (Reste2 x y). apply reste2_cv_R0. reflexivity. - unfold Bn in |- *. + unfold Bn. assert (H0 := reste1_cv_R0 x y). unfold Un_cv in H0; unfold R_dist in H0. - unfold Un_cv in |- *; unfold R_dist in |- *; intros. + unfold Un_cv; unfold R_dist; intros. elim (H0 eps H1); intros N0 H2. exists N0; intros. apply H2. - unfold ge in |- *; apply le_trans with (S N0). + unfold ge; apply le_trans with (S N0). apply le_n_Sn. apply le_n_S; assumption. - unfold An, Bn in |- *. + unfold An, Bn. intro. replace 0 with (0 - 0); [ idtac | ring ]. exact H. @@ -751,7 +751,7 @@ Proof. intros. apply UL_sequence with (C1 x y); assumption. apply C1_cvg. - unfold Un_cv in |- *; unfold R_dist in |- *. + unfold Un_cv; unfold R_dist. intros. assert (H0 := A1_cvg x). assert (H1 := A1_cvg y). @@ -764,7 +764,7 @@ Proof. unfold R_dist in H4; unfold R_dist in H5; unfold R_dist in H6. cut (0 < eps / 3); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ] ]. elim (H4 (eps / 3) H7); intros N1 H8. elim (H5 (eps / 3) H7); intros N2 H9. @@ -788,8 +788,8 @@ Proof. replace eps with (eps / 3 + (eps / 3 + eps / 3)). apply Rplus_lt_compat. apply H8. - unfold ge in |- *; apply le_trans with N. - unfold N in |- *. + unfold ge; apply le_trans with N. + unfold N. apply le_trans with (max N1 N2). apply le_max_l. apply le_trans with (max (max N1 N2) N3). @@ -804,12 +804,12 @@ Proof. rewrite <- Rabs_Ropp. rewrite Ropp_minus_distr. apply H9. - unfold ge in |- *; apply le_trans with (max N1 N2). + unfold ge; apply le_trans with (max N1 N2). apply le_max_r. apply le_S_n. rewrite <- H12. apply le_trans with N. - unfold N in |- *. + unfold N. apply le_n_S. apply le_trans with (max (max N1 N2) N3). apply le_max_l. @@ -817,35 +817,35 @@ Proof. assumption. replace (Reste x y (pred n)) with (Reste x y (pred n) - 0). apply H10. - unfold ge in |- *. + unfold ge. apply le_S_n. rewrite <- H12. apply le_trans with N. - unfold N in |- *. + unfold N. apply le_n_S. apply le_trans with (max (max N1 N2) N3). apply le_max_r. apply le_n_Sn. assumption. ring. - pattern eps at 4 in |- *; replace eps with (3 * (eps / 3)). + pattern eps at 4; replace eps with (3 * (eps / 3)). ring. - unfold Rdiv in |- *. + unfold Rdiv. rewrite <- Rmult_assoc. apply Rinv_r_simpl_m. discrR. apply lt_le_trans with (pred N). - unfold N in |- *; simpl in |- *; apply lt_O_Sn. + unfold N; simpl; apply lt_O_Sn. apply le_S_n. rewrite <- H12. replace (S (pred N)) with N. assumption. - unfold N in |- *; simpl in |- *; reflexivity. + unfold N; simpl; reflexivity. cut (0 < N)%nat. intro. cut (0 < n)%nat. intro. apply S_pred with 0%nat; assumption. apply lt_le_trans with N; assumption. - unfold N in |- *; apply lt_O_Sn. + unfold N; apply lt_O_Sn. Qed. diff --git a/theories/Reals/Cos_rel.v b/theories/Reals/Cos_rel.v index 73f3c0c6..9c7472fe 100644 --- a/theories/Reals/Cos_rel.v +++ b/theories/Reals/Cos_rel.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -10,7 +10,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. Require Import Rtrigo_def. -Open Local Scope R_scope. +Local Open Scope R_scope. Definition A1 (x:R) (N:nat) : R := sum_f_R0 (fun k:nat => (-1) ^ k / INR (fact (2 * k)) * x ^ (2 * k)) N. @@ -50,7 +50,7 @@ Theorem cos_plus_form : (0 < n)%nat -> A1 x (S n) * A1 y (S n) - B1 x n * B1 y n + Reste x y n = C1 x y (S n). intros. -unfold A1, B1 in |- *. +unfold A1, B1. rewrite (cauchy_finite (fun k:nat => (-1) ^ k / INR (fact (2 * k)) * x ^ (2 * k)) (fun k:nat => (-1) ^ k / INR (fact (2 * k)) * y ^ (2 * k)) ( @@ -60,7 +60,7 @@ rewrite (fun k:nat => (-1) ^ k / INR (fact (2 * k + 1)) * x ^ (2 * k + 1)) (fun k:nat => (-1) ^ k / INR (fact (2 * k + 1)) * y ^ (2 * k + 1)) n H) . -unfold Reste in |- *. +unfold Reste. replace (sum_f_R0 (fun k:nat => @@ -119,13 +119,13 @@ replace ((-1) ^ (k - p) / INR (fact (2 * (k - p) + 1)) * y ^ (2 * (k - p) + 1))) k) n) with (sum_f_R0 sin_nnn (S n)). rewrite <- sum_plus. -unfold C1 in |- *. +unfold C1. apply sum_eq; intros. induction i as [| i Hreci]. -simpl in |- *. -unfold C in |- *; simpl in |- *. +simpl. +unfold C; simpl. field; discrR. -unfold sin_nnn in |- *. +unfold sin_nnn. rewrite <- Rmult_plus_distr_l. apply Rmult_eq_compat_l. rewrite binomial. @@ -141,13 +141,13 @@ replace (sum_f_R0 (fun l:nat => Wn (S (2 * l))) i). apply sum_decomposition. apply sum_eq; intros. -unfold Wn in |- *. +unfold Wn. apply Rmult_eq_compat_l. replace (2 * S i - S (2 * i0))%nat with (S (2 * (i - i0))). reflexivity. omega. apply sum_eq; intros. -unfold Wn in |- *. +unfold Wn. apply Rmult_eq_compat_l. replace (2 * S i - 2 * i0)%nat with (2 * (S i - i0))%nat. reflexivity. @@ -177,11 +177,11 @@ change (pred (S n)) with n. (* replace (pred (S n)) with n; [ idtac | reflexivity ]. *) apply sum_eq; intros. rewrite Rmult_comm. -unfold sin_nnn in |- *. +unfold sin_nnn. rewrite scal_sum. rewrite scal_sum. apply sum_eq; intros. -unfold Rdiv in |- *. +unfold Rdiv. (*repeat rewrite Rmult_assoc.*) (* rewrite (Rmult_comm (/ INR (fact (2 * S i)))). *) repeat rewrite <- Rmult_assoc. @@ -193,13 +193,13 @@ replace (S (2 * i0)) with (2 * i0 + 1)%nat; [ idtac | ring ]. replace (S (2 * (i - i0))) with (2 * (i - i0) + 1)%nat; [ idtac | ring ]. replace ((-1) ^ S i) with (-1 * (-1) ^ i0 * (-1) ^ (i - i0)). ring. -simpl in |- *. -pattern i at 2 in |- *; replace i with (i0 + (i - i0))%nat. +simpl. +pattern i at 2; replace i with (i0 + (i - i0))%nat. rewrite pow_add. ring. -symmetry in |- *; apply le_plus_minus; assumption. -unfold C in |- *. -unfold Rdiv in |- *; repeat rewrite <- Rmult_assoc. +symmetry ; apply le_plus_minus; assumption. +unfold C. +unfold Rdiv; repeat rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. rewrite Rinv_mult_distr. @@ -217,7 +217,7 @@ apply lt_O_Sn. apply sum_eq; intros. rewrite scal_sum. apply sum_eq; intros. -unfold Rdiv in |- *. +unfold Rdiv. repeat rewrite <- Rmult_assoc. rewrite <- (Rmult_comm (/ INR (fact (2 * i)))). repeat rewrite <- Rmult_assoc. @@ -225,12 +225,12 @@ replace (/ INR (fact (2 * i)) * C (2 * i) (2 * i0)) with (/ INR (fact (2 * i0)) * / INR (fact (2 * (i - i0)))). replace ((-1) ^ i) with ((-1) ^ i0 * (-1) ^ (i - i0)). ring. -pattern i at 2 in |- *; replace i with (i0 + (i - i0))%nat. +pattern i at 2; replace i with (i0 + (i - i0))%nat. rewrite pow_add. ring. -symmetry in |- *; apply le_plus_minus; assumption. -unfold C in |- *. -unfold Rdiv in |- *; repeat rewrite <- Rmult_assoc. +symmetry ; apply le_plus_minus; assumption. +unfold C. +unfold Rdiv; repeat rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_l. rewrite Rinv_mult_distr. @@ -240,12 +240,12 @@ omega. apply INR_fact_neq_0. apply INR_fact_neq_0. apply INR_fact_neq_0. -unfold Reste2 in |- *; apply sum_eq; intros. +unfold Reste2; apply sum_eq; intros. apply sum_eq; intros. -unfold Rdiv in |- *; ring. -unfold Reste1 in |- *; apply sum_eq; intros. +unfold Rdiv; ring. +unfold Reste1; apply sum_eq; intros. apply sum_eq; intros. -unfold Rdiv in |- *; ring. +unfold Rdiv; ring. apply lt_O_Sn. Qed. @@ -266,10 +266,10 @@ unfold R_dist in p. cut (cos x = x0). intro. rewrite H0. -unfold Un_cv in |- *; unfold R_dist in |- *; intros. +unfold Un_cv; unfold R_dist; intros. elim (p eps H1); intros. exists x1; intros. -unfold A1 in |- *. +unfold A1. replace (sum_f_R0 (fun k:nat => (-1) ^ k / INR (fact (2 * k)) * x ^ (2 * k)) n) with (sum_f_R0 (fun i:nat => (-1) ^ i / INR (fact (2 * i)) * (x * x) ^ i) n). @@ -279,9 +279,9 @@ intros. replace ((x * x) ^ i) with (x ^ (2 * i)). reflexivity. apply pow_sqr. -unfold cos in |- *. +unfold cos. case (exist_cos (Rsqr x)). -unfold Rsqr in |- *; intros. +unfold Rsqr; intros. unfold cos_in in p_i. unfold cos_in in c. apply uniqueness_sum with (fun i:nat => cos_n i * (x * x) ^ i); assumption. @@ -298,10 +298,10 @@ unfold R_dist in p. cut (cos (x + y) = x0). intro. rewrite H0. -unfold Un_cv in |- *; unfold R_dist in |- *; intros. +unfold Un_cv; unfold R_dist; intros. elim (p eps H1); intros. exists x1; intros. -unfold C1 in |- *. +unfold C1. replace (sum_f_R0 (fun k:nat => (-1) ^ k / INR (fact (2 * k)) * (x + y) ^ (2 * k)) n) with @@ -313,9 +313,9 @@ intros. replace (((x + y) * (x + y)) ^ i) with ((x + y) ^ (2 * i)). reflexivity. apply pow_sqr. -unfold cos in |- *. +unfold cos. case (exist_cos (Rsqr (x + y))). -unfold Rsqr in |- *; intros. +unfold Rsqr; intros. unfold cos_in in p_i. unfold cos_in in c. apply uniqueness_sum with (fun i:nat => cos_n i * ((x + y) * (x + y)) ^ i); @@ -327,17 +327,17 @@ intro. case (Req_dec x 0); intro. rewrite H. rewrite sin_0. -unfold B1 in |- *. -unfold Un_cv in |- *; unfold R_dist in |- *; intros; exists 0%nat; intros. +unfold B1. +unfold Un_cv; unfold R_dist; intros; exists 0%nat; intros. replace (sum_f_R0 (fun k:nat => (-1) ^ k / INR (fact (2 * k + 1)) * 0 ^ (2 * k + 1)) n) with 0. -unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. +unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. induction n as [| n Hrecn]. -simpl in |- *; ring. +simpl; ring. rewrite tech5; rewrite <- Hrecn. -simpl in |- *; ring. -unfold ge in |- *; apply le_O_n. +simpl; ring. +unfold ge; apply le_O_n. assert (H0 := exist_sin (x * x)). elim H0; intros. assert (p_i := p). @@ -347,14 +347,14 @@ unfold R_dist in p. cut (sin x = x * x0). intro. rewrite H1. -unfold Un_cv in |- *; unfold R_dist in |- *; intros. +unfold Un_cv; unfold R_dist; intros. cut (0 < eps / Rabs x); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption ] ]. elim (p (eps / Rabs x) H3); intros. exists x1; intros. -unfold B1 in |- *. +unfold B1. replace (sum_f_R0 (fun k:nat => (-1) ^ k / INR (fact (2 * k + 1)) * x ^ (2 * k + 1)) n) with @@ -380,11 +380,11 @@ apply sum_eq. intros. rewrite pow_add. rewrite pow_sqr. -simpl in |- *. +simpl. ring. -unfold sin in |- *. +unfold sin. case (exist_sin (Rsqr x)). -unfold Rsqr in |- *; intros. +unfold Rsqr; intros. unfold sin_in in p_i. unfold sin_in in s. assert diff --git a/theories/Reals/DiscrR.v b/theories/Reals/DiscrR.v index 144de09e..1ec399d1 100644 --- a/theories/Reals/DiscrR.v +++ b/theories/Reals/DiscrR.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -8,7 +8,7 @@ Require Import RIneq. Require Import Omega. -Open Local Scope R_scope. +Local Open Scope R_scope. Lemma Rlt_R0_R2 : 0 < 2. change 2 with (INR 2); apply lt_INR_0; apply lt_O_Sn. @@ -21,7 +21,7 @@ intros; rewrite H; reflexivity. Qed. Lemma IZR_neq : forall z1 z2:Z, z1 <> z2 -> IZR z1 <> IZR z2. -intros; red in |- *; intro; elim H; apply eq_IZR; assumption. +intros; red; intro; elim H; apply eq_IZR; assumption. Qed. Ltac discrR := @@ -45,7 +45,7 @@ Ltac prove_sup0 := repeat (apply Rmult_lt_0_compat || apply Rplus_lt_pos; try apply Rlt_0_1 || apply Rlt_R0_R2) - | |- (?X1 > 0) => change (0 < X1) in |- *; prove_sup0 + | |- (?X1 > 0) => change (0 < X1); prove_sup0 end. Ltac omega_sup := @@ -59,7 +59,7 @@ Ltac omega_sup := Ltac prove_sup := match goal with - | |- (?X1 > ?X2) => change (X2 < X1) in |- *; prove_sup + | |- (?X1 > ?X2) => change (X2 < X1); prove_sup | |- (0 < ?X1) => prove_sup0 | |- (- ?X1 < 0) => rewrite <- Ropp_0; prove_sup | |- (- ?X1 < - ?X2) => apply Ropp_lt_gt_contravar; prove_sup diff --git a/theories/Reals/Exp_prop.v b/theories/Reals/Exp_prop.v index dd97b865..b65ab045 100644 --- a/theories/Reals/Exp_prop.v +++ b/theories/Reals/Exp_prop.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,23 +9,23 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. -Require Import Rtrigo. +Require Import Rtrigo1. Require Import Ranalysis1. Require Import PSeries_reg. Require Import Div2. Require Import Even. Require Import Max. -Open Local Scope nat_scope. -Open Local Scope R_scope. +Local Open Scope nat_scope. +Local Open Scope R_scope. Definition E1 (x:R) (N:nat) : R := sum_f_R0 (fun k:nat => / INR (fact k) * x ^ k) N. Lemma E1_cvg : forall x:R, Un_cv (E1 x) (exp x). Proof. - intro; unfold exp in |- *; unfold projT1 in |- *. + intro; unfold exp; unfold projT1. case (exist_exp x); intro. - unfold exp_in, Un_cv in |- *; unfold infinite_sum, E1 in |- *; trivial. + unfold exp_in, Un_cv; unfold infinite_sum, E1; trivial. Qed. Definition Reste_E (x y:R) (N:nat) : R := @@ -41,14 +41,14 @@ Lemma exp_form : forall (x y:R) (n:nat), (0 < n)%nat -> E1 x n * E1 y n - Reste_E x y n = E1 (x + y) n. Proof. - intros; unfold E1 in |- *. + intros; unfold E1. rewrite cauchy_finite. - unfold Reste_E in |- *; unfold Rminus in |- *; rewrite Rplus_assoc; + unfold Reste_E; unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_r; rewrite Rplus_0_r; apply sum_eq; intros. rewrite binomial. rewrite scal_sum; apply sum_eq; intros. - unfold C in |- *; unfold Rdiv in |- *; repeat rewrite Rmult_assoc; + unfold C; unfold Rdiv; repeat rewrite Rmult_assoc; rewrite (Rmult_comm (INR (fact i))); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r; rewrite Rinv_mult_distr. @@ -64,27 +64,13 @@ Definition maj_Reste_E (x y:R) (N:nat) : R := (Rmax 1 (Rmax (Rabs x) (Rabs y)) ^ (2 * N) / Rsqr (INR (fact (div2 (pred N))))). -Lemma Rle_Rinv : forall x y:R, 0 < x -> 0 < y -> x <= y -> / y <= / x. -Proof. - intros; apply Rmult_le_reg_l with x. - apply H. - rewrite <- Rinv_r_sym. - apply Rmult_le_reg_l with y. - apply H0. - rewrite Rmult_1_r; rewrite Rmult_comm; rewrite Rmult_assoc; - rewrite <- Rinv_l_sym. - rewrite Rmult_1_r; apply H1. - red in |- *; intro; rewrite H2 in H0; elim (Rlt_irrefl _ H0). - red in |- *; intro; rewrite H2 in H; elim (Rlt_irrefl _ H). -Qed. - (**********) Lemma div2_double : forall N:nat, div2 (2 * N) = N. Proof. intro; induction N as [| N HrecN]. reflexivity. replace (2 * S N)%nat with (S (S (2 * N))). - simpl in |- *; simpl in HrecN; rewrite HrecN; reflexivity. + simpl; simpl in HrecN; rewrite HrecN; reflexivity. ring. Qed. @@ -93,7 +79,7 @@ Proof. intro; induction N as [| N HrecN]. reflexivity. replace (2 * S N)%nat with (S (S (2 * N))). - simpl in |- *; simpl in HrecN; rewrite HrecN; reflexivity. + simpl; simpl in HrecN; rewrite HrecN; reflexivity. ring. Qed. @@ -107,7 +93,7 @@ Proof. elim H2; intro. rewrite <- (even_div2 _ a); apply HrecN; assumption. rewrite <- (odd_div2 _ b); apply lt_O_Sn. - rewrite H1; simpl in |- *; apply lt_O_Sn. + rewrite H1; simpl; apply lt_O_Sn. inversion H. right; reflexivity. left; apply lt_le_trans with 2%nat; [ apply lt_n_Sn | apply H1 ]. @@ -124,7 +110,7 @@ Proof. (fun k:nat => sum_f_R0 (fun l:nat => / Rsqr (INR (fact (div2 (S N))))) (pred (N - k))) (pred N)). - unfold Reste_E in |- *. + unfold Reste_E. apply Rle_trans with (sum_f_R0 (fun k:nat => @@ -203,25 +189,25 @@ Proof. apply Rabs_pos. apply Rle_trans with (Rmax (Rabs x) (Rabs y)). apply RmaxLess1. - unfold M in |- *; apply RmaxLess2. + unfold M; apply RmaxLess2. apply Rle_trans with (M ^ S (n0 + n) * M ^ (N - n0)). apply Rmult_le_compat_l. apply pow_le; apply Rle_trans with 1. left; apply Rlt_0_1. - unfold M in |- *; apply RmaxLess1. + unfold M; apply RmaxLess1. apply pow_incr; split. apply Rabs_pos. apply Rle_trans with (Rmax (Rabs x) (Rabs y)). apply RmaxLess2. - unfold M in |- *; apply RmaxLess2. + unfold M; apply RmaxLess2. rewrite <- pow_add; replace (S (n0 + n) + (N - n0))%nat with (N + S n)%nat. apply Rle_pow. - unfold M in |- *; apply RmaxLess1. + unfold M; apply RmaxLess1. replace (2 * N)%nat with (N + N)%nat; [ idtac | ring ]. apply plus_le_compat_l. replace N with (S (pred N)). apply le_n_S; apply H0. - symmetry in |- *; apply S_pred with 0%nat; apply H. + symmetry ; apply S_pred with 0%nat; apply H. apply INR_eq; do 2 rewrite plus_INR; do 2 rewrite S_INR; rewrite plus_INR; rewrite minus_INR. ring. @@ -260,7 +246,7 @@ Proof. apply pow_le. apply Rle_trans with 1. left; apply Rlt_0_1. - unfold M in |- *; apply RmaxLess1. + unfold M; apply RmaxLess1. assert (H2 := even_odd_cor N). elim H2; intros N0 H3. elim H3; intro. @@ -276,9 +262,9 @@ Proof. apply le_n_Sn. replace (/ INR (fact n0) * / INR (fact (N - n0))) with (C N n0 / INR (fact N)). - pattern N at 1 in |- *; rewrite H4. + pattern N at 1; rewrite H4. apply Rle_trans with (C N N0 / INR (fact N)). - unfold Rdiv in |- *; do 2 rewrite <- (Rmult_comm (/ INR (fact N))). + unfold Rdiv; do 2 rewrite <- (Rmult_comm (/ INR (fact N))). apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. rewrite H4. @@ -308,7 +294,7 @@ Proof. apply le_pred_n. replace (C N N0 / INR (fact N)) with (/ Rsqr (INR (fact N0))). rewrite H4; rewrite div2_S_double; right; reflexivity. - unfold Rsqr, C, Rdiv in |- *. + unfold Rsqr, C, Rdiv. repeat rewrite Rinv_mult_distr. rewrite (Rmult_comm (INR (fact N))). repeat rewrite Rmult_assoc. @@ -316,7 +302,7 @@ Proof. rewrite Rmult_1_r; replace (N - N0)%nat with N0. ring. replace N with (N0 + N0)%nat. - symmetry in |- *; apply minus_plus. + symmetry ; apply minus_plus. rewrite H4. ring. apply INR_fact_neq_0. @@ -324,7 +310,7 @@ Proof. apply INR_fact_neq_0. apply INR_fact_neq_0. apply INR_fact_neq_0. - unfold C, Rdiv in |- *. + unfold C, Rdiv. rewrite (Rmult_comm (INR (fact N))). repeat rewrite Rmult_assoc. rewrite <- Rinv_r_sym. @@ -336,7 +322,7 @@ Proof. replace (/ INR (fact (S n0)) * / INR (fact (N - n0))) with (C (S N) (S n0) / INR (fact (S N))). apply Rle_trans with (C (S N) (S N0) / INR (fact (S N))). - unfold Rdiv in |- *; do 2 rewrite <- (Rmult_comm (/ INR (fact (S N)))). + unfold Rdiv; do 2 rewrite <- (Rmult_comm (/ INR (fact (S N)))). apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. cut (S N = (2 * S N0)%nat). @@ -371,7 +357,7 @@ Proof. replace (C (S N) (S N0) / INR (fact (S N))) with (/ Rsqr (INR (fact (S N0)))). rewrite H5; rewrite div2_double. right; reflexivity. - unfold Rsqr, C, Rdiv in |- *. + unfold Rsqr, C, Rdiv. repeat rewrite Rinv_mult_distr. replace (S N - S N0)%nat with (S N0). rewrite (Rmult_comm (INR (fact (S N)))). @@ -380,14 +366,14 @@ Proof. rewrite Rmult_1_r; reflexivity. apply INR_fact_neq_0. replace (S N) with (S N0 + S N0)%nat. - symmetry in |- *; apply minus_plus. + symmetry ; apply minus_plus. rewrite H5; ring. apply INR_fact_neq_0. apply INR_fact_neq_0. apply INR_fact_neq_0. apply INR_fact_neq_0. rewrite H4; ring. - unfold C, Rdiv in |- *. + unfold C, Rdiv. rewrite (Rmult_comm (INR (fact (S N)))). rewrite Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_r; rewrite Rinv_mult_distr. @@ -395,8 +381,8 @@ Proof. apply INR_fact_neq_0. apply INR_fact_neq_0. apply INR_fact_neq_0. - unfold maj_Reste_E in |- *. - unfold Rdiv in |- *; rewrite (Rmult_comm 4). + unfold maj_Reste_E. + unfold Rdiv; rewrite (Rmult_comm 4). rewrite Rmult_assoc. apply Rmult_le_compat_l. apply pow_le. @@ -447,7 +433,7 @@ Proof. cut (INR N <= INR (2 * div2 (S N))). intro; apply Rmult_le_reg_l with (Rsqr (INR (div2 (S N)))). apply Rsqr_pos_lt. - apply not_O_INR; red in |- *; intro. + apply not_O_INR; red; intro. cut (1 < S N)%nat. intro; assert (H4 := div2_not_R0 _ H3). rewrite H2 in H4; elim (lt_n_O _ H4). @@ -470,17 +456,17 @@ Proof. apply lt_INR_0; apply div2_not_R0. apply lt_n_S; apply H. cut (1 < S N)%nat. - intro; unfold Rsqr in |- *; apply prod_neq_R0; apply not_O_INR; intro; + intro; unfold Rsqr; apply prod_neq_R0; apply not_O_INR; intro; assert (H4 := div2_not_R0 _ H2); rewrite H3 in H4; elim (lt_n_O _ H4). apply lt_n_S; apply H. assert (H1 := even_odd_cor N). elim H1; intros N0 H2. elim H2; intro. - pattern N at 2 in |- *; rewrite H3. + pattern N at 2; rewrite H3. rewrite div2_S_double. right; rewrite H3; reflexivity. - pattern N at 2 in |- *; rewrite H3. + pattern N at 2; rewrite H3. replace (S (S (2 * N0))) with (2 * S N0)%nat. rewrite div2_double. rewrite H3. @@ -489,12 +475,12 @@ Proof. rewrite Rmult_plus_distr_l. apply Rplus_le_compat_l. rewrite Rmult_1_r. - simpl in |- *. - pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; + simpl. + pattern 1 at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; apply Rlt_0_1. ring. - unfold Rsqr in |- *; apply prod_neq_R0; apply INR_fact_neq_0. - unfold Rsqr in |- *; apply prod_neq_R0; apply not_O_INR; discriminate. + unfold Rsqr; apply prod_neq_R0; apply INR_fact_neq_0. + unfold Rsqr; apply prod_neq_R0; apply not_O_INR; discriminate. assert (H0 := even_odd_cor N). elim H0; intros N0 H1. elim H1; intro. @@ -520,15 +506,15 @@ Qed. Lemma maj_Reste_cv_R0 : forall x y:R, Un_cv (maj_Reste_E x y) 0. Proof. intros; assert (H := Majxy_cv_R0 x y). - unfold Un_cv in H; unfold Un_cv in |- *; intros. + unfold Un_cv in H; unfold Un_cv; intros. cut (0 < eps / 4); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ] ]. elim (H _ H1); intros N0 H2. exists (max (2 * S N0) 2); intros. - unfold R_dist in H2; unfold R_dist in |- *; rewrite Rminus_0_r; - unfold Majxy in H2; unfold maj_Reste_E in |- *. + unfold R_dist in H2; unfold R_dist; rewrite Rminus_0_r; + unfold Majxy in H2; unfold maj_Reste_E. rewrite Rabs_right. apply Rle_lt_trans with (4 * @@ -536,7 +522,7 @@ Proof. INR (fact (div2 (pred n))))). apply Rmult_le_compat_l. left; prove_sup0. - unfold Rdiv, Rsqr in |- *; rewrite Rinv_mult_distr. + unfold Rdiv, Rsqr; rewrite Rinv_mult_distr. rewrite (Rmult_comm (Rmax 1 (Rmax (Rabs x) (Rabs y)) ^ (2 * n))); rewrite (Rmult_comm (Rmax 1 (Rmax (Rabs x) (Rabs y)) ^ (4 * S (div2 (pred n))))) @@ -544,7 +530,7 @@ Proof. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. apply Rle_trans with (Rmax 1 (Rmax (Rabs x) (Rabs y)) ^ (2 * n)). rewrite Rmult_comm; - pattern (Rmax 1 (Rmax (Rabs x) (Rabs y)) ^ (2 * n)) at 2 in |- *; + pattern (Rmax 1 (Rmax (Rabs x) (Rabs y)) ^ (2 * n)) at 2; rewrite <- Rmult_1_r; apply Rmult_le_compat_l. apply pow_le; apply Rle_trans with 1. left; apply Rlt_0_1. @@ -598,11 +584,11 @@ Proof. (Rabs (Rmax 1 (Rmax (Rabs x) (Rabs y)) ^ (4 * S (div2 (pred n))) / INR (fact (div2 (pred n))) - 0)). - apply H2; unfold ge in |- *. + apply H2; unfold ge. cut (2 * S N0 <= n)%nat. intro; apply le_S_n. apply INR_le; apply Rmult_le_reg_l with (INR 2). - simpl in |- *; prove_sup0. + simpl; prove_sup0. do 2 rewrite <- mult_INR; apply le_INR. apply le_trans with n. apply H4. @@ -620,12 +606,12 @@ Proof. apply S_pred with 0%nat; apply H8. replace (2 * N1)%nat with (S (S (2 * pred N1))). reflexivity. - pattern N1 at 2 in |- *; replace N1 with (S (pred N1)). + pattern N1 at 2; replace N1 with (S (pred N1)). ring. - symmetry in |- *; apply S_pred with 0%nat; apply H8. + symmetry ; apply S_pred with 0%nat; apply H8. apply INR_lt. apply Rmult_lt_reg_l with (INR 2). - simpl in |- *; prove_sup0. + simpl; prove_sup0. rewrite Rmult_0_r; rewrite <- mult_INR. apply lt_INR_0. rewrite <- H7. @@ -646,7 +632,7 @@ Proof. apply H3. rewrite Rminus_0_r; apply Rabs_right. apply Rle_ge. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Rdiv; apply Rmult_le_pos. apply pow_le. apply Rle_trans with 1. left; apply Rlt_0_1. @@ -654,7 +640,7 @@ Proof. left; apply Rinv_0_lt_compat; apply INR_fact_lt_0. discrR. apply Rle_ge. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Rdiv; apply Rmult_le_pos. left; prove_sup0. apply Rmult_le_pos. apply pow_le. @@ -668,9 +654,9 @@ Qed. Lemma Reste_E_cv : forall x y:R, Un_cv (Reste_E x y) 0. Proof. intros; assert (H := maj_Reste_cv_R0 x y). - unfold Un_cv in H; unfold Un_cv in |- *; intros; elim (H _ H0); intros. + unfold Un_cv in H; unfold Un_cv; intros; elim (H _ H0); intros. exists (max x0 1); intros. - unfold R_dist in |- *; rewrite Rminus_0_r. + unfold R_dist; rewrite Rminus_0_r. apply Rle_lt_trans with (maj_Reste_E x y n). apply Reste_E_maj. apply lt_le_trans with 1%nat. @@ -680,10 +666,10 @@ Proof. apply H2. replace (maj_Reste_E x y n) with (R_dist (maj_Reste_E x y n) 0). apply H1. - unfold ge in |- *; apply le_trans with (max x0 1). + unfold ge; apply le_trans with (max x0 1). apply le_max_l. apply H2. - unfold R_dist in |- *; rewrite Rminus_0_r; apply Rabs_right. + unfold R_dist; rewrite Rminus_0_r; apply Rabs_right. apply Rle_ge; apply Rle_trans with (Rabs (Reste_E x y n)). apply Rabs_pos. apply Reste_E_maj. @@ -704,13 +690,13 @@ Proof. apply H1. assert (H2 := CV_mult _ _ _ _ H0 H). assert (H3 := CV_minus _ _ _ _ H2 (Reste_E_cv x y)). - unfold Un_cv in |- *; unfold Un_cv in H3; intros. + unfold Un_cv; unfold Un_cv in H3; intros. elim (H3 _ H4); intros. exists (S x0); intros. rewrite <- (exp_form x y n). rewrite Rminus_0_r in H5. apply H5. - unfold ge in |- *; apply le_trans with (S x0). + unfold ge; apply le_trans with (S x0). apply le_n_Sn. apply H6. apply lt_le_trans with (S x0). @@ -724,15 +710,15 @@ Proof. intros; set (An := fun N:nat => / INR (fact N) * x ^ N). cut (Un_cv (fun n:nat => sum_f_R0 An n) (exp x)). intro; apply Rlt_le_trans with (sum_f_R0 An 0). - unfold An in |- *; simpl in |- *; rewrite Rinv_1; rewrite Rmult_1_r; + unfold An; simpl; rewrite Rinv_1; rewrite Rmult_1_r; apply Rlt_0_1. apply sum_incr. assumption. - intro; unfold An in |- *; left; apply Rmult_lt_0_compat. + intro; unfold An; left; apply Rmult_lt_0_compat. apply Rinv_0_lt_compat; apply INR_fact_lt_0. apply (pow_lt _ n H). - unfold exp in |- *; unfold projT1 in |- *; case (exist_exp x); intro. - unfold exp_in in |- *; unfold infinite_sum, Un_cv in |- *; trivial. + unfold exp; unfold projT1; case (exist_exp x); intro. + unfold exp_in; unfold infinite_sum, Un_cv; trivial. Qed. (**********) @@ -743,12 +729,12 @@ Proof. apply (exp_pos_pos _ a). rewrite <- b; rewrite exp_0; apply Rlt_0_1. replace (exp x) with (1 / exp (- x)). - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. apply Rlt_0_1. apply Rinv_0_lt_compat; apply exp_pos_pos. apply (Ropp_0_gt_lt_contravar _ r). cut (exp (- x) <> 0). - intro; unfold Rdiv in |- *; apply Rmult_eq_reg_l with (exp (- x)). + intro; unfold Rdiv; apply Rmult_eq_reg_l with (exp (- x)). rewrite Rmult_1_l; rewrite <- Rinv_r_sym. rewrite <- exp_plus. rewrite Rplus_opp_l; rewrite exp_0; reflexivity. @@ -756,7 +742,7 @@ Proof. apply H. assert (H := exp_plus x (- x)). rewrite Rplus_opp_r in H; rewrite exp_0 in H. - red in |- *; intro; rewrite H0 in H. + red; intro; rewrite H0 in H. rewrite Rmult_0_r in H. elim R1_neq_R0; assumption. Qed. @@ -764,7 +750,7 @@ Qed. (* ((exp h)-1)/h -> 0 quand h->0 *) Lemma derivable_pt_lim_exp_0 : derivable_pt_lim exp 0 1. Proof. - unfold derivable_pt_lim in |- *; intros. + unfold derivable_pt_lim; intros. set (fn := fun (N:nat) (x:R) => x ^ N / INR (fact (S N))). cut (CVN_R fn). intro; cut (forall x:R, { l:R | Un_cv (fun N:nat => SP fn N x) l }). @@ -782,41 +768,41 @@ Proof. replace 1 with (SFL fn cv 0). apply H5. split. - unfold D_x, no_cond in |- *; split. + unfold D_x, no_cond; split. trivial. - apply (sym_not_eq H6). + apply (not_eq_sym H6). rewrite Rminus_0_r; apply H7. - unfold SFL in |- *. + unfold SFL. case (cv 0); intros. eapply UL_sequence. apply u. - unfold Un_cv, SP in |- *. + unfold Un_cv, SP. intros; exists 1%nat; intros. - unfold R_dist in |- *; rewrite decomp_sum. + unfold R_dist; rewrite decomp_sum. rewrite (Rplus_comm (fn 0%nat 0)). replace (fn 0%nat 0) with 1. - unfold Rminus in |- *; rewrite Rplus_assoc; rewrite Rplus_opp_r; + unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_r; rewrite Rplus_0_r. replace (sum_f_R0 (fun i:nat => fn (S i) 0) (pred n)) with 0. rewrite Rabs_R0; apply H8. - symmetry in |- *; apply sum_eq_R0; intros. - unfold fn in |- *. - simpl in |- *. - unfold Rdiv in |- *; do 2 rewrite Rmult_0_l; reflexivity. - unfold fn in |- *; simpl in |- *. - unfold Rdiv in |- *; rewrite Rinv_1; rewrite Rmult_1_r; reflexivity. + symmetry ; apply sum_eq_R0; intros. + unfold fn. + simpl. + unfold Rdiv; do 2 rewrite Rmult_0_l; reflexivity. + unfold fn; simpl. + unfold Rdiv; rewrite Rinv_1; rewrite Rmult_1_r; reflexivity. apply lt_le_trans with 1%nat; [ apply lt_n_Sn | apply H9 ]. - unfold SFL, exp in |- *. + unfold SFL, exp. case (cv h); case (exist_exp h); simpl; intros. eapply UL_sequence. apply u. - unfold Un_cv in |- *; intros. + unfold Un_cv; intros. unfold exp_in in e. unfold infinite_sum in e. cut (0 < eps0 * Rabs h). intro; elim (e _ H9); intros N0 H10. exists N0; intros. - unfold R_dist in |- *. + unfold R_dist. apply Rmult_lt_reg_l with (Rabs h). apply Rabs_pos_lt; assumption. rewrite <- Rabs_mult. @@ -827,47 +813,47 @@ Proof. (sum_f_R0 (fun i:nat => / INR (fact i) * h ^ i) (S n) - x). rewrite (Rmult_comm (Rabs h)). apply H10. - unfold ge in |- *. + unfold ge. apply le_trans with (S N0). apply le_n_Sn. apply le_n_S; apply H11. rewrite decomp_sum. replace (/ INR (fact 0) * h ^ 0) with 1. - unfold Rminus in |- *. + unfold Rminus. rewrite Ropp_plus_distr. rewrite Ropp_involutive. rewrite <- (Rplus_comm (- x)). rewrite <- (Rplus_comm (- x + 1)). rewrite Rplus_assoc; repeat apply Rplus_eq_compat_l. replace (pred (S n)) with n; [ idtac | reflexivity ]. - unfold SP in |- *. + unfold SP. rewrite scal_sum. apply sum_eq; intros. - unfold fn in |- *. + unfold fn. replace (h ^ S i) with (h * h ^ i). - unfold Rdiv in |- *; ring. - simpl in |- *; ring. - simpl in |- *; rewrite Rinv_1; rewrite Rmult_1_r; reflexivity. + unfold Rdiv; ring. + simpl; ring. + simpl; rewrite Rinv_1; rewrite Rmult_1_r; reflexivity. apply lt_O_Sn. - unfold Rdiv in |- *. + unfold Rdiv. rewrite <- Rmult_assoc. - symmetry in |- *; apply Rinv_r_simpl_m. + symmetry ; apply Rinv_r_simpl_m. assumption. apply Rmult_lt_0_compat. apply H8. apply Rabs_pos_lt; assumption. apply SFL_continuity; assumption. - intro; unfold fn in |- *. + intro; unfold fn. replace (fun x:R => x ^ n / INR (fact (S n))) with (pow_fct n / fct_cte (INR (fact (S n))))%F; [ idtac | reflexivity ]. apply continuity_div. apply derivable_continuous; apply (derivable_pow n). apply derivable_continuous; apply derivable_const. - intro; unfold fct_cte in |- *; apply INR_fact_neq_0. + intro; unfold fct_cte; apply INR_fact_neq_0. apply (CVN_R_CVS _ X). assert (H0 := Alembert_exp). - unfold CVN_R in |- *. - intro; unfold CVN_r in |- *. + unfold CVN_R. + intro; unfold CVN_r. exists (fun N:nat => r ^ N / INR (fact (S N))). cut { l:R | @@ -879,10 +865,10 @@ Proof. exists x; intros. split. apply p. - unfold Boule in |- *; intros. + unfold Boule; intros. rewrite Rminus_0_r in H1. - unfold fn in |- *. - unfold Rdiv in |- *; rewrite Rabs_mult. + unfold fn. + unfold Rdiv; rewrite Rabs_mult. cut (0 < INR (fact (S n))). intro. rewrite (Rabs_right (/ INR (fact (S n)))). @@ -897,14 +883,14 @@ Proof. cut ((r:R) <> 0). intro; apply Alembert_C2. intro; apply Rabs_no_R0. - unfold Rdiv in |- *; apply prod_neq_R0. + unfold Rdiv; apply prod_neq_R0. apply pow_nonzero; assumption. apply Rinv_neq_0_compat; apply INR_fact_neq_0. unfold Un_cv in H0. - unfold Un_cv in |- *; intros. + unfold Un_cv; intros. cut (0 < eps0 / r); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; apply (cond_pos r) ] ]. elim (H0 _ H3); intros N0 H4. exists N0; intros. @@ -913,7 +899,7 @@ Proof. assert (H6 := H4 _ hyp_sn). unfold R_dist in H6; rewrite Rminus_0_r in H6. rewrite Rabs_Rabsolu in H6. - unfold R_dist in |- *; rewrite Rminus_0_r. + unfold R_dist; rewrite Rminus_0_r. rewrite Rabs_Rabsolu. replace (Rabs (r ^ S n / INR (fact (S (S n)))) / Rabs (r ^ n / INR (fact (S n)))) @@ -927,7 +913,7 @@ Proof. apply H6. assumption. apply Rle_ge; left; apply (cond_pos r). - unfold Rdiv in |- *. + unfold Rdiv. repeat rewrite Rabs_mult. repeat rewrite Rabs_Rinv. rewrite Rinv_mult_distr. @@ -940,7 +926,7 @@ Proof. rewrite (Rmult_comm r). rewrite <- Rmult_assoc; rewrite <- (Rmult_comm (INR (fact (S n)))). apply Rmult_eq_compat_l. - simpl in |- *. + simpl. rewrite Rmult_assoc; rewrite <- Rinv_r_sym. ring. apply pow_nonzero; assumption. @@ -953,10 +939,10 @@ Proof. apply Rinv_neq_0_compat; apply Rabs_no_R0; apply INR_fact_neq_0. apply INR_fact_neq_0. apply INR_fact_neq_0. - unfold ge in |- *; apply le_trans with n. + unfold ge; apply le_trans with n. apply H5. apply le_n_Sn. - assert (H1 := cond_pos r); red in |- *; intro; rewrite H2 in H1; + assert (H1 := cond_pos r); red; intro; rewrite H2 in H1; elim (Rlt_irrefl _ H1). Qed. @@ -964,10 +950,10 @@ Qed. Lemma derivable_pt_lim_exp : forall x:R, derivable_pt_lim exp x (exp x). Proof. intro; assert (H0 := derivable_pt_lim_exp_0). - unfold derivable_pt_lim in H0; unfold derivable_pt_lim in |- *; intros. + unfold derivable_pt_lim in H0; unfold derivable_pt_lim; intros. cut (0 < eps / exp x); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ apply H | apply Rinv_0_lt_compat; apply exp_pos ] ]. elim (H0 _ H1); intros del H2. exists del; intros. @@ -981,11 +967,11 @@ Proof. rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_l; rewrite <- (Rmult_comm eps). apply H5. - assert (H6 := exp_pos x); red in |- *; intro; rewrite H7 in H6; + assert (H6 := exp_pos x); red; intro; rewrite H7 in H6; elim (Rlt_irrefl _ H6). apply Rle_ge; left; apply exp_pos. rewrite Rmult_minus_distr_l. - rewrite Rmult_1_r; unfold Rdiv in |- *; rewrite <- Rmult_assoc; + rewrite Rmult_1_r; unfold Rdiv; rewrite <- Rmult_assoc; rewrite Rmult_minus_distr_l. rewrite Rmult_1_r; rewrite exp_plus; reflexivity. Qed. diff --git a/theories/Reals/Integration.v b/theories/Reals/Integration.v index da1742ca..d7b3ab04 100644 --- a/theories/Reals/Integration.v +++ b/theories/Reals/Integration.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) diff --git a/theories/Reals/LegacyRfield.v b/theories/Reals/LegacyRfield.v index 49a94021..c45d1c5f 100644 --- a/theories/Reals/LegacyRfield.v +++ b/theories/Reals/LegacyRfield.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -17,9 +17,9 @@ Open Scope R_scope. Lemma RLegacyTheory : Ring_Theory Rplus Rmult 1 0 Ropp (fun x y:R => false). split. exact Rplus_comm. - symmetry in |- *; apply Rplus_assoc. + symmetry ; apply Rplus_assoc. exact Rmult_comm. - symmetry in |- *; apply Rmult_assoc. + symmetry ; apply Rmult_assoc. intro; apply Rplus_0_l. intro; apply Rmult_1_l. exact Rplus_opp_r. diff --git a/theories/Reals/MVT.v b/theories/Reals/MVT.v index 29ebd46d..2ee22b6d 100644 --- a/theories/Reals/MVT.v +++ b/theories/Reals/MVT.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -10,7 +10,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import Ranalysis1. Require Import Rtopology. -Open Local Scope R_scope. +Local Open Scope R_scope. (* The Mean Value Theorem *) Theorem MVT : @@ -55,13 +55,13 @@ Proof. split. apply Rmult_lt_reg_l with 2. prove_sup0. - unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; apply H. discrR. apply Rmult_lt_reg_l with 2. prove_sup0. - unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_l; rewrite Rplus_comm; rewrite double; apply Rplus_lt_compat_l; apply H. @@ -103,7 +103,7 @@ Proof. inversion H13. apply H14. rewrite H8 in H10; rewrite <- H14 in H10; elim H10; reflexivity. - intros; unfold h in |- *; + intros; unfold h; replace (derive_pt (fun y:R => (g b - g a) * f y - (f b - f a) * g y) c (X c P)) with @@ -115,11 +115,11 @@ Proof. rewrite derive_pt_minus; do 2 rewrite derive_pt_mult; do 2 rewrite derive_pt_const; do 2 rewrite Rmult_0_l; do 2 rewrite Rplus_0_l; reflexivity. - unfold h in |- *; ring. - intros; unfold h in |- *; + unfold h; ring. + intros; unfold h; change (continuity_pt ((fct_cte (g b - g a) * f)%F - (fct_cte (f b - f a) * g)%F) - c) in |- *. + c). apply continuity_pt_minus; apply continuity_pt_mult. apply derivable_continuous_pt; apply derivable_const. apply H0; apply H3. @@ -128,7 +128,7 @@ Proof. intros; change (derivable_pt ((fct_cte (g b - g a) * f)%F - (fct_cte (f b - f a) * g)%F) - c) in |- *. + c). apply derivable_pt_minus; apply derivable_pt_mult. apply derivable_pt_const. apply (pr1 _ H3). @@ -178,7 +178,7 @@ Proof. cut (derive_pt id x (X2 x x0) = 1). cut (derive_pt f x (X0 x x0) = f' x). intros; rewrite H4 in H3; rewrite H5 in H3; unfold id in H3; - rewrite Rmult_1_r in H3; rewrite Rmult_comm; symmetry in |- *; + rewrite Rmult_1_r in H3; rewrite Rmult_comm; symmetry ; assumption. apply derive_pt_eq_0; apply H0; elim x0; intros; split; left; assumption. apply derive_pt_eq_0; apply derivable_pt_lim_id. @@ -188,7 +188,7 @@ Proof. intros; apply derivable_pt_id. intros; apply derivable_continuous_pt; apply X; assumption. intros; elim H1; intros; apply X; split; left; assumption. - intros; unfold derivable_pt in |- *; exists (f' c); apply H0; + intros; unfold derivable_pt; exists (f' c); apply H0; apply H1. Qed. @@ -221,7 +221,7 @@ Proof. unfold id in H6; unfold Rminus in H6; rewrite Rplus_opp_r in H6; rewrite Rmult_0_l in H6; apply Rmult_eq_reg_l with (b - a); [ rewrite Rmult_0_r; apply H6 - | apply Rminus_eq_contra; red in |- *; intro; rewrite H7 in H0; + | apply Rminus_eq_contra; red; intro; rewrite H7 in H0; elim (Rlt_irrefl _ H0) ]. Qed. @@ -231,7 +231,7 @@ Lemma nonneg_derivative_1 : (forall x:R, 0 <= derive_pt f x (pr x)) -> increasing f. Proof. intros. - unfold increasing in |- *. + unfold increasing. intros. case (total_order_T x y); intro. elim s; intro. @@ -268,12 +268,12 @@ Proof. intro; decompose [and] H8; intros; generalize (H7 (delta / 2) H9 H12); cut ((f (x + delta / 2) - f x) / (delta / 2) <= 0). intro; cut (0 < - ((f (x + delta / 2) - f x) / (delta / 2) - l)). - intro; unfold Rabs in |- *; + intro; unfold Rabs; case (Rcase_abs ((f (x + delta / 2) - f x) / (delta / 2) - l)). intros; generalize (Rplus_lt_compat_r (- l) (- ((f (x + delta / 2) - f x) / (delta / 2) - l)) - (l / 2) H14); unfold Rminus in |- *. + (l / 2) H14); unfold Rminus. replace (l / 2 + - l) with (- (l / 2)). replace (- ((f (x + delta / 2) + - f x) / (delta / 2) + - l) + - l) with (- ((f (x + delta / 2) + - f x) / (delta / 2))). @@ -290,7 +290,7 @@ Proof. (Rlt_irrefl 0 (Rlt_le_trans 0 ((f (x + delta / 2) - f x) / (delta / 2)) 0 H17 H10)). ring. - pattern l at 3 in |- *; rewrite double_var. + pattern l at 3; rewrite double_var. ring. intros. generalize @@ -303,22 +303,22 @@ Proof. H15)). replace (- ((f (x + delta / 2) - f x) / (delta / 2) - l)) with ((f x - f (x + delta / 2)) / (delta / 2) + l). - unfold Rminus in |- *. + unfold Rminus. apply Rplus_le_lt_0_compat. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Rdiv; apply Rmult_le_pos. cut (x <= x + delta * / 2). intro; generalize (H0 x (x + delta * / 2) H13); intro; generalize (Rplus_le_compat_l (- f (x + delta / 2)) (f (x + delta / 2)) (f x) H14); rewrite Rplus_opp_l; rewrite Rplus_comm; intro; assumption. - pattern x at 1 in |- *; rewrite <- (Rplus_0_r x); apply Rplus_le_compat_l; + pattern x at 1; rewrite <- (Rplus_0_r x); apply Rplus_le_compat_l; left; assumption. left; apply Rinv_0_lt_compat; assumption. assumption. rewrite Ropp_minus_distr. - unfold Rminus in |- *. + unfold Rminus. rewrite (Rplus_comm l). - unfold Rdiv in |- *. + unfold Rdiv. rewrite <- Ropp_mult_distr_l_reverse. rewrite Ropp_plus_distr. rewrite Ropp_involutive. @@ -329,38 +329,38 @@ Proof. rewrite <- Ropp_0. apply Ropp_ge_le_contravar. apply Rle_ge. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Rdiv; apply Rmult_le_pos. cut (x <= x + delta * / 2). intro; generalize (H0 x (x + delta * / 2) H10); intro. generalize (Rplus_le_compat_l (- f (x + delta / 2)) (f (x + delta / 2)) (f x) H13); rewrite Rplus_opp_l; rewrite Rplus_comm; intro; assumption. - pattern x at 1 in |- *; rewrite <- (Rplus_0_r x); apply Rplus_le_compat_l; + pattern x at 1; rewrite <- (Rplus_0_r x); apply Rplus_le_compat_l; left; assumption. left; apply Rinv_0_lt_compat; assumption. - unfold Rdiv in |- *; rewrite <- Ropp_mult_distr_l_reverse. + unfold Rdiv; rewrite <- Ropp_mult_distr_l_reverse. rewrite Ropp_minus_distr. reflexivity. split. - unfold Rdiv in |- *; apply prod_neq_R0. - generalize (cond_pos delta); intro; red in |- *; intro H9; rewrite H9 in H8; + unfold Rdiv; apply prod_neq_R0. + generalize (cond_pos delta); intro; red; intro H9; rewrite H9 in H8; elim (Rlt_irrefl 0 H8). apply Rinv_neq_0_compat; discrR. split. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos delta) | apply Rinv_0_lt_compat; prove_sup0 ]. rewrite Rabs_right. - unfold Rdiv in |- *; apply Rmult_lt_reg_l with 2. + unfold Rdiv; apply Rmult_lt_reg_l with 2. prove_sup0. rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. - rewrite Rmult_1_l; rewrite double; pattern (pos delta) at 1 in |- *; + rewrite Rmult_1_l; rewrite double; pattern (pos delta) at 1; rewrite <- Rplus_0_r. apply Rplus_lt_compat_l; apply (cond_pos delta). discrR. - apply Rle_ge; unfold Rdiv in |- *; left; apply Rmult_lt_0_compat. + apply Rle_ge; unfold Rdiv; left; apply Rmult_lt_0_compat. apply (cond_pos delta). apply Rinv_0_lt_compat; prove_sup0. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply H4 | apply Rinv_0_lt_compat; prove_sup0 ]. Qed. @@ -368,7 +368,7 @@ Qed. Lemma increasing_decreasing_opp : forall f:R -> R, increasing f -> decreasing (- f)%F. Proof. - unfold increasing, decreasing, opp_fct in |- *; intros; generalize (H x y H0); + unfold increasing, decreasing, opp_fct; intros; generalize (H x y H0); intro; apply Ropp_ge_le_contravar; apply Rle_ge; assumption. Qed. @@ -381,8 +381,8 @@ Proof. cut (forall h:R, - - f h = f h). intro. generalize (increasing_decreasing_opp (- f)%F). - unfold decreasing in |- *. - unfold opp_fct in |- *. + unfold decreasing. + unfold opp_fct. intros. rewrite <- (H0 x); rewrite <- (H0 y). apply H1. @@ -410,7 +410,7 @@ Lemma positive_derivative : (forall x:R, 0 < derive_pt f x (pr x)) -> strict_increasing f. Proof. intros. - unfold strict_increasing in |- *. + unfold strict_increasing. intros. apply Rplus_lt_reg_r with (- f x). rewrite Rplus_opp_l; rewrite Rplus_comm. @@ -429,7 +429,7 @@ Qed. Lemma strictincreasing_strictdecreasing_opp : forall f:R -> R, strict_increasing f -> strict_decreasing (- f)%F. Proof. - unfold strict_increasing, strict_decreasing, opp_fct in |- *; intros; + unfold strict_increasing, strict_decreasing, opp_fct; intros; generalize (H x y H0); intro; apply Ropp_lt_gt_contravar; assumption. Qed. @@ -443,7 +443,7 @@ Proof. cut (forall h:R, - - f h = f h). intros. generalize (strictincreasing_strictdecreasing_opp (- f)%F). - unfold strict_decreasing, opp_fct in |- *. + unfold strict_decreasing, opp_fct. intros. rewrite <- (H0 x). rewrite <- (H0 y). @@ -470,8 +470,8 @@ Proof. intros. unfold constant in H. apply derive_pt_eq_0. - intros; exists (mkposreal 1 Rlt_0_1); simpl in |- *; intros. - rewrite (H x (x + h)); unfold Rminus in |- *; unfold Rdiv in |- *; + intros; exists (mkposreal 1 Rlt_0_1); simpl; intros. + rewrite (H x (x + h)); unfold Rminus; unfold Rdiv; rewrite Rplus_opp_r; rewrite Rmult_0_l; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. Qed. @@ -480,13 +480,13 @@ Qed. Lemma increasing_decreasing : forall f:R -> R, increasing f -> decreasing f -> constant f. Proof. - unfold increasing, decreasing, constant in |- *; intros; + unfold increasing, decreasing, constant; intros; case (Rtotal_order x y); intro. generalize (Rlt_le x y H1); intro; apply (Rle_antisym (f x) (f y) (H x y H2) (H0 x y H2)). elim H1; intro. rewrite H2; reflexivity. - generalize (Rlt_le y x H2); intro; symmetry in |- *; + generalize (Rlt_le y x H2); intro; symmetry ; apply (Rle_antisym (f y) (f x) (H y x H3) (H0 y x H3)). Qed. @@ -502,7 +502,7 @@ Proof. assert (H2 := nonneg_derivative_1 f pr H0). assert (H3 := nonpos_derivative_1 f pr H1). apply increasing_decreasing; assumption. - intro; right; symmetry in |- *; apply (H x). + intro; right; symmetry ; apply (H x). intro; right; apply (H x). Qed. @@ -601,7 +601,7 @@ Proof. elim H4; intros. split; left; assumption. rewrite b0. - unfold Rminus in |- *; do 2 rewrite Rplus_opp_r. + unfold Rminus; do 2 rewrite Rplus_opp_r. rewrite Rmult_0_r; right; reflexivity. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H r)). Qed. @@ -648,7 +648,7 @@ Lemma null_derivative_loc : (forall (x:R) (P:a < x < b), derive_pt f x (pr x P) = 0) -> constant_D_eq f (fun x:R => a <= x <= b) (f a). Proof. - intros; unfold constant_D_eq in |- *; intros; case (total_order_T a b); intro. + intros; unfold constant_D_eq; intros; case (total_order_T a b); intro. elim s; intro. assert (H2 : forall y:R, a < y < x -> derivable_pt id y). intros; apply derivable_pt_id. @@ -674,7 +674,7 @@ Proof. assert (H12 : derive_pt id x0 (H2 x0 x1) = 1). apply derive_pt_eq_0; apply derivable_pt_lim_id. rewrite H11 in H9; rewrite H12 in H9; rewrite Rmult_0_r in H9; - rewrite Rmult_1_r in H9; apply Rminus_diag_uniq; symmetry in |- *; + rewrite Rmult_1_r in H9; apply Rminus_diag_uniq; symmetry ; assumption. rewrite H1; reflexivity. assert (H2 : x = a). @@ -691,15 +691,15 @@ Lemma antiderivative_Ucte : antiderivative f g2 a b -> exists c : R, (forall x:R, a <= x <= b -> g1 x = g2 x + c). Proof. - unfold antiderivative in |- *; intros; elim H; clear H; intros; elim H0; + unfold antiderivative; intros; elim H; clear H; intros; elim H0; clear H0; intros H0 _; exists (g1 a - g2 a); intros; assert (H3 : forall x:R, a <= x <= b -> derivable_pt g1 x). - intros; unfold derivable_pt in |- *; exists (f x0); elim (H x0 H3); - intros; eapply derive_pt_eq_1; symmetry in |- *; + intros; unfold derivable_pt; exists (f x0); elim (H x0 H3); + intros; eapply derive_pt_eq_1; symmetry ; apply H4. assert (H4 : forall x:R, a <= x <= b -> derivable_pt g2 x). - intros; unfold derivable_pt in |- *; exists (f x0); - elim (H0 x0 H4); intros; eapply derive_pt_eq_1; symmetry in |- *; + intros; unfold derivable_pt; exists (f x0); + elim (H0 x0 H4); intros; eapply derive_pt_eq_1; symmetry ; apply H5. assert (H5 : forall x:R, a < x < b -> derivable_pt (g1 - g2) x). intros; elim H5; intros; apply derivable_pt_minus; @@ -713,7 +713,7 @@ Proof. assert (H9 : a <= x0 <= b). split; left; assumption. apply derivable_pt_lim_minus; [ elim (H _ H9) | elim (H0 _ H9) ]; intros; - eapply derive_pt_eq_1; symmetry in |- *; apply H10. + eapply derive_pt_eq_1; symmetry ; apply H10. assert (H8 := null_derivative_loc (g1 - g2)%F a b H5 H6 H7); unfold constant_D_eq in H8; assert (H9 := H8 _ H2); unfold minus_fct in H9; rewrite <- H9; ring. diff --git a/theories/Reals/Machin.v b/theories/Reals/Machin.v new file mode 100644 index 00000000..6b91719d --- /dev/null +++ b/theories/Reals/Machin.v @@ -0,0 +1,168 @@ +Require Import Fourier. +Require Import Rbase. +Require Import Rtrigo1. +Require Import Ranalysis_reg. +Require Import Rfunctions. +Require Import AltSeries. +Require Import Rseries. +Require Import SeqProp. +Require Import PartSum. +Require Import Ratan. + +Local Open Scope R_scope. + +(* Proving a few formulas in the style of John Machin to compute Pi *) + +Definition atan_sub u v := (u - v)/(1 + u * v). + +Lemma atan_sub_correct : + forall u v, 1 + u * v <> 0 -> -PI/2 < atan u - atan v < PI/2 -> + -PI/2 < atan (atan_sub u v) < PI/2 -> + atan u = atan v + atan (atan_sub u v). +intros u v pn0 uvint aint. +assert (cos (atan u) <> 0). + destruct (atan_bound u); apply Rgt_not_eq, cos_gt_0; auto. + rewrite <- Ropp_div; assumption. +assert (cos (atan v) <> 0). + destruct (atan_bound v); apply Rgt_not_eq, cos_gt_0; auto. + rewrite <- Ropp_div; assumption. +assert (t : forall a b c, a - b = c -> a = b + c) by (intros; subst; field). +apply t, tan_is_inj; clear t; try assumption. +rewrite tan_minus; auto. + rewrite !atan_right_inv; reflexivity. +apply Rgt_not_eq, cos_gt_0; rewrite <- ?Ropp_div; tauto. +rewrite !atan_right_inv; assumption. +Qed. + +Lemma tech : forall x y , -1 <= x <= 1 -> -1 < y < 1 -> + -PI/2 < atan x - atan y < PI/2. +assert (ut := PI_RGT_0). +intros x y [xm1 x1] [ym1 y1]. +assert (-(PI/4) <= atan x). + destruct xm1 as [xm1 | xm1]. + rewrite <- atan_1, <- atan_opp; apply Rlt_le, atan_increasing. + assumption. + solve[rewrite <- xm1, atan_opp, atan_1; apply Rle_refl]. +assert (-(PI/4) < atan y). + rewrite <- atan_1, <- atan_opp; apply atan_increasing. + assumption. +assert (atan x <= PI/4). + destruct x1 as [x1 | x1]. + rewrite <- atan_1; apply Rlt_le, atan_increasing. + assumption. + solve[rewrite x1, atan_1; apply Rle_refl]. +assert (atan y < PI/4). + rewrite <- atan_1; apply atan_increasing. + assumption. +rewrite Ropp_div; split; fourier. +Qed. + +(* A simple formula, reasonably efficient. *) +Lemma Machin_2_3 : PI/4 = atan(/2) + atan(/3). +assert (utility : 0 < PI/2) by (apply PI2_RGT_0). +rewrite <- atan_1. +rewrite (atan_sub_correct 1 (/2)). + apply f_equal, f_equal; unfold atan_sub; field. + apply Rgt_not_eq; fourier. + apply tech; try split; try fourier. +apply atan_bound. +Qed. + +Lemma Machin_4_5_239 : PI/4 = 4 * atan (/5) - atan(/239). +rewrite <- atan_1. +rewrite (atan_sub_correct 1 (/5)); + [ | apply Rgt_not_eq; fourier | apply tech; try split; fourier | + apply atan_bound ]. +replace (4 * atan (/5) - atan (/239)) with + (atan (/5) + (atan (/5) + (atan (/5) + (atan (/5) + - + atan (/239))))) by ring. +apply f_equal. +replace (atan_sub 1 (/5)) with (2/3) by + (unfold atan_sub; field). +rewrite (atan_sub_correct (2/3) (/5)); + [apply f_equal | apply Rgt_not_eq; fourier | apply tech; try split; fourier | + apply atan_bound ]. +replace (atan_sub (2/3) (/5)) with (7/17) by + (unfold atan_sub; field). +rewrite (atan_sub_correct (7/17) (/5)); + [apply f_equal | apply Rgt_not_eq; fourier | apply tech; try split; fourier | + apply atan_bound ]. +replace (atan_sub (7/17) (/5)) with (9/46) by + (unfold atan_sub; field). +rewrite (atan_sub_correct (9/46) (/5)); + [apply f_equal | apply Rgt_not_eq; fourier | apply tech; try split; fourier | + apply atan_bound ]. +rewrite <- atan_opp; apply f_equal. +unfold atan_sub; field. +Qed. + +Lemma Machin_2_3_7 : PI/4 = 2 * atan(/3) + (atan (/7)). +rewrite <- atan_1. +rewrite (atan_sub_correct 1 (/3)); + [ | apply Rgt_not_eq; fourier | apply tech; try split; fourier | + apply atan_bound ]. +replace (2 * atan (/3) + atan (/7)) with + (atan (/3) + (atan (/3) + atan (/7))) by ring. +apply f_equal. +replace (atan_sub 1 (/3)) with (/2) by + (unfold atan_sub; field). +rewrite (atan_sub_correct (/2) (/3)); + [apply f_equal | apply Rgt_not_eq; fourier | apply tech; try split; fourier | + apply atan_bound ]. +apply f_equal; unfold atan_sub; field. +Qed. + +(* More efficient way to compute approximations of PI. *) + +Definition PI_2_3_7_tg n := + 2 * Ratan_seq (/3) n + Ratan_seq (/7) n. + +Lemma PI_2_3_7_ineq : + forall N : nat, + sum_f_R0 (tg_alt PI_2_3_7_tg) (S (2 * N)) <= PI / 4 <= + sum_f_R0 (tg_alt PI_2_3_7_tg) (2 * N). +Proof. +assert (dec3 : 0 <= /3 <= 1) by (split; fourier). +assert (dec7 : 0 <= /7 <= 1) by (split; fourier). +assert (decr : Un_decreasing PI_2_3_7_tg). + apply Ratan_seq_decreasing in dec3. + apply Ratan_seq_decreasing in dec7. + intros n; apply Rplus_le_compat. + apply Rmult_le_compat_l; [ fourier | exact (dec3 n)]. + exact (dec7 n). +assert (cv : Un_cv PI_2_3_7_tg 0). + apply Ratan_seq_converging in dec3. + apply Ratan_seq_converging in dec7. + intros eps ep. + assert (ep' : 0 < eps /3) by fourier. + destruct (dec3 _ ep') as [N1 Pn1]; destruct (dec7 _ ep') as [N2 Pn2]. + exists (N1 + N2)%nat; intros n Nn. + unfold PI_2_3_7_tg. + rewrite <- (Rplus_0_l 0). + apply Rle_lt_trans with + (1 := R_dist_plus (2 * Ratan_seq (/3) n) 0 (Ratan_seq (/7) n) 0). + replace eps with (2 * eps/3 + eps/3) by field. + apply Rplus_lt_compat. + unfold R_dist, Rminus, Rdiv. + rewrite <- (Rmult_0_r 2), <- Ropp_mult_distr_r_reverse. + rewrite <- Rmult_plus_distr_l, Rabs_mult, (Rabs_pos_eq 2);[|fourier]. + rewrite Rmult_assoc; apply Rmult_lt_compat_l;[fourier | ]. + apply (Pn1 n); omega. + apply (Pn2 n); omega. +rewrite Machin_2_3_7. +rewrite !atan_eq_ps_atan; try (split; fourier). +unfold ps_atan; destruct (in_int (/3)); destruct (in_int (/7)); + try match goal with id : ~ _ |- _ => case id; split; fourier end. +destruct (ps_atan_exists_1 (/3)) as [v3 Pv3]. +destruct (ps_atan_exists_1 (/7)) as [v7 Pv7]. +assert (main : Un_cv (sum_f_R0 (tg_alt PI_2_3_7_tg)) (2 * v3 + v7)). + assert (main :Un_cv (fun n => 2 * sum_f_R0 (tg_alt (Ratan_seq (/3))) n + + sum_f_R0 (tg_alt (Ratan_seq (/7))) n) (2 * v3 + v7)). + apply CV_plus;[ | assumption]. + apply CV_mult;[ | assumption]. + exists 0%nat; intros; rewrite R_dist_eq; assumption. + apply Un_cv_ext with (2 := main). + intros n; rewrite scal_sum, <- plus_sum; apply sum_eq; intros. + rewrite Rmult_comm; unfold PI_2_3_7_tg, tg_alt; field. +intros N; apply (alternated_series_ineq _ _ _ decr cv main). +Qed. diff --git a/theories/Reals/NewtonInt.v b/theories/Reals/NewtonInt.v index a4233021..67e353ee 100644 --- a/theories/Reals/NewtonInt.v +++ b/theories/Reals/NewtonInt.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,9 +9,9 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. -Require Import Rtrigo. +Require Import Rtrigo1. Require Import Ranalysis. -Open Local Scope R_scope. +Local Open Scope R_scope. (*******************************************) (* Newton's Integral *) @@ -28,8 +28,8 @@ Lemma FTCN_step1 : forall (f:Differential) (a b:R), Newton_integrable (fun x:R => derive_pt f x (cond_diff f x)) a b. Proof. - intros f a b; unfold Newton_integrable in |- *; exists (d1 f); - unfold antiderivative in |- *; intros; case (Rle_dec a b); + intros f a b; unfold Newton_integrable; exists (d1 f); + unfold antiderivative; intros; case (Rle_dec a b); intro; [ left; split; [ intros; exists (cond_diff f x); reflexivity | assumption ] | right; split; @@ -42,26 +42,26 @@ Lemma FTC_Newton : NewtonInt (fun x:R => derive_pt f x (cond_diff f x)) a b (FTCN_step1 f a b) = f b - f a. Proof. - intros; unfold NewtonInt in |- *; reflexivity. + intros; unfold NewtonInt; reflexivity. Qed. (* $\int_a^a f$ exists forall a:R and f:R->R *) Lemma NewtonInt_P1 : forall (f:R -> R) (a:R), Newton_integrable f a a. Proof. - intros f a; unfold Newton_integrable in |- *; + intros f a; unfold Newton_integrable; exists (fct_cte (f a) * id)%F; left; - unfold antiderivative in |- *; split. + unfold antiderivative; split. intros; assert (H1 : derivable_pt (fct_cte (f a) * id) x). apply derivable_pt_mult. apply derivable_pt_const. apply derivable_pt_id. exists H1; assert (H2 : x = a). elim H; intros; apply Rle_antisym; assumption. - symmetry in |- *; apply derive_pt_eq_0; + symmetry ; apply derive_pt_eq_0; replace (f x) with (0 * id x + fct_cte (f a) x * 1); [ apply (derivable_pt_lim_mult (fct_cte (f a)) id x); [ apply derivable_pt_lim_const | apply derivable_pt_lim_id ] - | unfold id, fct_cte in |- *; rewrite H2; ring ]. + | unfold id, fct_cte; rewrite H2; ring ]. right; reflexivity. Defined. @@ -69,8 +69,8 @@ Defined. Lemma NewtonInt_P2 : forall (f:R -> R) (a:R), NewtonInt f a a (NewtonInt_P1 f a) = 0. Proof. - intros; unfold NewtonInt in |- *; simpl in |- *; - unfold mult_fct, fct_cte, id in |- *; ring. + intros; unfold NewtonInt; simpl; + unfold mult_fct, fct_cte, id; ring. Qed. (* If $\int_a^b f$ exists, then $\int_b^a f$ exists too *) @@ -78,7 +78,7 @@ Lemma NewtonInt_P3 : forall (f:R -> R) (a b:R) (X:Newton_integrable f a b), Newton_integrable f b a. Proof. - unfold Newton_integrable in |- *; intros; elim X; intros g H; + unfold Newton_integrable; intros; elim X; intros g H; exists g; tauto. Defined. @@ -88,7 +88,7 @@ Lemma NewtonInt_P4 : NewtonInt f a b pr = - NewtonInt f b a (NewtonInt_P3 f a b pr). Proof. intros; unfold Newton_integrable in pr; elim pr; intros; elim p; intro. - unfold NewtonInt in |- *; + unfold NewtonInt; case (NewtonInt_P3 f a b (exist @@ -106,7 +106,7 @@ Proof. assert (H4 : a <= b <= b). split; [ assumption | right; reflexivity ]. assert (H5 := H2 _ H3); assert (H6 := H2 _ H4); rewrite H5; rewrite H6; ring. - unfold NewtonInt in |- *; + unfold NewtonInt; case (NewtonInt_P3 f a b (exist @@ -132,37 +132,37 @@ Lemma NewtonInt_P5 : Newton_integrable g a b -> Newton_integrable (fun x:R => l * f x + g x) a b. Proof. - unfold Newton_integrable in |- *; intros f g l a b X X0; + unfold Newton_integrable; intros f g l a b X X0; elim X; intros; elim X0; intros; exists (fun y:R => l * x y + x0 y). elim p; intro. elim p0; intro. - left; unfold antiderivative in |- *; unfold antiderivative in H, H0; elim H; + left; unfold antiderivative; unfold antiderivative in H, H0; elim H; clear H; intros; elim H0; clear H0; intros H0 _. split. intros; elim (H _ H2); elim (H0 _ H2); intros. assert (H5 : derivable_pt (fun y:R => l * x y + x0 y) x1). reg. - exists H5; symmetry in |- *; reg; rewrite <- H3; rewrite <- H4; reflexivity. + exists H5; symmetry ; reg; rewrite <- H3; rewrite <- H4; reflexivity. assumption. unfold antiderivative in H, H0; elim H; elim H0; intros; elim H4; intro. elim (Rlt_irrefl _ (Rlt_le_trans _ _ _ H5 H2)). - left; rewrite <- H5; unfold antiderivative in |- *; split. + left; rewrite <- H5; unfold antiderivative; split. intros; elim H6; intros; assert (H9 : x1 = a). apply Rle_antisym; assumption. assert (H10 : a <= x1 <= b). - split; right; [ symmetry in |- *; assumption | rewrite <- H5; assumption ]. + split; right; [ symmetry ; assumption | rewrite <- H5; assumption ]. assert (H11 : b <= x1 <= a). - split; right; [ rewrite <- H5; symmetry in |- *; assumption | assumption ]. + split; right; [ rewrite <- H5; symmetry ; assumption | assumption ]. assert (H12 : derivable_pt x x1). - unfold derivable_pt in |- *; exists (f x1); elim (H3 _ H10); intros; - eapply derive_pt_eq_1; symmetry in |- *; apply H12. + unfold derivable_pt; exists (f x1); elim (H3 _ H10); intros; + eapply derive_pt_eq_1; symmetry ; apply H12. assert (H13 : derivable_pt x0 x1). - unfold derivable_pt in |- *; exists (g x1); elim (H1 _ H11); intros; - eapply derive_pt_eq_1; symmetry in |- *; apply H13. + unfold derivable_pt; exists (g x1); elim (H1 _ H11); intros; + eapply derive_pt_eq_1; symmetry ; apply H13. assert (H14 : derivable_pt (fun y:R => l * x y + x0 y) x1). reg. - exists H14; symmetry in |- *; reg. + exists H14; symmetry ; reg. assert (H15 : derive_pt x0 x1 H13 = g x1). elim (H1 _ H11); intros; rewrite H15; apply pr_nu. assert (H16 : derive_pt x x1 H12 = f x1). @@ -172,34 +172,34 @@ Proof. elim p0; intro. unfold antiderivative in H, H0; elim H; elim H0; intros; elim H4; intro. elim (Rlt_irrefl _ (Rlt_le_trans _ _ _ H5 H2)). - left; rewrite H5; unfold antiderivative in |- *; split. + left; rewrite H5; unfold antiderivative; split. intros; elim H6; intros; assert (H9 : x1 = a). apply Rle_antisym; assumption. assert (H10 : a <= x1 <= b). - split; right; [ symmetry in |- *; assumption | rewrite H5; assumption ]. + split; right; [ symmetry ; assumption | rewrite H5; assumption ]. assert (H11 : b <= x1 <= a). - split; right; [ rewrite H5; symmetry in |- *; assumption | assumption ]. + split; right; [ rewrite H5; symmetry ; assumption | assumption ]. assert (H12 : derivable_pt x x1). - unfold derivable_pt in |- *; exists (f x1); elim (H3 _ H11); intros; - eapply derive_pt_eq_1; symmetry in |- *; apply H12. + unfold derivable_pt; exists (f x1); elim (H3 _ H11); intros; + eapply derive_pt_eq_1; symmetry ; apply H12. assert (H13 : derivable_pt x0 x1). - unfold derivable_pt in |- *; exists (g x1); elim (H1 _ H10); intros; - eapply derive_pt_eq_1; symmetry in |- *; apply H13. + unfold derivable_pt; exists (g x1); elim (H1 _ H10); intros; + eapply derive_pt_eq_1; symmetry ; apply H13. assert (H14 : derivable_pt (fun y:R => l * x y + x0 y) x1). reg. - exists H14; symmetry in |- *; reg. + exists H14; symmetry ; reg. assert (H15 : derive_pt x0 x1 H13 = g x1). elim (H1 _ H10); intros; rewrite H15; apply pr_nu. assert (H16 : derive_pt x x1 H12 = f x1). elim (H3 _ H11); intros; rewrite H16; apply pr_nu. rewrite H15; rewrite H16; ring. right; reflexivity. - right; unfold antiderivative in |- *; unfold antiderivative in H, H0; elim H; + right; unfold antiderivative; unfold antiderivative in H, H0; elim H; clear H; intros; elim H0; clear H0; intros H0 _; split. intros; elim (H _ H2); elim (H0 _ H2); intros. assert (H5 : derivable_pt (fun y:R => l * x y + x0 y) x1). reg. - exists H5; symmetry in |- *; reg; rewrite <- H3; rewrite <- H4; reflexivity. + exists H5; symmetry ; reg; rewrite <- H3; rewrite <- H4; reflexivity. assumption. Defined. @@ -210,12 +210,12 @@ Lemma antiderivative_P1 : antiderivative g G a b -> antiderivative (fun x:R => l * f x + g x) (fun x:R => l * F x + G x) a b. Proof. - unfold antiderivative in |- *; intros; elim H; elim H0; clear H H0; intros; + unfold antiderivative; intros; elim H; elim H0; clear H H0; intros; split. intros; elim (H _ H3); elim (H1 _ H3); intros. assert (H6 : derivable_pt (fun x:R => l * F x + G x) x). reg. - exists H6; symmetry in |- *; reg; rewrite <- H4; rewrite <- H5; ring. + exists H6; symmetry ; reg; rewrite <- H4; rewrite <- H5; ring. assumption. Qed. @@ -226,7 +226,7 @@ Lemma NewtonInt_P6 : NewtonInt (fun x:R => l * f x + g x) a b (NewtonInt_P5 f g l a b pr1 pr2) = l * NewtonInt f a b pr1 + NewtonInt g a b pr2. Proof. - intros f g l a b pr1 pr2; unfold NewtonInt in |- *; + intros f g l a b pr1 pr2; unfold NewtonInt; case (NewtonInt_P5 f g l a b pr1 pr2); intros; case pr1; intros; case pr2; intros; case (total_order_T a b); intro. @@ -277,7 +277,7 @@ Lemma antiderivative_P2 : | right _ => F1 x + (F0 b - F1 b) end) a c. Proof. - unfold antiderivative in |- *; intros; elim H; clear H; intros; elim H0; + unfold antiderivative; intros; elim H; clear H; intros; elim H0; clear H0; intros; split. 2: apply Rle_trans with b; assumption. intros; elim H3; clear H3; intros; case (total_order_T x b); intro. @@ -293,25 +293,25 @@ Proof. | left _ => F0 x | right _ => F1 x + (F0 b - F1 b) end) x (f x)). - unfold derivable_pt_lim in |- *; assert (H7 : derive_pt F0 x x0 = f x). - symmetry in |- *; assumption. + unfold derivable_pt_lim; assert (H7 : derive_pt F0 x x0 = f x). + symmetry ; assumption. assert (H8 := derive_pt_eq_1 F0 x (f x) x0 H7); unfold derivable_pt_lim in H8; intros; elim (H8 _ H9); intros; set (D := Rmin x1 (b - x)). assert (H11 : 0 < D). - unfold D in |- *; unfold Rmin in |- *; case (Rle_dec x1 (b - x)); intro. + unfold D; unfold Rmin; case (Rle_dec x1 (b - x)); intro. apply (cond_pos x1). apply Rlt_Rminus; assumption. exists (mkposreal _ H11); intros; case (Rle_dec x b); intro. case (Rle_dec (x + h) b); intro. apply H10. assumption. - apply Rlt_le_trans with D; [ assumption | unfold D in |- *; apply Rmin_l ]. + apply Rlt_le_trans with D; [ assumption | unfold D; apply Rmin_l ]. elim n; left; apply Rlt_le_trans with (x + D). apply Rplus_lt_compat_l; apply Rle_lt_trans with (Rabs h). apply RRle_abs. apply H13. apply Rplus_le_reg_l with (- x); rewrite <- Rplus_assoc; rewrite Rplus_opp_l; - rewrite Rplus_0_l; rewrite Rplus_comm; unfold D in |- *; + rewrite Rplus_0_l; rewrite Rplus_comm; unfold D; apply Rmin_r. elim n; left; assumption. assert @@ -322,16 +322,16 @@ Proof. | left _ => F0 x | right _ => F1 x + (F0 b - F1 b) end) x). - unfold derivable_pt in |- *; exists (f x); apply H7. - exists H8; symmetry in |- *; apply derive_pt_eq_0; apply H7. + unfold derivable_pt; exists (f x); apply H7. + exists H8; symmetry ; apply derive_pt_eq_0; apply H7. assert (H5 : a <= x <= b). split; [ assumption | right; assumption ]. assert (H6 : b <= x <= c). - split; [ right; symmetry in |- *; assumption | assumption ]. + split; [ right; symmetry ; assumption | assumption ]. elim (H _ H5); elim (H0 _ H6); intros; assert (H9 : derive_pt F0 x x1 = f x). - symmetry in |- *; assumption. + symmetry ; assumption. assert (H10 : derive_pt F1 x x0 = f x). - symmetry in |- *; assumption. + symmetry ; assumption. assert (H11 := derive_pt_eq_1 F0 x (f x) x1 H9); assert (H12 := derive_pt_eq_1 F1 x (f x) x0 H10); assert @@ -342,21 +342,21 @@ Proof. | left _ => F0 x | right _ => F1 x + (F0 b - F1 b) end) x (f x)). - unfold derivable_pt_lim in |- *; unfold derivable_pt_lim in H11, H12; intros; + unfold derivable_pt_lim; unfold derivable_pt_lim in H11, H12; intros; elim (H11 _ H13); elim (H12 _ H13); intros; set (D := Rmin x2 x3); assert (H16 : 0 < D). - unfold D in |- *; unfold Rmin in |- *; case (Rle_dec x2 x3); intro. + unfold D; unfold Rmin; case (Rle_dec x2 x3); intro. apply (cond_pos x2). apply (cond_pos x3). exists (mkposreal _ H16); intros; case (Rle_dec x b); intro. case (Rle_dec (x + h) b); intro. apply H15. assumption. - apply Rlt_le_trans with D; [ assumption | unfold D in |- *; apply Rmin_r ]. + apply Rlt_le_trans with D; [ assumption | unfold D; apply Rmin_r ]. replace (F1 (x + h) + (F0 b - F1 b) - F0 x) with (F1 (x + h) - F1 x). apply H14. assumption. - apply Rlt_le_trans with D; [ assumption | unfold D in |- *; apply Rmin_l ]. + apply Rlt_le_trans with D; [ assumption | unfold D; apply Rmin_l ]. rewrite b0; ring. elim n; right; assumption. assert @@ -367,8 +367,8 @@ Proof. | left _ => F0 x | right _ => F1 x + (F0 b - F1 b) end) x). - unfold derivable_pt in |- *; exists (f x); apply H13. - exists H14; symmetry in |- *; apply derive_pt_eq_0; apply H13. + unfold derivable_pt; exists (f x); apply H13. + exists H14; symmetry ; apply derive_pt_eq_0; apply H13. assert (H5 : b <= x <= c). split; [ left; assumption | assumption ]. assert (H6 := H0 _ H5); elim H6; clear H6; intros; @@ -380,12 +380,12 @@ Proof. | left _ => F0 x | right _ => F1 x + (F0 b - F1 b) end) x (f x)). - unfold derivable_pt_lim in |- *; assert (H7 : derive_pt F1 x x0 = f x). - symmetry in |- *; assumption. + unfold derivable_pt_lim; assert (H7 : derive_pt F1 x x0 = f x). + symmetry ; assumption. assert (H8 := derive_pt_eq_1 F1 x (f x) x0 H7); unfold derivable_pt_lim in H8; intros; elim (H8 _ H9); intros; set (D := Rmin x1 (x - b)); assert (H11 : 0 < D). - unfold D in |- *; unfold Rmin in |- *; case (Rle_dec x1 (x - b)); intro. + unfold D; unfold Rmin; case (Rle_dec x1 (x - b)); intro. apply (cond_pos x1). apply Rlt_Rminus; assumption. exists (mkposreal _ H11); intros; case (Rle_dec x b); intro. @@ -399,13 +399,13 @@ Proof. rewrite <- Rabs_Ropp; apply RRle_abs. apply Rlt_le_trans with D. apply H13. - unfold D in |- *; apply Rmin_r. + unfold D; apply Rmin_r. replace (F1 (x + h) + (F0 b - F1 b) - (F1 x + (F0 b - F1 b))) with (F1 (x + h) - F1 x); [ idtac | ring ]; apply H10. assumption. apply Rlt_le_trans with D. assumption. - unfold D in |- *; apply Rmin_l. + unfold D; apply Rmin_l. assert (H8 : derivable_pt @@ -414,8 +414,8 @@ Proof. | left _ => F0 x | right _ => F1 x + (F0 b - F1 b) end) x). - unfold derivable_pt in |- *; exists (f x); apply H7. - exists H8; symmetry in |- *; apply derive_pt_eq_0; apply H7. + unfold derivable_pt; exists (f x); apply H7. + exists H8; symmetry ; apply derive_pt_eq_0; apply H7. Qed. Lemma antiderivative_P3 : @@ -427,15 +427,15 @@ Proof. intros; unfold antiderivative in H, H0; elim H; clear H; elim H0; clear H0; intros; case (total_order_T a c); intro. elim s; intro. - right; unfold antiderivative in |- *; split. + right; unfold antiderivative; split. intros; apply H1; elim H3; intros; split; [ assumption | apply Rle_trans with c; assumption ]. left; assumption. - right; unfold antiderivative in |- *; split. + right; unfold antiderivative; split. intros; apply H1; elim H3; intros; split; [ assumption | apply Rle_trans with c; assumption ]. right; assumption. - left; unfold antiderivative in |- *; split. + left; unfold antiderivative; split. intros; apply H; elim H3; intros; split; [ assumption | apply Rle_trans with a; assumption ]. left; assumption. @@ -450,15 +450,15 @@ Proof. intros; unfold antiderivative in H, H0; elim H; clear H; elim H0; clear H0; intros; case (total_order_T c b); intro. elim s; intro. - right; unfold antiderivative in |- *; split. + right; unfold antiderivative; split. intros; apply H1; elim H3; intros; split; [ apply Rle_trans with c; assumption | assumption ]. left; assumption. - right; unfold antiderivative in |- *; split. + right; unfold antiderivative; split. intros; apply H1; elim H3; intros; split; [ apply Rle_trans with c; assumption | assumption ]. right; assumption. - left; unfold antiderivative in |- *; split. + left; unfold antiderivative; split. intros; apply H; elim H3; intros; split; [ apply Rle_trans with b; assumption | assumption ]. left; assumption. @@ -471,7 +471,7 @@ Lemma NewtonInt_P7 : Newton_integrable f a b -> Newton_integrable f b c -> Newton_integrable f a c. Proof. - unfold Newton_integrable in |- *; intros f a b c Hab Hbc X X0; elim X; + unfold Newton_integrable; intros f a b c Hab Hbc X X0; elim X; clear X; intros F0 H0; elim X0; clear X0; intros F1 H1; set (g := @@ -479,7 +479,7 @@ Proof. match Rle_dec x b with | left _ => F0 x | right _ => F1 x + (F0 b - F1 b) - end); exists g; left; unfold g in |- *; + end); exists g; left; unfold g; apply antiderivative_P2. elim H0; intro. assumption. @@ -504,7 +504,7 @@ Proof. case (total_order_T b c); intro. elim s0; intro. (* a<b & b<c *) - unfold Newton_integrable in |- *; + unfold Newton_integrable; exists (fun x:R => match Rle_dec x b with @@ -523,7 +523,7 @@ Proof. (* a<b & b>c *) case (total_order_T a c); intro. elim s0; intro. - unfold Newton_integrable in |- *; exists F0. + unfold Newton_integrable; exists F0. left. elim H1; intro. unfold antiderivative in H; elim H; clear H; intros _ H. @@ -537,7 +537,7 @@ Proof. unfold antiderivative in H2; elim H2; clear H2; intros _ H2. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H2 a0)). rewrite b0; apply NewtonInt_P1. - unfold Newton_integrable in |- *; exists F1. + unfold Newton_integrable; exists F1. right. elim H1; intro. unfold antiderivative in H; elim H; clear H; intros _ H. @@ -557,7 +557,7 @@ Proof. (* a>b & b<c *) case (total_order_T a c); intro. elim s0; intro. - unfold Newton_integrable in |- *; exists F1. + unfold Newton_integrable; exists F1. left. elim H1; intro. (*****************) @@ -572,7 +572,7 @@ Proof. unfold antiderivative in H; elim H; clear H; intros _ H. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H a0)). rewrite b0; apply NewtonInt_P1. - unfold Newton_integrable in |- *; exists F0. + unfold Newton_integrable; exists F0. right. elim H0; intro. unfold antiderivative in H; elim H; clear H; intros _ H. @@ -601,7 +601,7 @@ Lemma NewtonInt_P9 : NewtonInt f a c (NewtonInt_P8 f a b c pr1 pr2) = NewtonInt f a b pr1 + NewtonInt f b c pr2. Proof. - intros; unfold NewtonInt in |- *. + intros; unfold NewtonInt. case (NewtonInt_P8 f a b c pr1 pr2); intros. case pr1; intros. case pr2; intros. @@ -641,7 +641,7 @@ Proof. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H a0)). (* a<b & b=c *) rewrite <- b0. - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rplus_0_r. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rplus_0_r. rewrite <- b0 in o. elim o0; intro. elim o; intro. @@ -759,7 +759,7 @@ Proof. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H0 a0)). (* a>b & b=c *) rewrite <- b0. - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rplus_0_r. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rplus_0_r. rewrite <- b0 in o. elim o0; intro. unfold antiderivative in H; elim H; clear H; intros _ H. diff --git a/theories/Reals/PSeries_reg.v b/theories/Reals/PSeries_reg.v index aa588e38..d4d91137 100644 --- a/theories/Reals/PSeries_reg.v +++ b/theories/Reals/PSeries_reg.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -12,7 +12,7 @@ Require Import SeqSeries. Require Import Ranalysis1. Require Import Max. Require Import Even. -Open Local Scope R_scope. +Local Open Scope R_scope. Definition Boule (x:R) (r:posreal) (y:R) : Prop := Rabs (y - x) < r. @@ -44,7 +44,7 @@ Lemma CVN_CVU : (cv:forall x:R, {l:R | Un_cv (fun N:nat => SP fn N x) l }) (r:posreal), CVN_r fn r -> CVU (fun n:nat => SP fn n) (SFL fn cv) 0 r. Proof. - intros; unfold CVU in |- *; intros. + intros; unfold CVU; intros. unfold CVN_r in X. elim X; intros An X0. elim X0; intros s H0. @@ -58,7 +58,7 @@ Proof. rewrite Ropp_minus_distr'; rewrite (Rabs_right (s - sum_f_R0 (fun k:nat => Rabs (An k)) n)). eapply sum_maj1. - unfold SFL in |- *; case (cv y); intro. + unfold SFL; case (cv y); intro. trivial. apply H1. intro; elim H0; intros. @@ -69,7 +69,7 @@ Proof. apply H8; apply H6. apply Rle_ge; apply Rplus_le_reg_l with (sum_f_R0 (fun k:nat => Rabs (An k)) n). - rewrite Rplus_0_r; unfold Rminus in |- *; rewrite (Rplus_comm s); + rewrite Rplus_0_r; unfold Rminus; rewrite (Rplus_comm s); rewrite <- Rplus_assoc; rewrite Rplus_opp_r; rewrite Rplus_0_l; apply sum_incr. apply H1. @@ -77,10 +77,10 @@ Proof. unfold R_dist in H4; unfold Rminus in H4; rewrite Ropp_0 in H4. assert (H7 := H4 n H5). rewrite Rplus_0_r in H7; apply H7. - unfold Un_cv in H1; unfold Un_cv in |- *; intros. + unfold Un_cv in H1; unfold Un_cv; intros. elim (H1 _ H3); intros. exists x; intros. - unfold R_dist in |- *; unfold R_dist in H4. + unfold R_dist; unfold R_dist in H4. rewrite Rminus_0_r; apply H4; assumption. Qed. @@ -91,13 +91,13 @@ Lemma CVU_continuity : (forall (n:nat) (y:R), Boule x r y -> continuity_pt (fn n) y) -> forall y:R, Boule x r y -> continuity_pt f y. Proof. - intros; unfold continuity_pt in |- *; unfold continue_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold R_dist in |- *; intros. + intros; unfold continuity_pt; unfold continue_in; + unfold limit1_in; unfold limit_in; + simpl; unfold R_dist; intros. unfold CVU in H. cut (0 < eps / 3); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ] ]. elim (H _ H3); intros N0 H4. assert (H5 := H0 N0 y H1). @@ -110,7 +110,7 @@ Proof. set (del := Rmin del1 del2). exists del; intros. split. - unfold del in |- *; unfold Rmin in |- *; case (Rle_dec del1 del2); intro. + unfold del; unfold Rmin; case (Rle_dec del1 del2); intro. apply (cond_pos del1). elim H8; intros; assumption. intros; @@ -130,27 +130,27 @@ Proof. elim H9; intros. apply Rlt_le_trans with del. assumption. - unfold del in |- *; apply Rmin_l. + unfold del; apply Rmin_l. elim H8; intros. apply H11. split. elim H9; intros; assumption. elim H9; intros; apply Rlt_le_trans with del. assumption. - unfold del in |- *; apply Rmin_r. + unfold del; apply Rmin_r. rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr'; apply H4. apply le_n. assumption. apply Rmult_eq_reg_l with 3. - do 2 rewrite Rmult_plus_distr_l; unfold Rdiv in |- *; rewrite <- Rmult_assoc; + do 2 rewrite Rmult_plus_distr_l; unfold Rdiv; rewrite <- Rmult_assoc; rewrite Rinv_r_simpl_m. ring. discrR. discrR. cut (0 < r - Rabs (x - y)). intro; exists (mkposreal _ H6). - simpl in |- *; intros. - unfold Boule in |- *; replace (y + h - x) with (h + (y - x)); + simpl; intros. + unfold Boule; replace (y + h - x) with (h + (y - x)); [ idtac | ring ]; apply Rle_lt_trans with (Rabs h + Rabs (y - x)). apply Rabs_triang. apply Rplus_lt_reg_r with (- Rabs (x - y)). @@ -173,8 +173,8 @@ Lemma continuity_pt_finite_SF : continuity_pt (fun y:R => sum_f_R0 (fun k:nat => fn k y) N) x. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; apply (H 0%nat); apply le_n. - simpl in |- *; + simpl; apply (H 0%nat); apply le_n. + simpl; replace (fun y:R => sum_f_R0 (fun k:nat => fn k y) N + fn (S N) y) with ((fun y:R => sum_f_R0 (fun k:nat => fn k y) N) + (fun y:R => fn (S N) y))%F; [ idtac | reflexivity ]. @@ -197,7 +197,7 @@ Proof. intros; eapply CVU_continuity. apply CVN_CVU. apply X. - intros; unfold SP in |- *; apply continuity_pt_finite_SF. + intros; unfold SP; apply continuity_pt_finite_SF. intros; apply H. apply H1. apply H0. @@ -208,7 +208,7 @@ Lemma SFL_continuity : (cv:forall x:R, { l:R | Un_cv (fun N:nat => SP fn N x) l }), CVN_R fn -> (forall n:nat, continuity (fn n)) -> continuity (SFL fn cv). Proof. - intros; unfold continuity in |- *; intro. + intros; unfold continuity; intro. cut (0 < Rabs x + 1); [ intro | apply Rplus_le_lt_0_compat; [ apply Rabs_pos | apply Rlt_0_1 ] ]. cut (Boule 0 (mkposreal _ H0) x). @@ -216,8 +216,8 @@ Proof. apply X. intros; apply (H n y). apply H1. - unfold Boule in |- *; simpl in |- *; rewrite Rminus_0_r; - pattern (Rabs x) at 1 in |- *; rewrite <- Rplus_0_r; + unfold Boule; simpl; rewrite Rminus_0_r; + pattern (Rabs x) at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; apply Rlt_0_1. Qed. @@ -227,10 +227,10 @@ Lemma CVN_R_CVS : CVN_R fn -> forall x:R, { l:R | Un_cv (fun N:nat => SP fn N x) l }. Proof. intros; apply R_complete. - unfold SP in |- *; set (An := fun N:nat => fn N x). - change (Cauchy_crit_series An) in |- *. + unfold SP; set (An := fun N:nat => fn N x). + change (Cauchy_crit_series An). apply cauchy_abs. - unfold Cauchy_crit_series in |- *; apply CV_Cauchy. + unfold Cauchy_crit_series; apply CV_Cauchy. unfold CVN_R in X; cut (0 < Rabs x + 1). intro; assert (H0 := X (mkposreal _ H)). unfold CVN_r in H0; elim H0; intros Bn H1. @@ -239,13 +239,13 @@ Proof. apply Rseries_CV_comp with Bn. intro; split. apply Rabs_pos. - unfold An in |- *; apply H4; unfold Boule in |- *; simpl in |- *; + unfold An; apply H4; unfold Boule; simpl; rewrite Rminus_0_r. - pattern (Rabs x) at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; + pattern (Rabs x) at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; apply Rlt_0_1. exists l. cut (forall n:nat, 0 <= Bn n). - intro; unfold Un_cv in H3; unfold Un_cv in |- *; intros. + intro; unfold Un_cv in H3; unfold Un_cv; intros. elim (H3 _ H6); intros. exists x0; intros. replace (sum_f_R0 Bn n) with (sum_f_R0 (fun k:nat => Rabs (Bn k)) n). @@ -253,8 +253,8 @@ Proof. apply sum_eq; intros; apply Rabs_right; apply Rle_ge; apply H5. intro; apply Rle_trans with (Rabs (An n)). apply Rabs_pos. - unfold An in |- *; apply H4; unfold Boule in |- *; simpl in |- *; - rewrite Rminus_0_r; pattern (Rabs x) at 1 in |- *; + unfold An; apply H4; unfold Boule; simpl; + rewrite Rminus_0_r; pattern (Rabs x) at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; apply Rlt_0_1. apply Rplus_le_lt_0_compat; [ apply Rabs_pos | apply Rlt_0_1 ]. Qed. diff --git a/theories/Reals/PartSum.v b/theories/Reals/PartSum.v index 3f90f15a..d765cf78 100644 --- a/theories/Reals/PartSum.v +++ b/theories/Reals/PartSum.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -11,15 +11,15 @@ Require Import Rfunctions. Require Import Rseries. Require Import Rcomplete. Require Import Max. -Open Local Scope R_scope. +Local Open Scope R_scope. Lemma tech1 : forall (An:nat -> R) (N:nat), (forall n:nat, (n <= N)%nat -> 0 < An n) -> 0 < sum_f_R0 An N. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; apply H; apply le_n. - simpl in |- *; apply Rplus_lt_0_compat. + simpl; apply H; apply le_n. + simpl; apply Rplus_lt_0_compat. apply HrecN; intros; apply H; apply le_S; assumption. apply H; apply le_n. Qed. @@ -52,7 +52,7 @@ Proof. repeat rewrite S_INR; ring. apply le_n_S; apply lt_le_weak; assumption. apply lt_le_S; assumption. - rewrite H1; rewrite <- minus_n_n; simpl in |- *. + rewrite H1; rewrite <- minus_n_n; simpl. replace (n + 0)%nat with n; [ reflexivity | ring ]. inversion H. right; reflexivity. @@ -66,7 +66,7 @@ Lemma tech3 : Proof. intros; cut (1 - k <> 0). intro; induction N as [| N HrecN]. - simpl in |- *; rewrite Rmult_1_r; unfold Rdiv in |- *; rewrite <- Rinv_r_sym. + simpl; rewrite Rmult_1_r; unfold Rdiv; rewrite <- Rinv_r_sym. reflexivity. apply H0. replace (sum_f_R0 (fun i:nat => k ^ i) (S N)) with @@ -75,15 +75,15 @@ Proof. replace ((1 - k ^ S N) / (1 - k) + k ^ S N) with ((1 - k ^ S N + (1 - k) * k ^ S N) / (1 - k)). apply Rmult_eq_reg_l with (1 - k). - unfold Rdiv in |- *; do 2 rewrite <- (Rmult_comm (/ (1 - k))); + unfold Rdiv; do 2 rewrite <- (Rmult_comm (/ (1 - k))); repeat rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; - [ do 2 rewrite Rmult_1_l; simpl in |- *; ring | apply H0 ]. + [ do 2 rewrite Rmult_1_l; simpl; ring | apply H0 ]. apply H0. - unfold Rdiv in |- *; rewrite Rmult_plus_distr_r; rewrite (Rmult_comm (1 - k)); + unfold Rdiv; rewrite Rmult_plus_distr_r; rewrite (Rmult_comm (1 - k)); repeat rewrite Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_r; reflexivity. apply H0. - apply Rminus_eq_contra; red in |- *; intro; elim H; symmetry in |- *; + apply Rminus_eq_contra; red; intro; elim H; symmetry ; assumption. Qed. @@ -92,11 +92,11 @@ Lemma tech4 : 0 <= k -> (forall i:nat, An (S i) < k * An i) -> An N <= An 0%nat * k ^ N. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; right; ring. + simpl; right; ring. apply Rle_trans with (k * An N). left; apply (H0 N). replace (S N) with (N + 1)%nat; [ idtac | ring ]. - rewrite pow_add; simpl in |- *; rewrite Rmult_1_r; + rewrite pow_add; simpl; rewrite Rmult_1_r; replace (An 0%nat * (k ^ N * k)) with (k * (An 0%nat * k ^ N)); [ idtac | ring ]; apply Rmult_le_compat_l. assumption. @@ -116,7 +116,7 @@ Lemma tech6 : sum_f_R0 An N <= An 0%nat * sum_f_R0 (fun i:nat => k ^ i) N. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; right; ring. + simpl; right; ring. apply Rle_trans with (An 0%nat * sum_f_R0 (fun i:nat => k ^ i) N + An (S N)). rewrite tech5; do 2 rewrite <- (Rplus_comm (An (S N))); apply Rplus_le_compat_l. @@ -127,13 +127,13 @@ Qed. Lemma tech7 : forall r1 r2:R, r1 <> 0 -> r2 <> 0 -> r1 <> r2 -> / r1 <> / r2. Proof. - intros; red in |- *; intro. + intros; red; intro. assert (H3 := Rmult_eq_compat_l r1 _ _ H2). rewrite <- Rinv_r_sym in H3; [ idtac | assumption ]. assert (H4 := Rmult_eq_compat_l r2 _ _ H3). rewrite Rmult_1_r in H4; rewrite <- Rmult_assoc in H4. rewrite Rinv_r_simpl_m in H4; [ idtac | assumption ]. - elim H1; symmetry in |- *; assumption. + elim H1; symmetry ; assumption. Qed. Lemma tech11 : @@ -142,7 +142,7 @@ Lemma tech11 : sum_f_R0 An N = sum_f_R0 Bn N - sum_f_R0 Cn N. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; apply H. + simpl; apply H. do 3 rewrite tech5; rewrite HrecN; rewrite (H (S N)); ring. Qed. @@ -151,7 +151,7 @@ Lemma tech12 : Un_cv (fun N:nat => sum_f_R0 (fun i:nat => An i * x ^ i) N) l -> Pser An x l. Proof. - intros; unfold Pser in |- *; unfold infinite_sum in |- *; unfold Un_cv in H; + intros; unfold Pser; unfold infinite_sum; unfold Un_cv in H; assumption. Qed. @@ -160,7 +160,7 @@ Lemma scal_sum : x * sum_f_R0 An N = sum_f_R0 (fun i:nat => An i * x) N. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; ring. + simpl; ring. do 2 rewrite tech5. rewrite Rmult_plus_distr_l; rewrite <- HrecN; ring. Qed. @@ -179,14 +179,14 @@ Proof. do 2 rewrite tech5. replace (S (S (pred N))) with (S N). rewrite (HrecN H1); ring. - rewrite H2; simpl in |- *; reflexivity. + rewrite H2; simpl; reflexivity. assert (H2 := O_or_S N). elim H2; intros. elim a; intros. rewrite <- p. - simpl in |- *; reflexivity. + simpl; reflexivity. rewrite <- b in H1; elim (lt_irrefl _ H1). - rewrite H1; simpl in |- *; reflexivity. + rewrite H1; simpl; reflexivity. inversion H. right; reflexivity. left; apply lt_le_trans with 1%nat; [ apply lt_O_Sn | assumption ]. @@ -197,7 +197,7 @@ Lemma plus_sum : sum_f_R0 (fun i:nat => An i + Bn i) N = sum_f_R0 An N + sum_f_R0 Bn N. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; ring. + simpl; ring. do 3 rewrite tech5; rewrite HrecN; ring. Qed. @@ -207,7 +207,7 @@ Lemma sum_eq : sum_f_R0 An N = sum_f_R0 Bn N. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; apply H; apply le_n. + simpl; apply H; apply le_n. do 2 rewrite tech5; rewrite HrecN. rewrite (H (S N)); [ reflexivity | apply le_n ]. intros; apply H; apply le_trans with N; [ assumption | apply le_n_Sn ]. @@ -218,7 +218,7 @@ Lemma uniqueness_sum : forall (An:nat -> R) (l1 l2:R), infinite_sum An l1 -> infinite_sum An l2 -> l1 = l2. Proof. - unfold infinite_sum in |- *; intros. + unfold infinite_sum; intros. case (Req_dec l1 l2); intro. assumption. cut (0 < Rabs ((l1 - l2) / 2)); [ intro | apply Rabs_pos_lt ]. @@ -235,19 +235,19 @@ Proof. intro; rewrite H12 in H11; assert (H13 := double_var); unfold Rdiv in H13; rewrite <- H13 in H11. elim (Rlt_irrefl _ H11). - apply Rabs_right; left; change (0 < / 2) in |- *; apply Rinv_0_lt_compat; + apply Rabs_right; left; change (0 < / 2); apply Rinv_0_lt_compat; cut (0%nat <> 2%nat); - [ intro H20; generalize (lt_INR_0 2 (neq_O_lt 2 H20)); unfold INR in |- *; + [ intro H20; generalize (lt_INR_0 2 (neq_O_lt 2 H20)); unfold INR; intro; assumption | discriminate ]. - unfold R_dist in |- *; rewrite <- (Rabs_Ropp (sum_f_R0 An N - l1)); + unfold R_dist; rewrite <- (Rabs_Ropp (sum_f_R0 An N - l1)); rewrite Ropp_minus_distr'. replace (l1 - l2) with (l1 - sum_f_R0 An N + (sum_f_R0 An N - l2)); [ idtac | ring ]. apply Rabs_triang. - unfold ge in |- *; unfold N in |- *; apply le_max_r. - unfold ge in |- *; unfold N in |- *; apply le_max_l. - unfold Rdiv in |- *; apply prod_neq_R0. + unfold ge; unfold N; apply le_max_r. + unfold ge; unfold N; apply le_max_l. + unfold Rdiv; apply prod_neq_R0. apply Rminus_eq_contra; assumption. apply Rinv_neq_0_compat; discrR. Qed. @@ -257,7 +257,7 @@ Lemma minus_sum : sum_f_R0 (fun i:nat => An i - Bn i) N = sum_f_R0 An N - sum_f_R0 Bn N. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; ring. + simpl; ring. do 3 rewrite tech5; rewrite HrecN; ring. Qed. @@ -268,7 +268,7 @@ Lemma sum_decomposition : Proof. intros. induction N as [| N HrecN]. - simpl in |- *; ring. + simpl; ring. rewrite tech5. rewrite (tech5 (fun l:nat => An (S (2 * l))) N). replace (2 * S (S N))%nat with (S (S (2 * S N))). @@ -286,7 +286,7 @@ Lemma sum_Rle : Proof. intros. induction N as [| N HrecN]. - simpl in |- *; apply H. + simpl; apply H. apply le_n. do 2 rewrite tech5. apply Rle_trans with (sum_f_R0 An N + Bn (S N)). @@ -306,7 +306,7 @@ Lemma Rsum_abs : Proof. intros. induction N as [| N HrecN]. - simpl in |- *. + simpl. right; reflexivity. do 2 rewrite tech5. apply Rle_trans with (Rabs (sum_f_R0 An N) + Rabs (An (S N))). @@ -321,7 +321,7 @@ Lemma sum_cte : Proof. intros. induction N as [| N HrecN]. - simpl in |- *; ring. + simpl; ring. rewrite tech5. rewrite HrecN; repeat rewrite S_INR; ring. Qed. @@ -333,7 +333,7 @@ Lemma sum_growing : Proof. intros. induction N as [| N HrecN]. - simpl in |- *; apply H. + simpl; apply H. do 2 rewrite tech5. apply Rle_trans with (sum_f_R0 An N + Bn (S N)). apply Rplus_le_compat_l; apply H. @@ -348,7 +348,7 @@ Lemma Rabs_triang_gen : Proof. intros. induction N as [| N HrecN]. - simpl in |- *. + simpl. right; reflexivity. do 2 rewrite tech5. apply Rle_trans with (Rabs (sum_f_R0 An N) + Rabs (An (S N))). @@ -364,7 +364,7 @@ Lemma cond_pos_sum : Proof. intros. induction N as [| N HrecN]. - simpl in |- *; apply H. + simpl; apply H. rewrite tech5. apply Rplus_le_le_0_compat. apply HrecN. @@ -380,7 +380,7 @@ Lemma cauchy_abs : forall An:nat -> R, Cauchy_crit_series (fun i:nat => Rabs (An i)) -> Cauchy_crit_series An. Proof. - unfold Cauchy_crit_series in |- *; unfold Cauchy_crit in |- *. + unfold Cauchy_crit_series; unfold Cauchy_crit. intros. elim (H eps H0); intros. exists x. @@ -400,8 +400,8 @@ Proof. elim a; intro. rewrite (tech2 An n m); [ idtac | assumption ]. rewrite (tech2 (fun i:nat => Rabs (An i)) n m); [ idtac | assumption ]. - unfold R_dist in |- *. - unfold Rminus in |- *. + unfold R_dist. + unfold Rminus. do 2 rewrite Ropp_plus_distr. do 2 rewrite <- Rplus_assoc. do 2 rewrite Rplus_opp_r. @@ -414,18 +414,18 @@ Proof. replace (fun i:nat => Rabs (An (S n + i)%nat)) with (fun i:nat => Rabs (Bn i)). apply Rabs_triang_gen. - unfold Bn in |- *; reflexivity. + unfold Bn; reflexivity. apply Rle_ge. apply cond_pos_sum. intro; apply Rabs_pos. rewrite b. - unfold R_dist in |- *. - unfold Rminus in |- *; do 2 rewrite Rplus_opp_r. + unfold R_dist. + unfold Rminus; do 2 rewrite Rplus_opp_r. rewrite Rabs_R0; right; reflexivity. rewrite (tech2 An m n); [ idtac | assumption ]. rewrite (tech2 (fun i:nat => Rabs (An i)) m n); [ idtac | assumption ]. - unfold R_dist in |- *. - unfold Rminus in |- *. + unfold R_dist. + unfold Rminus. do 2 rewrite Rplus_assoc. rewrite (Rplus_comm (sum_f_R0 An m)). rewrite (Rplus_comm (sum_f_R0 (fun i:nat => Rabs (An i)) m)). @@ -439,7 +439,7 @@ Proof. replace (fun i:nat => Rabs (An (S m + i)%nat)) with (fun i:nat => Rabs (Bn i)). apply Rabs_triang_gen. - unfold Bn in |- *; reflexivity. + unfold Bn; reflexivity. apply Rle_ge. apply cond_pos_sum. intro; apply Rabs_pos. @@ -454,7 +454,7 @@ Proof. intros An X. elim X; intros. unfold Un_cv in p. - unfold Cauchy_crit_series in |- *; unfold Cauchy_crit in |- *. + unfold Cauchy_crit_series; unfold Cauchy_crit. intros. cut (0 < eps / 2). intro. @@ -462,7 +462,7 @@ Proof. exists x0. intros. apply Rle_lt_trans with (R_dist (sum_f_R0 An n) x + R_dist (sum_f_R0 An m) x). - unfold R_dist in |- *. + unfold R_dist. replace (sum_f_R0 An n - sum_f_R0 An m) with (sum_f_R0 An n - x + - (sum_f_R0 An m - x)); [ idtac | ring ]. rewrite <- (Rabs_Ropp (sum_f_R0 An m - x)). @@ -471,8 +471,8 @@ Proof. apply Rplus_lt_compat. apply H1; assumption. apply H1; assumption. - right; symmetry in |- *; apply double_var. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + right; symmetry ; apply double_var. + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. Qed. @@ -493,7 +493,7 @@ Lemma sum_eq_R0 : (forall n:nat, (n <= N)%nat -> An n = 0) -> sum_f_R0 An N = 0. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; apply H; apply le_n. + simpl; apply H; apply le_n. rewrite tech5; rewrite HrecN; [ rewrite Rplus_0_l; apply H; apply le_n | intros; apply H; apply le_trans with N; [ assumption | apply le_n_Sn ] ]. @@ -530,15 +530,15 @@ Proof. [ idtac | ring ]; apply Rle_trans with l1. left; apply r. apply H6. - unfold l1 in |- *; apply Rge_le; + unfold l1; apply Rge_le; apply (growing_prop (fun k:nat => sum_f_R0 An k)). apply H1. - unfold ge, N0 in |- *; apply le_max_r. - unfold ge, N0 in |- *; apply le_max_l. + unfold ge, N0; apply le_max_r. + unfold ge, N0; apply le_max_l. apply Rplus_lt_reg_r with l; rewrite Rplus_0_r; replace (l + (l1 - l)) with l1; [ apply r | ring ]. - unfold Un_growing in |- *; intro; simpl in |- *; - pattern (sum_f_R0 An n) at 1 in |- *; rewrite <- Rplus_0_r; + unfold Un_growing; intro; simpl; + pattern (sum_f_R0 An n) at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; apply H0. Qed. @@ -572,7 +572,7 @@ Proof. apply Rlt_trans with (Rabs l1). apply Rmult_lt_reg_l with 2. prove_sup0. - unfold Rdiv in |- *; rewrite (Rmult_comm 2); rewrite Rmult_assoc; + unfold Rdiv; rewrite (Rmult_comm 2); rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r; rewrite double; apply Rplus_lt_compat_l; apply r. discrR. @@ -581,18 +581,18 @@ Proof. apply Rplus_lt_reg_r with ((Rabs l1 - l2) / 2 - Rabs (SP fn N x)). replace ((Rabs l1 - l2) / 2 - Rabs (SP fn N x) + (Rabs l1 + l2) / 2) with (Rabs l1 - Rabs (SP fn N x)). - unfold Rminus in |- *; rewrite Rplus_assoc; rewrite Rplus_opp_l; + unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; apply H7. - unfold Rdiv in |- *; rewrite Rmult_plus_distr_r; + unfold Rdiv; rewrite Rmult_plus_distr_r; rewrite <- (Rmult_comm (/ 2)); rewrite Rmult_minus_distr_l; - repeat rewrite (Rmult_comm (/ 2)); pattern (Rabs l1) at 1 in |- *; - rewrite double_var; unfold Rdiv in |- *; ring. + repeat rewrite (Rmult_comm (/ 2)); pattern (Rabs l1) at 1; + rewrite double_var; unfold Rdiv; ring. case (Rcase_abs (sum_f_R0 An N - l2)); intro. apply Rlt_trans with l2. apply (Rminus_lt _ _ r0). apply Rmult_lt_reg_l with 2. prove_sup0. - rewrite (double l2); unfold Rdiv in |- *; rewrite (Rmult_comm 2); + rewrite (double l2); unfold Rdiv; rewrite (Rmult_comm 2); rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r; rewrite (Rplus_comm (Rabs l1)); apply Rplus_lt_compat_l; apply r. @@ -600,23 +600,23 @@ Proof. rewrite (Rabs_right _ r0) in H6; apply Rplus_lt_reg_r with (- l2). replace (- l2 + (Rabs l1 + l2) / 2) with ((Rabs l1 - l2) / 2). rewrite Rplus_comm; apply H6. - unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); + unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite Rmult_minus_distr_l; rewrite Rmult_plus_distr_r; - pattern l2 at 2 in |- *; rewrite double_var; + pattern l2 at 2; rewrite double_var; repeat rewrite (Rmult_comm (/ 2)); rewrite Ropp_plus_distr; - unfold Rdiv in |- *; ring. + unfold Rdiv; ring. apply Rle_lt_trans with (Rabs (SP fn N x - l1)). rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr'; apply Rabs_triang_inv2. - apply H4; unfold ge, N in |- *; apply le_max_l. - apply H5; unfold ge, N in |- *; apply le_max_r. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + apply H4; unfold ge, N; apply le_max_l. + apply H5; unfold ge, N; apply le_max_r. + unfold Rdiv; apply Rmult_lt_0_compat. apply Rplus_lt_reg_r with l2. rewrite Rplus_0_r; replace (l2 + (Rabs l1 - l2)) with (Rabs l1); [ apply r | ring ]. apply Rinv_0_lt_compat; prove_sup0. intros; induction n0 as [| n0 Hrecn0]. - unfold SP in |- *; simpl in |- *; apply H1. - unfold SP in |- *; simpl in |- *. + unfold SP; simpl; apply H1. + unfold SP; simpl. apply Rle_trans with (Rabs (sum_f_R0 (fun k:nat => fn k x) n0) + Rabs (fn (S n0) x)). apply Rabs_triang. diff --git a/theories/Reals/RIneq.v b/theories/Reals/RIneq.v index 70f4ff0d..5fc7d8fb 100644 --- a/theories/Reals/RIneq.v +++ b/theories/Reals/RIneq.v @@ -1,7 +1,7 @@ (* -*- coding: utf-8 -*- *) (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -52,13 +52,13 @@ Proof. exact Rlt_irrefl. Qed. Lemma Rlt_not_eq : forall r1 r2, r1 < r2 -> r1 <> r2. Proof. - red in |- *; intros r1 r2 H H0; apply (Rlt_irrefl r1). - pattern r1 at 2 in |- *; rewrite H0; trivial. + red; intros r1 r2 H H0; apply (Rlt_irrefl r1). + pattern r1 at 2; rewrite H0; trivial. Qed. Lemma Rgt_not_eq : forall r1 r2, r1 > r2 -> r1 <> r2. Proof. - intros; apply sym_not_eq; apply Rlt_not_eq; auto with real. + intros; apply not_eq_sym; apply Rlt_not_eq; auto with real. Qed. (**********) @@ -102,7 +102,7 @@ Qed. Lemma Rlt_le : forall r1 r2, r1 < r2 -> r1 <= r2. Proof. - intros; red in |- *; tauto. + intros; red; tauto. Qed. Hint Resolve Rlt_le: real. @@ -114,14 +114,14 @@ Qed. (**********) Lemma Rle_ge : forall r1 r2, r1 <= r2 -> r2 >= r1. Proof. - destruct 1; red in |- *; auto with real. + destruct 1; red; auto with real. Qed. Hint Immediate Rle_ge: real. Hint Resolve Rle_ge: rorders. Lemma Rge_le : forall r1 r2, r1 >= r2 -> r2 <= r1. Proof. - destruct 1; red in |- *; auto with real. + destruct 1; red; auto with real. Qed. Hint Resolve Rge_le: real. Hint Immediate Rge_le: rorders. @@ -143,7 +143,7 @@ Hint Immediate Rgt_lt: rorders. Lemma Rnot_le_lt : forall r1 r2, ~ r1 <= r2 -> r2 < r1. Proof. - intros r1 r2; generalize (Rtotal_order r1 r2); unfold Rle in |- *; tauto. + intros r1 r2; generalize (Rtotal_order r1 r2); unfold Rle; tauto. Qed. Hint Immediate Rnot_le_lt: real. @@ -174,7 +174,7 @@ Proof. eauto using Rnot_gt_ge with rorders. Qed. (**********) Lemma Rlt_not_le : forall r1 r2, r2 < r1 -> ~ r1 <= r2. Proof. - generalize Rlt_asym Rlt_dichotomy_converse; unfold Rle in |- *. + generalize Rlt_asym Rlt_dichotomy_converse; unfold Rle. intuition eauto 3. Qed. Hint Immediate Rlt_not_le: real. @@ -192,7 +192,7 @@ Proof. exact Rlt_not_ge. Qed. Lemma Rle_not_lt : forall r1 r2, r2 <= r1 -> ~ r1 < r2. Proof. intros r1 r2. generalize (Rlt_asym r1 r2) (Rlt_dichotomy_converse r1 r2). - unfold Rle in |- *; intuition. + unfold Rle; intuition. Qed. Lemma Rge_not_lt : forall r1 r2, r1 >= r2 -> ~ r1 < r2. @@ -207,25 +207,25 @@ Proof. do 2 intro; apply Rge_not_lt. Qed. (**********) Lemma Req_le : forall r1 r2, r1 = r2 -> r1 <= r2. Proof. - unfold Rle in |- *; tauto. + unfold Rle; tauto. Qed. Hint Immediate Req_le: real. Lemma Req_ge : forall r1 r2, r1 = r2 -> r1 >= r2. Proof. - unfold Rge in |- *; tauto. + unfold Rge; tauto. Qed. Hint Immediate Req_ge: real. Lemma Req_le_sym : forall r1 r2, r2 = r1 -> r1 <= r2. Proof. - unfold Rle in |- *; auto. + unfold Rle; auto. Qed. Hint Immediate Req_le_sym: real. Lemma Req_ge_sym : forall r1 r2, r2 = r1 -> r1 >= r2. Proof. - unfold Rge in |- *; auto. + unfold Rge; auto. Qed. Hint Immediate Req_ge_sym: real. @@ -240,7 +240,7 @@ Proof. do 2 intro; apply Rlt_asym. Qed. Lemma Rle_antisym : forall r1 r2, r1 <= r2 -> r2 <= r1 -> r1 = r2. Proof. - intros r1 r2; generalize (Rlt_asym r1 r2); unfold Rle in |- *; intuition. + intros r1 r2; generalize (Rlt_asym r1 r2); unfold Rle; intuition. Qed. Hint Resolve Rle_antisym: real. @@ -276,8 +276,8 @@ Proof. intros; red; apply Rlt_eq_compat with (r2:=r4) (r4:=r2); auto. Qed. Lemma Rle_trans : forall r1 r2 r3, r1 <= r2 -> r2 <= r3 -> r1 <= r3. Proof. - generalize trans_eq Rlt_trans Rlt_eq_compat. - unfold Rle in |- *. + generalize eq_trans Rlt_trans Rlt_eq_compat. + unfold Rle. intuition eauto 2. Qed. @@ -291,13 +291,13 @@ Proof. eauto using Rlt_trans with rorders. Qed. Lemma Rle_lt_trans : forall r1 r2 r3, r1 <= r2 -> r2 < r3 -> r1 < r3. Proof. generalize Rlt_trans Rlt_eq_compat. - unfold Rle in |- *. + unfold Rle. intuition eauto 2. Qed. Lemma Rlt_le_trans : forall r1 r2 r3, r1 < r2 -> r2 <= r3 -> r1 < r3. Proof. - generalize Rlt_trans Rlt_eq_compat; unfold Rle in |- *; intuition eauto 2. + generalize Rlt_trans Rlt_eq_compat; unfold Rle; intuition eauto 2. Qed. Lemma Rge_gt_trans : forall r1 r2 r3, r1 >= r2 -> r2 > r3 -> r1 > r3. @@ -430,7 +430,7 @@ Hint Resolve Rplus_eq_reg_l: real. (**********) Lemma Rplus_0_r_uniq : forall r r1, r + r1 = r -> r1 = 0. Proof. - intros r b; pattern r at 2 in |- *; replace r with (r + 0); eauto with real. + intros r b; pattern r at 2; replace r with (r + 0); eauto with real. Qed. (***********) @@ -441,7 +441,7 @@ Proof. absurd (0 < a + b). rewrite H1; auto with real. apply Rle_lt_trans with (a + 0). - rewrite Rplus_0_r in |- *; assumption. + rewrite Rplus_0_r; assumption. auto using Rplus_lt_compat_l with real. rewrite <- H0, Rplus_0_r in H1; assumption. Qed. @@ -570,14 +570,14 @@ Qed. (**********) Lemma Rmult_neq_0_reg : forall r1 r2, r1 * r2 <> 0 -> r1 <> 0 /\ r2 <> 0. Proof. - intros r1 r2 H; split; red in |- *; intro; apply H; auto with real. + intros r1 r2 H; split; red; intro; apply H; auto with real. Qed. (**********) Lemma Rmult_integral_contrapositive : forall r1 r2, r1 <> 0 /\ r2 <> 0 -> r1 * r2 <> 0. Proof. - red in |- *; intros r1 r2 [H1 H2] H. + red; intros r1 r2 [H1 H2] H. case (Rmult_integral r1 r2); auto with real. Qed. Hint Resolve Rmult_integral_contrapositive: real. @@ -604,12 +604,12 @@ Notation "r ²" := (Rsqr r) (at level 1, format "r ²") : R_scope. (***********) Lemma Rsqr_0 : Rsqr 0 = 0. - unfold Rsqr in |- *; auto with real. + unfold Rsqr; auto with real. Qed. (***********) Lemma Rsqr_0_uniq : forall r, Rsqr r = 0 -> r = 0. - unfold Rsqr in |- *; intros; elim (Rmult_integral r r H); trivial. + unfold Rsqr; intros; elim (Rmult_integral r r H); trivial. Qed. (*********************************************************) @@ -647,7 +647,7 @@ Hint Resolve Ropp_involutive: real. (*********) Lemma Ropp_neq_0_compat : forall r, r <> 0 -> - r <> 0. Proof. - red in |- *; intros r H H0. + red; intros r H H0. apply H. transitivity (- - r); auto with real. Qed. @@ -720,7 +720,7 @@ Hint Resolve Rminus_diag_eq: real. (**********) Lemma Rminus_diag_uniq : forall r1 r2, r1 - r2 = 0 -> r1 = r2. Proof. - intros r1 r2; unfold Rminus in |- *; rewrite Rplus_comm; intro. + intros r1 r2; unfold Rminus; rewrite Rplus_comm; intro. rewrite <- (Ropp_involutive r2); apply (Rplus_opp_r_uniq (- r2) r1 H). Qed. Hint Immediate Rminus_diag_uniq: real. @@ -741,20 +741,20 @@ Hint Resolve Rplus_minus: real. (**********) Lemma Rminus_eq_contra : forall r1 r2, r1 <> r2 -> r1 - r2 <> 0. Proof. - red in |- *; intros r1 r2 H H0. + red; intros r1 r2 H H0. apply H; auto with real. Qed. Hint Resolve Rminus_eq_contra: real. Lemma Rminus_not_eq : forall r1 r2, r1 - r2 <> 0 -> r1 <> r2. Proof. - red in |- *; intros; elim H; apply Rminus_diag_eq; auto. + red; intros; elim H; apply Rminus_diag_eq; auto. Qed. Hint Resolve Rminus_not_eq: real. Lemma Rminus_not_eq_right : forall r1 r2, r2 - r1 <> 0 -> r1 <> r2. Proof. - red in |- *; intros; elim H; rewrite H0; ring. + red; intros; elim H; rewrite H0; ring. Qed. Hint Resolve Rminus_not_eq_right: real. @@ -778,7 +778,7 @@ Hint Resolve Rinv_1: real. (*********) Lemma Rinv_neq_0_compat : forall r, r <> 0 -> / r <> 0. Proof. - red in |- *; intros; apply R1_neq_R0. + red; intros; apply R1_neq_R0. replace 1 with (/ r * r); auto with real. Qed. Hint Resolve Rinv_neq_0_compat: real. @@ -858,7 +858,7 @@ Proof. do 3 intro; apply Rplus_lt_compat_r. Qed. (**********) Lemma Rplus_le_compat_l : forall r r1 r2, r1 <= r2 -> r + r1 <= r + r2. Proof. - unfold Rle in |- *; intros; elim H; intro. + unfold Rle; intros; elim H; intro. left; apply (Rplus_lt_compat_l r r1 r2 H0). right; rewrite <- H0; auto with zarith real. Qed. @@ -870,7 +870,7 @@ Hint Resolve Rplus_ge_compat_l: real. (**********) Lemma Rplus_le_compat_r : forall r r1 r2, r1 <= r2 -> r1 + r <= r2 + r. Proof. - unfold Rle in |- *; intros; elim H; intro. + unfold Rle; intros; elim H; intro. left; apply (Rplus_lt_compat_r r r1 r2 H0). right; rewrite <- H0; auto with real. Qed. @@ -931,7 +931,7 @@ Lemma Rplus_lt_0_compat : forall r1 r2, 0 < r1 -> 0 < r2 -> 0 < r1 + r2. Proof. intros x y; intros; apply Rlt_trans with x; [ assumption - | pattern x at 1 in |- *; rewrite <- (Rplus_0_r x); apply Rplus_lt_compat_l; + | pattern x at 1; rewrite <- (Rplus_0_r x); apply Rplus_lt_compat_l; assumption ]. Qed. @@ -939,7 +939,7 @@ Lemma Rplus_le_lt_0_compat : forall r1 r2, 0 <= r1 -> 0 < r2 -> 0 < r1 + r2. Proof. intros x y; intros; apply Rle_lt_trans with x; [ assumption - | pattern x at 1 in |- *; rewrite <- (Rplus_0_r x); apply Rplus_lt_compat_l; + | pattern x at 1; rewrite <- (Rplus_0_r x); apply Rplus_lt_compat_l; assumption ]. Qed. @@ -953,7 +953,7 @@ Lemma Rplus_le_le_0_compat : forall r1 r2, 0 <= r1 -> 0 <= r2 -> 0 <= r1 + r2. Proof. intros x y; intros; apply Rle_trans with x; [ assumption - | pattern x at 1 in |- *; rewrite <- (Rplus_0_r x); apply Rplus_le_compat_l; + | pattern x at 1; rewrite <- (Rplus_0_r x); apply Rplus_le_compat_l; assumption ]. Qed. @@ -981,7 +981,7 @@ Qed. Lemma Rplus_le_reg_l : forall r r1 r2, r + r1 <= r + r2 -> r1 <= r2. Proof. - unfold Rle in |- *; intros; elim H; intro. + unfold Rle; intros; elim H; intro. left; apply (Rplus_lt_reg_r r r1 r2 H0). right; apply (Rplus_eq_reg_l r r1 r2 H0). Qed. @@ -995,7 +995,7 @@ Qed. Lemma Rplus_gt_reg_l : forall r r1 r2, r + r1 > r + r2 -> r1 > r2. Proof. - unfold Rgt in |- *; intros; apply (Rplus_lt_reg_r r r2 r1 H). + unfold Rgt; intros; apply (Rplus_lt_reg_r r r2 r1 H). Qed. Lemma Rplus_ge_reg_l : forall r r1 r2, r + r1 >= r + r2 -> r1 >= r2. @@ -1046,7 +1046,7 @@ Qed. Lemma Ropp_gt_lt_contravar : forall r1 r2, r1 > r2 -> - r1 < - r2. Proof. - unfold Rgt in |- *; intros. + unfold Rgt; intros. apply (Rplus_lt_reg_r (r2 + r1)). replace (r2 + r1 + - r1) with r2. replace (r2 + r1 + - r2) with r1. @@ -1058,7 +1058,7 @@ Hint Resolve Ropp_gt_lt_contravar. Lemma Ropp_lt_gt_contravar : forall r1 r2, r1 < r2 -> - r1 > - r2. Proof. - unfold Rgt in |- *; auto with real. + unfold Rgt; auto with real. Qed. Hint Resolve Ropp_lt_gt_contravar: real. @@ -1183,7 +1183,7 @@ Proof. eauto using Rmult_lt_compat_l with rorders. Qed. Lemma Rmult_le_compat_l : forall r r1 r2, 0 <= r -> r1 <= r2 -> r * r1 <= r * r2. Proof. - intros r r1 r2 H H0; destruct H; destruct H0; unfold Rle in |- *; + intros r r1 r2 H H0; destruct H; destruct H0; unfold Rle; auto with real. right; rewrite <- H; do 2 rewrite Rmult_0_l; reflexivity. Qed. @@ -1342,7 +1342,7 @@ Qed. (**********) Lemma Rle_minus : forall r1 r2, r1 <= r2 -> r1 - r2 <= 0. Proof. - destruct 1; unfold Rle in |- *; auto with real. + destruct 1; unfold Rle; auto with real. Qed. Lemma Rge_minus : forall r1 r2, r1 >= r2 -> r1 - r2 >= 0. @@ -1356,7 +1356,7 @@ Qed. Lemma Rminus_lt : forall r1 r2, r1 - r2 < 0 -> r1 < r2. Proof. intros; replace r1 with (r1 - r2 + r2). - pattern r2 at 3 in |- *; replace r2 with (0 + r2); auto with real. + pattern r2 at 3; replace r2 with (0 + r2); auto with real. ring. Qed. @@ -1372,7 +1372,7 @@ Qed. Lemma Rminus_le : forall r1 r2, r1 - r2 <= 0 -> r1 <= r2. Proof. intros; replace r1 with (r1 - r2 + r2). - pattern r2 at 3 in |- *; replace r2 with (0 + r2); auto with real. + pattern r2 at 3; replace r2 with (0 + r2); auto with real. ring. Qed. @@ -1387,7 +1387,7 @@ Qed. (**********) Lemma tech_Rplus : forall r (s:R), 0 <= r -> 0 < s -> r + s <> 0. Proof. - intros; apply sym_not_eq; apply Rlt_not_eq. + intros; apply not_eq_sym; apply Rlt_not_eq. rewrite Rplus_comm; replace 0 with (0 + 0); auto with real. Qed. Hint Immediate tech_Rplus: real. @@ -1398,7 +1398,7 @@ Hint Immediate tech_Rplus: real. Lemma Rle_0_sqr : forall r, 0 <= Rsqr r. Proof. - intro; case (Rlt_le_dec r 0); unfold Rsqr in |- *; intro. + intro; case (Rlt_le_dec r 0); unfold Rsqr; intro. replace (r * r) with (- r * - r); auto with real. replace 0 with (- r * 0); auto with real. replace 0 with (0 * r); auto with real. @@ -1407,7 +1407,7 @@ Qed. (***********) Lemma Rlt_0_sqr : forall r, r <> 0 -> 0 < Rsqr r. Proof. - intros; case (Rdichotomy r 0); trivial; unfold Rsqr in |- *; intro. + intros; case (Rdichotomy r 0); trivial; unfold Rsqr; intro. replace (r * r) with (- r * - r); auto with real. replace 0 with (- r * 0); auto with real. replace 0 with (0 * r); auto with real. @@ -1437,7 +1437,7 @@ Qed. Lemma Rlt_0_1 : 0 < 1. Proof. replace 1 with (Rsqr 1); auto with real. - unfold Rsqr in |- *; auto with real. + unfold Rsqr; auto with real. Qed. Hint Resolve Rlt_0_1: real. @@ -1453,7 +1453,7 @@ Qed. Lemma Rinv_0_lt_compat : forall r, 0 < r -> 0 < / r. Proof. - intros; apply Rnot_le_lt; red in |- *; intros. + intros; apply Rnot_le_lt; red; intros. absurd (1 <= 0); auto with real. replace 1 with (r * / r); auto with real. replace 0 with (r * 0); auto with real. @@ -1463,7 +1463,7 @@ Hint Resolve Rinv_0_lt_compat: real. (*********) Lemma Rinv_lt_0_compat : forall r, r < 0 -> / r < 0. Proof. - intros; apply Rnot_le_lt; red in |- *; intros. + intros; apply Rnot_le_lt; red; intros. absurd (1 <= 0); auto with real. replace 1 with (r * / r); auto with real. replace 0 with (r * 0); auto with real. @@ -1477,8 +1477,8 @@ Proof. case (Rmult_neq_0_reg r1 r2); intros; auto with real. replace (r1 * r2 * / r2) with r1. replace (r1 * r2 * / r1) with r2; trivial. - symmetry in |- *; auto with real. - symmetry in |- *; auto with real. + symmetry ; auto with real. + symmetry ; auto with real. Qed. Lemma Rinv_1_lt_contravar : forall r1 r2, 1 <= r1 -> r1 < r2 -> / r2 < / r1. @@ -1495,7 +1495,7 @@ Proof. rewrite (Rmult_comm x); rewrite <- Rmult_assoc; rewrite (Rmult_comm y (/ y)); rewrite Rinv_l; auto with real. apply Rlt_dichotomy_converse; right. - red in |- *; apply Rlt_trans with (r2 := x); auto with real. + red; apply Rlt_trans with (r2 := x); auto with real. Qed. Hint Resolve Rinv_1_lt_contravar: real. @@ -1508,7 +1508,7 @@ Lemma Rle_lt_0_plus_1 : forall r, 0 <= r -> 0 < r + 1. Proof. intros. apply Rlt_le_trans with 1; auto with real. - pattern 1 at 1 in |- *; replace 1 with (0 + 1); auto with real. + pattern 1 at 1; replace 1 with (0 + 1); auto with real. Qed. Hint Resolve Rle_lt_0_plus_1: real. @@ -1516,15 +1516,15 @@ Hint Resolve Rle_lt_0_plus_1: real. Lemma Rlt_plus_1 : forall r, r < r + 1. Proof. intros. - pattern r at 1 in |- *; replace r with (r + 0); auto with real. + pattern r at 1; replace r with (r + 0); auto with real. Qed. Hint Resolve Rlt_plus_1: real. (**********) Lemma tech_Rgt_minus : forall r1 r2, 0 < r2 -> r1 > r1 - r2. Proof. - red in |- *; unfold Rminus in |- *; intros. - pattern r1 at 2 in |- *; replace r1 with (r1 + 0); auto with real. + red; unfold Rminus; intros. + pattern r1 at 2; replace r1 with (r1 + 0); auto with real. Qed. (*********************************************************) @@ -1540,14 +1540,14 @@ Qed. (**********) Lemma S_O_plus_INR : forall n:nat, INR (1 + n) = INR 1 + INR n. Proof. - intro; simpl in |- *; case n; intros; auto with real. + intro; simpl; case n; intros; auto with real. Qed. (**********) Lemma plus_INR : forall n m:nat, INR (n + m) = INR n + INR m. Proof. intros n m; induction n as [| n Hrecn]. - simpl in |- *; auto with real. + simpl; auto with real. replace (S n + m)%nat with (S (n + m)); auto with arith. repeat rewrite S_INR. rewrite Hrecn; ring. @@ -1557,9 +1557,9 @@ Hint Resolve plus_INR: real. (**********) Lemma minus_INR : forall n m:nat, (m <= n)%nat -> INR (n - m) = INR n - INR m. Proof. - intros n m le; pattern m, n in |- *; apply le_elim_rel; auto with real. + intros n m le; pattern m, n; apply le_elim_rel; auto with real. intros; rewrite <- minus_n_O; auto with real. - intros; repeat rewrite S_INR; simpl in |- *. + intros; repeat rewrite S_INR; simpl. rewrite H0; ring. Qed. Hint Resolve minus_INR: real. @@ -1568,8 +1568,8 @@ Hint Resolve minus_INR: real. Lemma mult_INR : forall n m:nat, INR (n * m) = INR n * INR m. Proof. intros n m; induction n as [| n Hrecn]. - simpl in |- *; auto with real. - intros; repeat rewrite S_INR; simpl in |- *. + simpl; auto with real. + intros; repeat rewrite S_INR; simpl. rewrite plus_INR; rewrite Hrecn; ring. Qed. Hint Resolve mult_INR: real. @@ -1597,11 +1597,11 @@ Qed. Hint Resolve lt_1_INR: real. (**********) -Lemma pos_INR_nat_of_P : forall p:positive, 0 < INR (nat_of_P p). +Lemma pos_INR_nat_of_P : forall p:positive, 0 < INR (Pos.to_nat p). Proof. intro; apply lt_0_INR. - simpl in |- *; auto with real. - apply nat_of_P_pos. + simpl; auto with real. + apply Pos2Nat.is_pos. Qed. Hint Resolve pos_INR_nat_of_P: real. @@ -1609,7 +1609,7 @@ Hint Resolve pos_INR_nat_of_P: real. Lemma pos_INR : forall n:nat, 0 <= INR n. Proof. intro n; case n. - simpl in |- *; auto with real. + simpl; auto with real. auto with arith real. Qed. Hint Resolve pos_INR: real. @@ -1617,10 +1617,10 @@ Hint Resolve pos_INR: real. Lemma INR_lt : forall n m:nat, INR n < INR m -> (n < m)%nat. Proof. double induction n m; intros. - simpl in |- *; exfalso; apply (Rlt_irrefl 0); auto. + simpl; exfalso; apply (Rlt_irrefl 0); auto. auto with arith. generalize (pos_INR (S n0)); intro; cut (INR 0 = 0); - [ intro H2; rewrite H2 in H0; idtac | simpl in |- *; trivial ]. + [ intro H2; rewrite H2 in H0; idtac | simpl; trivial ]. generalize (Rle_lt_trans 0 (INR (S n0)) 0 H1 H0); intro; exfalso; apply (Rlt_irrefl 0); auto. do 2 rewrite S_INR in H1; cut (INR n1 < INR n0). @@ -1642,7 +1642,7 @@ Hint Resolve le_INR: real. (**********) Lemma INR_not_0 : forall n:nat, INR n <> 0 -> n <> 0%nat. Proof. - red in |- *; intros n H H1. + red; intros n H H1. apply H. rewrite H1; trivial. Qed. @@ -1654,7 +1654,7 @@ Proof. intro n; case n. intro; absurd (0%nat = 0%nat); trivial. intros; rewrite S_INR. - apply Rgt_not_eq; red in |- *; auto with real. + apply Rgt_not_eq; red; auto with real. Qed. Hint Resolve not_0_INR: real. @@ -1664,7 +1664,7 @@ Proof. case (le_lt_or_eq _ _ H1); intros H2. apply Rlt_dichotomy_converse; auto with real. exfalso; auto. - apply sym_not_eq; apply Rlt_dichotomy_converse; auto with real. + apply not_eq_sym; apply Rlt_dichotomy_converse; auto with real. Qed. Hint Resolve not_INR: real. @@ -1675,7 +1675,7 @@ Proof. cut (n <> m). intro H3; generalize (not_INR n m H3); intro H4; exfalso; auto. omega. - symmetry in |- *; cut (m <> n). + symmetry ; cut (m <> n). intro H3; generalize (not_INR m n H3); intro H4; exfalso; auto. omega. Qed. @@ -1701,16 +1701,16 @@ Hint Resolve not_1_INR: real. (**********) -Lemma IZN : forall n:Z, (0 <= n)%Z -> exists m : nat, n = Z_of_nat m. +Lemma IZN : forall n:Z, (0 <= n)%Z -> exists m : nat, n = Z.of_nat m. Proof. intros z; idtac; apply Z_of_nat_complete; assumption. Qed. (**********) -Lemma INR_IZR_INZ : forall n:nat, INR n = IZR (Z_of_nat n). +Lemma INR_IZR_INZ : forall n:nat, INR n = IZR (Z.of_nat n). Proof. simple induction n; auto with real. - intros; simpl in |- *; rewrite nat_of_P_of_succ_nat; + intros; simpl; rewrite SuccNat2Pos.id_succ; auto with real. Qed. @@ -1718,13 +1718,13 @@ Lemma plus_IZR_NEG_POS : forall p q:positive, IZR (Zpos p + Zneg q) = IZR (Zpos p) + IZR (Zneg q). Proof. intros p q; simpl. rewrite Z.pos_sub_spec. - case Pcompare_spec; intros H; simpl. + case Pos.compare_spec; intros H; simpl. subst. ring. - rewrite Pminus_minus by trivial. - rewrite minus_INR by (now apply lt_le_weak, Plt_lt). + rewrite Pos2Nat.inj_sub by trivial. + rewrite minus_INR by (now apply lt_le_weak, Pos2Nat.inj_lt). ring. - rewrite Pminus_minus by trivial. - rewrite minus_INR by (now apply lt_le_weak, Plt_lt). + rewrite Pos2Nat.inj_sub by trivial. + rewrite minus_INR by (now apply lt_le_weak, Pos2Nat.inj_lt). ring. Qed. @@ -1732,55 +1732,55 @@ Qed. Lemma plus_IZR : forall n m:Z, IZR (n + m) = IZR n + IZR m. Proof. intro z; destruct z; intro t; destruct t; intros; auto with real. - simpl; intros; rewrite Pplus_plus; auto with real. + simpl; intros; rewrite Pos2Nat.inj_add; auto with real. apply plus_IZR_NEG_POS. - rewrite Zplus_comm; rewrite Rplus_comm; apply plus_IZR_NEG_POS. - simpl; intros; rewrite Pplus_plus; rewrite plus_INR; + rewrite Z.add_comm; rewrite Rplus_comm; apply plus_IZR_NEG_POS. + simpl; intros; rewrite Pos2Nat.inj_add; rewrite plus_INR; auto with real. Qed. (**********) Lemma mult_IZR : forall n m:Z, IZR (n * m) = IZR n * IZR m. Proof. - intros z t; case z; case t; simpl in |- *; auto with real. - intros t1 z1; rewrite Pmult_mult; auto with real. - intros t1 z1; rewrite Pmult_mult; auto with real. + intros z t; case z; case t; simpl; auto with real. + intros t1 z1; rewrite Pos2Nat.inj_mul; auto with real. + intros t1 z1; rewrite Pos2Nat.inj_mul; auto with real. rewrite Rmult_comm. rewrite Ropp_mult_distr_l_reverse; auto with real. apply Ropp_eq_compat; rewrite mult_comm; auto with real. - intros t1 z1; rewrite Pmult_mult; auto with real. + intros t1 z1; rewrite Pos2Nat.inj_mul; auto with real. rewrite Ropp_mult_distr_l_reverse; auto with real. - intros t1 z1; rewrite Pmult_mult; auto with real. + intros t1 z1; rewrite Pos2Nat.inj_mul; auto with real. rewrite Rmult_opp_opp; auto with real. Qed. -Lemma pow_IZR : forall z n, pow (IZR z) n = IZR (Zpower z (Z_of_nat n)). +Lemma pow_IZR : forall z n, pow (IZR z) n = IZR (Z.pow z (Z.of_nat n)). Proof. intros z [|n];simpl;trivial. rewrite Zpower_pos_nat. - rewrite nat_of_P_of_succ_nat. unfold Zpower_nat;simpl. + rewrite SuccNat2Pos.id_succ. unfold Zpower_nat;simpl. rewrite mult_IZR. induction n;simpl;trivial. rewrite mult_IZR;ring[IHn]. Qed. (**********) -Lemma succ_IZR : forall n:Z, IZR (Zsucc n) = IZR n + 1. +Lemma succ_IZR : forall n:Z, IZR (Z.succ n) = IZR n + 1. Proof. - intro; change 1 with (IZR 1); unfold Zsucc; apply plus_IZR. + intro; change 1 with (IZR 1); unfold Z.succ; apply plus_IZR. Qed. (**********) Lemma opp_IZR : forall n:Z, IZR (- n) = - IZR n. Proof. - intro z; case z; simpl in |- *; auto with real. + intro z; case z; simpl; auto with real. Qed. Definition Ropp_Ropp_IZR := opp_IZR. Lemma minus_IZR : forall n m:Z, IZR (n - m) = IZR n - IZR m. Proof. - intros; unfold Zminus, Rminus. + intros; unfold Z.sub, Rminus. rewrite <- opp_IZR. apply plus_IZR. Qed. @@ -1788,16 +1788,16 @@ Qed. (**********) Lemma Z_R_minus : forall n m:Z, IZR n - IZR m = IZR (n - m). Proof. - intros z1 z2; unfold Rminus in |- *; unfold Zminus in |- *. - rewrite <- (Ropp_Ropp_IZR z2); symmetry in |- *; apply plus_IZR. + intros z1 z2; unfold Rminus; unfold Z.sub. + rewrite <- (Ropp_Ropp_IZR z2); symmetry ; apply plus_IZR. Qed. (**********) Lemma lt_0_IZR : forall n:Z, 0 < IZR n -> (0 < n)%Z. Proof. - intro z; case z; simpl in |- *; intros. + intro z; case z; simpl; intros. absurd (0 < 0); auto with real. - unfold Zlt in |- *; simpl in |- *; trivial. + unfold Z.lt; simpl; trivial. case Rlt_not_le with (1 := H). replace 0 with (-0); auto with real. Qed. @@ -1805,7 +1805,7 @@ Qed. (**********) Lemma lt_IZR : forall n m:Z, IZR n < IZR m -> (n < m)%Z. Proof. - intros z1 z2 H; apply Zlt_0_minus_lt. + intros z1 z2 H; apply Z.lt_0_sub. apply lt_0_IZR. rewrite <- Z_R_minus. exact (Rgt_minus (IZR z2) (IZR z1) H). @@ -1814,10 +1814,10 @@ Qed. (**********) Lemma eq_IZR_R0 : forall n:Z, IZR n = 0 -> n = 0%Z. Proof. - intro z; destruct z; simpl in |- *; intros; auto with zarith. - case (Rlt_not_eq 0 (INR (nat_of_P p))); auto with real. - case (Rlt_not_eq (- INR (nat_of_P p)) 0); auto with real. - apply Ropp_lt_gt_0_contravar. unfold Rgt in |- *; apply pos_INR_nat_of_P. + intro z; destruct z; simpl; intros; auto with zarith. + case (Rlt_not_eq 0 (INR (Pos.to_nat p))); auto with real. + case (Rlt_not_eq (- INR (Pos.to_nat p)) 0); auto with real. + apply Ropp_lt_gt_0_contravar. unfold Rgt; apply pos_INR_nat_of_P. Qed. (**********) @@ -1831,23 +1831,23 @@ Qed. (**********) Lemma not_0_IZR : forall n:Z, n <> 0%Z -> IZR n <> 0. Proof. - intros z H; red in |- *; intros H0; case H. + intros z H; red; intros H0; case H. apply eq_IZR; auto. Qed. (*********) Lemma le_0_IZR : forall n:Z, 0 <= IZR n -> (0 <= n)%Z. Proof. - unfold Rle in |- *; intros z [H| H]. - red in |- *; intro; apply (Zlt_le_weak 0 z (lt_0_IZR z H)); assumption. + unfold Rle; intros z [H| H]. + red; intro; apply (Z.lt_le_incl 0 z (lt_0_IZR z H)); assumption. rewrite (eq_IZR_R0 z); auto with zarith real. Qed. (**********) Lemma le_IZR : forall n m:Z, IZR n <= IZR m -> (n <= m)%Z. Proof. - unfold Rle in |- *; intros z1 z2 [H| H]. - apply (Zlt_le_weak z1 z2); auto with real. + unfold Rle; intros z1 z2 [H| H]. + apply (Z.lt_le_incl z1 z2); auto with real. apply lt_IZR; trivial. rewrite (eq_IZR z1 z2); auto with zarith real. Qed. @@ -1855,20 +1855,20 @@ Qed. (**********) Lemma le_IZR_R1 : forall n:Z, IZR n <= 1 -> (n <= 1)%Z. Proof. - pattern 1 at 1 in |- *; replace 1 with (IZR 1); intros; auto. + pattern 1 at 1; replace 1 with (IZR 1); intros; auto. apply le_IZR; trivial. Qed. (**********) Lemma IZR_ge : forall n m:Z, (n >= m)%Z -> IZR n >= IZR m. Proof. - intros m n H; apply Rnot_lt_ge; red in |- *; intro. + intros m n H; apply Rnot_lt_ge; red; intro. generalize (lt_IZR m n H0); intro; omega. Qed. Lemma IZR_le : forall n m:Z, (n <= m)%Z -> IZR n <= IZR m. Proof. - intros m n H; apply Rnot_gt_le; red in |- *; intro. + intros m n H; apply Rnot_gt_le; red; intro. unfold Rgt in H0; generalize (lt_IZR n m H0); intro; omega. Qed. @@ -1883,10 +1883,10 @@ Qed. Lemma one_IZR_lt1 : forall n:Z, -1 < IZR n < 1 -> n = 0%Z. Proof. intros z [H1 H2]. - apply Zle_antisym. - apply Zlt_succ_le; apply lt_IZR; trivial. - replace 0%Z with (Zsucc (-1)); trivial. - apply Zlt_le_succ; apply lt_IZR; trivial. + apply Z.le_antisymm. + apply Z.lt_succ_r; apply lt_IZR; trivial. + replace 0%Z with (Z.succ (-1)); trivial. + apply Z.le_succ_l; apply lt_IZR; trivial. Qed. Lemma one_IZR_r_R1 : @@ -1897,10 +1897,10 @@ Proof. apply one_IZR_lt1. rewrite <- Z_R_minus; split. replace (-1) with (r - (r + 1)). - unfold Rminus in |- *; apply Rplus_lt_le_compat; auto with real. + unfold Rminus; apply Rplus_lt_le_compat; auto with real. ring. replace 1 with (r + 1 - r). - unfold Rminus in |- *; apply Rplus_le_lt_compat; auto with real. + unfold Rminus; apply Rplus_le_lt_compat; auto with real. ring. Qed. @@ -1931,6 +1931,20 @@ Proof. apply (Rmult_le_compat_l x 0 y H H0). Qed. +Lemma Rle_Rinv : forall x y:R, 0 < x -> 0 < y -> x <= y -> / y <= / x. +Proof. + intros; apply Rmult_le_reg_l with x. + apply H. + rewrite <- Rinv_r_sym. + apply Rmult_le_reg_l with y. + apply H0. + rewrite Rmult_1_r; rewrite Rmult_comm; rewrite Rmult_assoc; + rewrite <- Rinv_l_sym. + rewrite Rmult_1_r; apply H1. + red; intro; rewrite H2 in H0; elim (Rlt_irrefl _ H0). + red; intro; rewrite H2 in H; elim (Rlt_irrefl _ H). +Qed. + Lemma double : forall r1, 2 * r1 = r1 + r1. Proof. intro; ring. @@ -1938,10 +1952,10 @@ Qed. Lemma double_var : forall r1, r1 = r1 / 2 + r1 / 2. Proof. - intro; rewrite <- double; unfold Rdiv in |- *; rewrite <- Rmult_assoc; - symmetry in |- *; apply Rinv_r_simpl_m. + intro; rewrite <- double; unfold Rdiv; rewrite <- Rmult_assoc; + symmetry ; apply Rinv_r_simpl_m. replace 2 with (INR 2); - [ apply not_0_INR; discriminate | unfold INR in |- *; ring ]. + [ apply not_0_INR; discriminate | unfold INR; ring ]. Qed. (*********************************************************) @@ -1976,22 +1990,22 @@ Proof. rewrite (Rplus_comm y); intro H5; apply Rplus_le_reg_l with x; assumption. ring. replace 2 with (INR 2); [ apply not_0_INR; discriminate | reflexivity ]. - pattern y at 2 in |- *; replace y with (y / 2 + y / 2). - unfold Rminus, Rdiv in |- *. + pattern y at 2; replace y with (y / 2 + y / 2). + unfold Rminus, Rdiv. repeat rewrite Rmult_plus_distr_r. ring. cut (forall z:R, 2 * z = z + z). intro. rewrite <- (H4 (y / 2)). - unfold Rdiv in |- *. + unfold Rdiv. rewrite <- Rmult_assoc; apply Rinv_r_simpl_m. replace 2 with (INR 2). apply not_0_INR. discriminate. - unfold INR in |- *; reflexivity. + unfold INR; reflexivity. intro; ring. cut (0%nat <> 2%nat); - [ intro H0; generalize (lt_0_INR 2 (neq_O_lt 2 H0)); unfold INR in |- *; + [ intro H0; generalize (lt_0_INR 2 (neq_O_lt 2 H0)); unfold INR; intro; assumption | discriminate ]. Qed. diff --git a/theories/Reals/RList.v b/theories/Reals/RList.v index dbd2e52f..6d42434a 100644 --- a/theories/Reals/RList.v +++ b/theories/Reals/RList.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -8,7 +8,7 @@ Require Import Rbase. Require Import Rfunctions. -Open Local Scope R_scope. +Local Open Scope R_scope. Inductive Rlist : Type := | nil : Rlist @@ -52,19 +52,19 @@ Proof. simpl in H; elim H. induction l as [| r0 l Hrecl0]. simpl in H; elim H; intro. - simpl in |- *; right; assumption. + simpl; right; assumption. elim H0. replace (MaxRlist (cons r (cons r0 l))) with (Rmax r (MaxRlist (cons r0 l))). simpl in H; decompose [or] H. rewrite H0; apply RmaxLess1. - unfold Rmax in |- *; case (Rle_dec r (MaxRlist (cons r0 l))); intro. - apply Hrecl; simpl in |- *; tauto. + unfold Rmax; case (Rle_dec r (MaxRlist (cons r0 l))); intro. + apply Hrecl; simpl; tauto. apply Rle_trans with (MaxRlist (cons r0 l)); - [ apply Hrecl; simpl in |- *; tauto | left; auto with real ]. - unfold Rmax in |- *; case (Rle_dec r (MaxRlist (cons r0 l))); intro. - apply Hrecl; simpl in |- *; tauto. + [ apply Hrecl; simpl; tauto | left; auto with real ]. + unfold Rmax; case (Rle_dec r (MaxRlist (cons r0 l))); intro. + apply Hrecl; simpl; tauto. apply Rle_trans with (MaxRlist (cons r0 l)); - [ apply Hrecl; simpl in |- *; tauto | left; auto with real ]. + [ apply Hrecl; simpl; tauto | left; auto with real ]. reflexivity. Qed. @@ -80,19 +80,19 @@ Proof. simpl in H; elim H. induction l as [| r0 l Hrecl0]. simpl in H; elim H; intro. - simpl in |- *; right; symmetry in |- *; assumption. + simpl; right; symmetry ; assumption. elim H0. replace (MinRlist (cons r (cons r0 l))) with (Rmin r (MinRlist (cons r0 l))). simpl in H; decompose [or] H. rewrite H0; apply Rmin_l. - unfold Rmin in |- *; case (Rle_dec r (MinRlist (cons r0 l))); intro. + unfold Rmin; case (Rle_dec r (MinRlist (cons r0 l))); intro. apply Rle_trans with (MinRlist (cons r0 l)). assumption. - apply Hrecl; simpl in |- *; tauto. - apply Hrecl; simpl in |- *; tauto. + apply Hrecl; simpl; tauto. + apply Hrecl; simpl; tauto. apply Rle_trans with (MinRlist (cons r0 l)). apply Rmin_r. - apply Hrecl; simpl in |- *; tauto. + apply Hrecl; simpl; tauto. reflexivity. Qed. @@ -101,7 +101,7 @@ Lemma AbsList_P1 : Proof. intros; induction l as [| r l Hrecl]. elim H. - simpl in |- *; simpl in H; elim H; intro. + simpl; simpl in H; elim H; intro. left; rewrite H0; reflexivity. right; apply Hrecl; assumption. Qed. @@ -112,11 +112,11 @@ Proof. intros; induction l as [| r l Hrecl]. apply Rlt_0_1. induction l as [| r0 l Hrecl0]. - simpl in |- *; apply H; simpl in |- *; tauto. + simpl; apply H; simpl; tauto. replace (MinRlist (cons r (cons r0 l))) with (Rmin r (MinRlist (cons r0 l))). - unfold Rmin in |- *; case (Rle_dec r (MinRlist (cons r0 l))); intro. - apply H; simpl in |- *; tauto. - apply Hrecl; intros; apply H; simpl in |- *; simpl in H0; tauto. + unfold Rmin; case (Rle_dec r (MinRlist (cons r0 l))); intro. + apply H; simpl; tauto. + apply Hrecl; intros; apply H; simpl; simpl in H0; tauto. reflexivity. Qed. @@ -128,10 +128,10 @@ Proof. elim H. elim H; intro. exists r; split. - simpl in |- *; tauto. + simpl; tauto. assumption. assert (H1 := Hrecl H0); elim H1; intros; elim H2; clear H2; intros; - exists x0; simpl in |- *; simpl in H2; tauto. + exists x0; simpl; simpl in H2; tauto. Qed. Lemma MaxRlist_P2 : @@ -140,9 +140,9 @@ Proof. intros; induction l as [| r l Hrecl]. simpl in H; elim H; trivial. induction l as [| r0 l Hrecl0]. - simpl in |- *; left; reflexivity. - change (In (Rmax r (MaxRlist (cons r0 l))) (cons r (cons r0 l))) in |- *; - unfold Rmax in |- *; case (Rle_dec r (MaxRlist (cons r0 l))); + simpl; left; reflexivity. + change (In (Rmax r (MaxRlist (cons r0 l))) (cons r (cons r0 l))); + unfold Rmax; case (Rle_dec r (MaxRlist (cons r0 l))); intro. right; apply Hrecl; exists r0; left; reflexivity. left; reflexivity. @@ -164,7 +164,7 @@ Lemma pos_Rl_P1 : Proof. intros; induction l as [| r l Hrecl]; [ elim (lt_n_O _ H) - | simpl in |- *; case (Rlength l); [ reflexivity | intro; reflexivity ] ]. + | simpl; case (Rlength l); [ reflexivity | intro; reflexivity ] ]. Qed. Lemma pos_Rl_P2 : @@ -177,14 +177,14 @@ Proof. split; intro. elim H; intro. exists 0%nat; split; - [ simpl in |- *; apply lt_O_Sn | simpl in |- *; apply H0 ]. + [ simpl; apply lt_O_Sn | simpl; apply H0 ]. elim Hrecl; intros; assert (H3 := H1 H0); elim H3; intros; elim H4; intros; exists (S x0); split; - [ simpl in |- *; apply lt_n_S; assumption | simpl in |- *; assumption ]. + [ simpl; apply lt_n_S; assumption | simpl; assumption ]. elim H; intros; elim H0; intros; elim (zerop x0); intro. rewrite a in H2; simpl in H2; left; assumption. right; elim Hrecl; intros; apply H4; assert (H5 : S (pred x0) = x0). - symmetry in |- *; apply S_pred with 0%nat; assumption. + symmetry ; apply S_pred with 0%nat; assumption. exists (pred x0); split; [ simpl in H1; apply lt_S_n; rewrite H5; assumption | rewrite <- H5 in H2; simpl in H2; assumption ]. @@ -201,18 +201,18 @@ Proof. exists nil; intros; split; [ reflexivity | intros; simpl in H0; elim (lt_n_O _ H0) ]. assert (H0 : In r (cons r l)). - simpl in |- *; left; reflexivity. + simpl; left; reflexivity. assert (H1 := H _ H0); assert (H2 : forall x:R, In x l -> exists y : R, P x y). - intros; apply H; simpl in |- *; right; assumption. + intros; apply H; simpl; right; assumption. assert (H3 := Hrecl H2); elim H1; intros; elim H3; intros; exists (cons x x0); intros; elim H5; clear H5; intros; split. - simpl in |- *; rewrite H5; reflexivity. + simpl; rewrite H5; reflexivity. intros; elim (zerop i); intro. - rewrite a; simpl in |- *; assumption. + rewrite a; simpl; assumption. assert (H8 : i = S (pred i)). apply S_pred with 0%nat; assumption. - rewrite H8; simpl in |- *; apply H6; simpl in H7; apply lt_S_n; rewrite <- H8; + rewrite H8; simpl; apply H6; simpl in H7; apply lt_S_n; rewrite <- H8; assumption. Qed. @@ -271,7 +271,7 @@ Lemma RList_P0 : Proof. intros; induction l as [| r l Hrecl]; [ left; reflexivity - | simpl in |- *; case (Rle_dec r a); intro; + | simpl; case (Rle_dec r a); intro; [ right; reflexivity | left; reflexivity ] ]. Qed. @@ -279,41 +279,41 @@ Lemma RList_P1 : forall (l:Rlist) (a:R), ordered_Rlist l -> ordered_Rlist (insert l a). Proof. intros; induction l as [| r l Hrecl]. - simpl in |- *; unfold ordered_Rlist in |- *; intros; simpl in H0; + simpl; unfold ordered_Rlist; intros; simpl in H0; elim (lt_n_O _ H0). - simpl in |- *; case (Rle_dec r a); intro. + simpl; case (Rle_dec r a); intro. assert (H1 : ordered_Rlist l). - unfold ordered_Rlist in |- *; unfold ordered_Rlist in H; intros; + unfold ordered_Rlist; unfold ordered_Rlist in H; intros; assert (H1 : (S i < pred (Rlength (cons r l)))%nat); - [ simpl in |- *; replace (Rlength l) with (S (pred (Rlength l))); + [ simpl; replace (Rlength l) with (S (pred (Rlength l))); [ apply lt_n_S; assumption - | symmetry in |- *; apply S_pred with 0%nat; apply neq_O_lt; red in |- *; + | symmetry ; apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H1 in H0; simpl in H0; elim (lt_n_O _ H0) ] | apply (H _ H1) ]. - assert (H2 := Hrecl H1); unfold ordered_Rlist in |- *; intros; + assert (H2 := Hrecl H1); unfold ordered_Rlist; intros; induction i as [| i Hreci]. - simpl in |- *; assert (H3 := RList_P0 l a); elim H3; intro. + simpl; assert (H3 := RList_P0 l a); elim H3; intro. rewrite H4; assumption. induction l as [| r1 l Hrecl0]; - [ simpl in |- *; assumption - | rewrite H4; apply (H 0%nat); simpl in |- *; apply lt_O_Sn ]. - simpl in |- *; apply H2; simpl in H0; apply lt_S_n; + [ simpl; assumption + | rewrite H4; apply (H 0%nat); simpl; apply lt_O_Sn ]. + simpl; apply H2; simpl in H0; apply lt_S_n; replace (S (pred (Rlength (insert l a)))) with (Rlength (insert l a)); [ assumption - | apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro; + | apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H3 in H0; elim (lt_n_O _ H0) ]. - unfold ordered_Rlist in |- *; intros; induction i as [| i Hreci]; - [ simpl in |- *; auto with real - | change (pos_Rl (cons r l) i <= pos_Rl (cons r l) (S i)) in |- *; apply H; - simpl in H0; simpl in |- *; apply (lt_S_n _ _ H0) ]. + unfold ordered_Rlist; intros; induction i as [| i Hreci]; + [ simpl; auto with real + | change (pos_Rl (cons r l) i <= pos_Rl (cons r l) (S i)); apply H; + simpl in H0; simpl; apply (lt_S_n _ _ H0) ]. Qed. Lemma RList_P2 : forall l1 l2:Rlist, ordered_Rlist l2 -> ordered_Rlist (cons_ORlist l1 l2). Proof. simple induction l1; - [ intros; simpl in |- *; apply H - | intros; simpl in |- *; apply H; apply RList_P1; assumption ]. + [ intros; simpl; apply H + | intros; simpl; apply H; apply RList_P1; assumption ]. Qed. Lemma RList_P3 : @@ -324,11 +324,11 @@ Proof. [ induction l as [| r l Hrecl] | induction l as [| r l Hrecl] ]. elim H. elim H; intro; - [ exists 0%nat; split; [ apply H0 | simpl in |- *; apply lt_O_Sn ] + [ exists 0%nat; split; [ apply H0 | simpl; apply lt_O_Sn ] | elim (Hrecl H0); intros; elim H1; clear H1; intros; exists (S x0); split; - [ apply H1 | simpl in |- *; apply lt_n_S; assumption ] ]. + [ apply H1 | simpl; apply lt_n_S; assumption ] ]. elim H; intros; elim H0; intros; elim (lt_n_O _ H2). - simpl in |- *; elim H; intros; elim H0; clear H0; intros; + simpl; elim H; intros; elim H0; clear H0; intros; induction x0 as [| x0 Hrecx0]; [ left; apply H0 | right; apply Hrecl; exists x0; split; @@ -338,10 +338,10 @@ Qed. Lemma RList_P4 : forall (l1:Rlist) (a:R), ordered_Rlist (cons a l1) -> ordered_Rlist l1. Proof. - intros; unfold ordered_Rlist in |- *; intros; apply (H (S i)); simpl in |- *; + intros; unfold ordered_Rlist; intros; apply (H (S i)); simpl; replace (Rlength l1) with (S (pred (Rlength l1))); [ apply lt_n_S; assumption - | symmetry in |- *; apply S_pred with 0%nat; apply neq_O_lt; red in |- *; + | symmetry ; apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H1 in H0; elim (lt_n_O _ H0) ]. Qed. @@ -350,11 +350,11 @@ Lemma RList_P5 : Proof. intros; induction l as [| r l Hrecl]; [ elim H0 - | simpl in |- *; elim H0; intro; + | simpl; elim H0; intro; [ rewrite H1; right; reflexivity | apply Rle_trans with (pos_Rl l 0); - [ apply (H 0%nat); simpl in |- *; induction l as [| r0 l Hrecl0]; - [ elim H1 | simpl in |- *; apply lt_O_Sn ] + [ apply (H 0%nat); simpl; induction l as [| r0 l Hrecl0]; + [ elim H1 | simpl; apply lt_O_Sn ] | apply Hrecl; [ eapply RList_P4; apply H | assumption ] ] ] ]. Qed. @@ -366,13 +366,13 @@ Lemma RList_P6 : Proof. simple induction l; split; intro. intros; right; reflexivity. - unfold ordered_Rlist in |- *; intros; simpl in H0; elim (lt_n_O _ H0). + unfold ordered_Rlist; intros; simpl in H0; elim (lt_n_O _ H0). intros; induction i as [| i Hreci]; [ induction j as [| j Hrecj]; [ right; reflexivity - | simpl in |- *; apply Rle_trans with (pos_Rl r0 0); - [ apply (H0 0%nat); simpl in |- *; simpl in H2; apply neq_O_lt; - red in |- *; intro; rewrite <- H3 in H2; + | simpl; apply Rle_trans with (pos_Rl r0 0); + [ apply (H0 0%nat); simpl; simpl in H2; apply neq_O_lt; + red; intro; rewrite <- H3 in H2; assert (H4 := lt_S_n _ _ H2); elim (lt_n_O _ H4) | elim H; intros; apply H3; [ apply RList_P4 with r; assumption @@ -380,12 +380,12 @@ Proof. | simpl in H2; apply lt_S_n; assumption ] ] ] | induction j as [| j Hrecj]; [ elim (le_Sn_O _ H1) - | simpl in |- *; elim H; intros; apply H3; + | simpl; elim H; intros; apply H3; [ apply RList_P4 with r; assumption | apply le_S_n; assumption | simpl in H2; apply lt_S_n; assumption ] ] ]. - unfold ordered_Rlist in |- *; intros; apply H0; - [ apply le_n_Sn | simpl in |- *; simpl in H1; apply lt_n_S; assumption ]. + unfold ordered_Rlist; intros; apply H0; + [ apply le_n_Sn | simpl; simpl in H1; apply lt_n_S; assumption ]. Qed. Lemma RList_P7 : @@ -397,11 +397,11 @@ Proof. clear H1; intros; assert (H4 := H1 H0); elim H4; clear H4; intros; elim H4; clear H4; intros; rewrite H4; assert (H6 : Rlength l = S (pred (Rlength l))). - apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro; + apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H6 in H5; elim (lt_n_O _ H5). apply H3; [ rewrite H6 in H5; apply lt_n_Sm_le; assumption - | apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H7 in H5; + | apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H7 in H5; elim (lt_n_O _ H5) ]. Qed. @@ -420,7 +420,7 @@ Proof. [ left; assumption | right; left; assumption | right; right; assumption ] ] - | simpl in |- *; case (Rle_dec r a); intro; + | simpl; case (Rle_dec r a); intro; [ simpl in H0; decompose [or] H0; [ right; elim (H a x); intros; apply H3; left | left @@ -435,14 +435,14 @@ Proof. simple induction l1. intros; split; intro; [ simpl in H; right; assumption - | simpl in |- *; elim H; intro; [ elim H0 | assumption ] ]. + | simpl; elim H; intro; [ elim H0 | assumption ] ]. intros; split. - simpl in |- *; intros; elim (H (insert l2 r) x); intros; assert (H3 := H1 H0); + simpl; intros; elim (H (insert l2 r) x); intros; assert (H3 := H1 H0); elim H3; intro; [ left; right; assumption | elim (RList_P8 l2 r x); intros H5 _; assert (H6 := H5 H4); elim H6; intro; [ left; left; assumption | right; assumption ] ]. - intro; simpl in |- *; elim (H (insert l2 r) x); intros _ H1; apply H1; + intro; simpl; elim (H (insert l2 r) x); intros _ H1; apply H1; elim H0; intro; [ elim H2; intro; [ right; elim (RList_P8 l2 r x); intros _ H4; apply H4; left; assumption @@ -455,8 +455,8 @@ Lemma RList_P10 : Proof. intros; induction l as [| r l Hrecl]; [ reflexivity - | simpl in |- *; case (Rle_dec r a); intro; - [ simpl in |- *; rewrite Hrecl; reflexivity | reflexivity ] ]. + | simpl; case (Rle_dec r a); intro; + [ simpl; rewrite Hrecl; reflexivity | reflexivity ] ]. Qed. Lemma RList_P11 : @@ -465,7 +465,7 @@ Lemma RList_P11 : Proof. simple induction l1; [ intro; reflexivity - | intros; simpl in |- *; rewrite (H (insert l2 r)); rewrite RList_P10; + | intros; simpl; rewrite (H (insert l2 r)); rewrite RList_P10; apply INR_eq; rewrite S_INR; do 2 rewrite plus_INR; rewrite S_INR; ring ]. Qed. @@ -477,7 +477,7 @@ Proof. simple induction l; [ intros; elim (lt_n_O _ H) | intros; induction i as [| i Hreci]; - [ reflexivity | simpl in |- *; apply H; apply lt_S_n; apply H0 ] ]. + [ reflexivity | simpl; apply H; apply lt_S_n; apply H0 ] ]. Qed. Lemma RList_P13 : @@ -494,13 +494,13 @@ Proof. change (pos_Rl (mid_Rlist (cons r1 r2) r) (S i) = (pos_Rl (cons r1 r2) i + pos_Rl (cons r1 r2) (S i)) / 2) - in |- *; apply H0; simpl in |- *; apply lt_S_n; assumption. + ; apply H0; simpl; apply lt_S_n; assumption. Qed. Lemma RList_P14 : forall (l:Rlist) (a:R), Rlength (mid_Rlist l a) = Rlength l. Proof. simple induction l; intros; - [ reflexivity | simpl in |- *; rewrite (H r); reflexivity ]. + [ reflexivity | simpl; rewrite (H r); reflexivity ]. Qed. Lemma RList_P15 : @@ -511,7 +511,7 @@ Lemma RList_P15 : Proof. intros; apply Rle_antisym. induction l1 as [| r l1 Hrecl1]; - [ simpl in |- *; simpl in H1; right; symmetry in |- *; assumption + [ simpl; simpl in H1; right; symmetry ; assumption | elim (RList_P9 (cons r l1) l2 (pos_Rl (cons r l1) 0)); intros; assert (H4 : @@ -520,7 +520,7 @@ Proof. | assert (H5 := H3 H4); apply RList_P5; [ apply RList_P2; assumption | assumption ] ] ]. induction l1 as [| r l1 Hrecl1]; - [ simpl in |- *; simpl in H1; right; assumption + [ simpl; simpl in H1; right; assumption | assert (H2 : In (pos_Rl (cons_ORlist (cons r l1) l2) 0) (cons_ORlist (cons r l1) l2)); @@ -528,7 +528,7 @@ Proof. (RList_P3 (cons_ORlist (cons r l1) l2) (pos_Rl (cons_ORlist (cons r l1) l2) 0)); intros; apply H3; exists 0%nat; split; - [ reflexivity | rewrite RList_P11; simpl in |- *; apply lt_O_Sn ] + [ reflexivity | rewrite RList_P11; simpl; apply lt_O_Sn ] | elim (RList_P9 (cons r l1) l2 (pos_Rl (cons_ORlist (cons r l1) l2) 0)); intros; assert (H5 := H3 H2); elim H5; intro; [ apply RList_P5; assumption @@ -545,7 +545,7 @@ Lemma RList_P16 : Proof. intros; apply Rle_antisym. induction l1 as [| r l1 Hrecl1]. - simpl in |- *; simpl in H1; right; symmetry in |- *; assumption. + simpl; simpl in H1; right; symmetry ; assumption. assert (H2 : In @@ -557,7 +557,7 @@ Proof. (pos_Rl (cons_ORlist (cons r l1) l2) (pred (Rlength (cons_ORlist (cons r l1) l2))))); intros; apply H3; exists (pred (Rlength (cons_ORlist (cons r l1) l2))); - split; [ reflexivity | rewrite RList_P11; simpl in |- *; apply lt_n_Sn ] + split; [ reflexivity | rewrite RList_P11; simpl; apply lt_n_Sn ] | elim (RList_P9 (cons r l1) l2 (pos_Rl (cons_ORlist (cons r l1) l2) @@ -565,7 +565,7 @@ Proof. intros; assert (H5 := H3 H2); elim H5; intro; [ apply RList_P7; assumption | rewrite H1; apply RList_P7; assumption ] ]. induction l1 as [| r l1 Hrecl1]. - simpl in |- *; simpl in H1; right; assumption. + simpl; simpl in H1; right; assumption. elim (RList_P9 (cons r l1) l2 (pos_Rl (cons r l1) (pred (Rlength (cons r l1))))); intros; @@ -573,10 +573,10 @@ Proof. (H4 : In (pos_Rl (cons r l1) (pred (Rlength (cons r l1)))) (cons r l1) \/ In (pos_Rl (cons r l1) (pred (Rlength (cons r l1)))) l2); - [ left; change (In (pos_Rl (cons r l1) (Rlength l1)) (cons r l1)) in |- *; + [ left; change (In (pos_Rl (cons r l1) (Rlength l1)) (cons r l1)); elim (RList_P3 (cons r l1) (pos_Rl (cons r l1) (Rlength l1))); intros; apply H5; exists (Rlength l1); split; - [ reflexivity | simpl in |- *; apply lt_n_Sn ] + [ reflexivity | simpl; apply lt_n_Sn ] | assert (H5 := H3 H4); apply RList_P7; [ apply RList_P2; assumption | elim @@ -587,7 +587,7 @@ Proof. (RList_P3 (cons r l1) (pos_Rl (cons r l1) (pred (Rlength (cons r l1))))); intros; apply H9; exists (pred (Rlength (cons r l1))); - split; [ reflexivity | simpl in |- *; apply lt_n_Sn ] ] ]. + split; [ reflexivity | simpl; apply lt_n_Sn ] ] ]. Qed. Lemma RList_P17 : @@ -599,14 +599,14 @@ Proof. simple induction l1. intros; elim H0. intros; induction i as [| i Hreci]. - simpl in |- *; elim H1; intro; + simpl; elim H1; intro; [ simpl in H2; rewrite H4 in H2; elim (Rlt_irrefl _ H2) | apply RList_P5; [ apply RList_P4 with r; assumption | assumption ] ]. - simpl in |- *; simpl in H2; elim H1; intro. + simpl; simpl in H2; elim H1; intro. rewrite H4 in H2; assert (H5 : r <= pos_Rl r0 i); [ apply Rle_trans with (pos_Rl r0 0); - [ apply (H0 0%nat); simpl in |- *; simpl in H3; apply neq_O_lt; - red in |- *; intro; rewrite <- H5 in H3; elim (lt_n_O _ H3) + [ apply (H0 0%nat); simpl; simpl in H3; apply neq_O_lt; + red; intro; rewrite <- H5 in H3; elim (lt_n_O _ H3) | elim (RList_P6 r0); intros; apply H5; [ apply RList_P4 with r; assumption | apply le_O_n @@ -618,7 +618,7 @@ Proof. | simpl in H3; apply lt_S_n; replace (S (pred (Rlength r0))) with (Rlength r0); [ apply H3 - | apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro; + | apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H5 in H3; elim (lt_n_O _ H3) ] ]. Qed. @@ -626,7 +626,7 @@ Lemma RList_P18 : forall (l:Rlist) (f:R -> R), Rlength (app_Rlist l f) = Rlength l. Proof. simple induction l; intros; - [ reflexivity | simpl in |- *; rewrite H; reflexivity ]. + [ reflexivity | simpl; rewrite H; reflexivity ]. Qed. Lemma RList_P19 : @@ -666,7 +666,7 @@ Lemma RList_P23 : Rlength (cons_Rlist l1 l2) = (Rlength l1 + Rlength l2)%nat. Proof. simple induction l1; - [ intro; reflexivity | intros; simpl in |- *; rewrite H; reflexivity ]. + [ intro; reflexivity | intros; simpl; rewrite H; reflexivity ]. Qed. Lemma RList_P24 : @@ -685,9 +685,9 @@ Proof. [ replace (Rlength r0 + Rlength (cons r1 l2))%nat with (S (Rlength r0 + Rlength l2)); [ reflexivity - | simpl in |- *; apply INR_eq; rewrite S_INR; do 2 rewrite plus_INR; + | simpl; apply INR_eq; rewrite S_INR; do 2 rewrite plus_INR; rewrite S_INR; ring ] - | simpl in |- *; apply INR_eq; do 3 rewrite S_INR; do 2 rewrite plus_INR; + | simpl; apply INR_eq; do 3 rewrite S_INR; do 2 rewrite plus_INR; rewrite S_INR; ring ]. Qed. @@ -699,27 +699,27 @@ Lemma RList_P25 : ordered_Rlist (cons_Rlist l1 l2). Proof. simple induction l1. - intros; simpl in |- *; assumption. + intros; simpl; assumption. simple induction r0. - intros; simpl in |- *; simpl in H2; unfold ordered_Rlist in |- *; intros; + intros; simpl; simpl in H2; unfold ordered_Rlist; intros; simpl in H3. induction i as [| i Hreci]. - simpl in |- *; assumption. - change (pos_Rl l2 i <= pos_Rl l2 (S i)) in |- *; apply (H1 i); apply lt_S_n; + simpl; assumption. + change (pos_Rl l2 i <= pos_Rl l2 (S i)); apply (H1 i); apply lt_S_n; replace (S (pred (Rlength l2))) with (Rlength l2); [ assumption - | apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro; + | apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H4 in H3; elim (lt_n_O _ H3) ]. intros; clear H; assert (H : ordered_Rlist (cons_Rlist (cons r1 r2) l2)). apply H0; try assumption. apply RList_P4 with r; assumption. - unfold ordered_Rlist in |- *; intros; simpl in H4; + unfold ordered_Rlist; intros; simpl in H4; induction i as [| i Hreci]. - simpl in |- *; apply (H1 0%nat); simpl in |- *; apply lt_O_Sn. + simpl; apply (H1 0%nat); simpl; apply lt_O_Sn. change (pos_Rl (cons_Rlist (cons r1 r2) l2) i <= - pos_Rl (cons_Rlist (cons r1 r2) l2) (S i)) in |- *; - apply (H i); simpl in |- *; apply lt_S_n; assumption. + pos_Rl (cons_Rlist (cons r1 r2) l2) (S i)); + apply (H i); simpl; apply lt_S_n; assumption. Qed. Lemma RList_P26 : @@ -738,13 +738,13 @@ Lemma RList_P27 : cons_Rlist l1 (cons_Rlist l2 l3) = cons_Rlist (cons_Rlist l1 l2) l3. Proof. simple induction l1; intros; - [ reflexivity | simpl in |- *; rewrite (H l2 l3); reflexivity ]. + [ reflexivity | simpl; rewrite (H l2 l3); reflexivity ]. Qed. Lemma RList_P28 : forall l:Rlist, cons_Rlist l nil = l. Proof. simple induction l; - [ reflexivity | intros; simpl in |- *; rewrite H; reflexivity ]. + [ reflexivity | intros; simpl; rewrite H; reflexivity ]. Qed. Lemma RList_P29 : @@ -759,23 +759,23 @@ Proof. replace (cons_Rlist l1 (cons r r0)) with (cons_Rlist (cons_Rlist l1 (cons r nil)) r0). inversion H0. - rewrite <- minus_n_n; simpl in |- *; rewrite RList_P26. + rewrite <- minus_n_n; simpl; rewrite RList_P26. clear l2 r0 H i H0 H1 H2; induction l1 as [| r0 l1 Hrecl1]. reflexivity. - simpl in |- *; assumption. - rewrite RList_P23; rewrite plus_comm; simpl in |- *; apply lt_n_Sn. + simpl; assumption. + rewrite RList_P23; rewrite plus_comm; simpl; apply lt_n_Sn. replace (S m - Rlength l1)%nat with (S (S m - S (Rlength l1))). - rewrite H3; simpl in |- *; + rewrite H3; simpl; replace (S (Rlength l1)) with (Rlength (cons_Rlist l1 (cons r nil))). apply (H (cons_Rlist l1 (cons r nil)) i). - rewrite RList_P23; rewrite plus_comm; simpl in |- *; rewrite <- H3; + rewrite RList_P23; rewrite plus_comm; simpl; rewrite <- H3; apply le_n_S; assumption. - repeat rewrite RList_P23; simpl in |- *; rewrite RList_P23 in H1; + repeat rewrite RList_P23; simpl; rewrite RList_P23 in H1; rewrite plus_comm in H1; simpl in H1; rewrite (plus_comm (Rlength l1)); - simpl in |- *; rewrite plus_comm; apply H1. + simpl; rewrite plus_comm; apply H1. rewrite RList_P23; rewrite plus_comm; reflexivity. - change (S (m - Rlength l1) = (S m - Rlength l1)%nat) in |- *; + change (S (m - Rlength l1) = (S m - Rlength l1)%nat); apply minus_Sn_m; assumption. replace (cons r r0) with (cons_Rlist (cons r nil) r0); - [ symmetry in |- *; apply RList_P27 | reflexivity ]. + [ symmetry ; apply RList_P27 | reflexivity ]. Qed. diff --git a/theories/Reals/ROrderedType.v b/theories/Reals/ROrderedType.v index 0a8d89c7..726f1204 100644 --- a/theories/Reals/ROrderedType.v +++ b/theories/Reals/ROrderedType.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) diff --git a/theories/Reals/R_Ifp.v b/theories/Reals/R_Ifp.v index 9e04a7da..8364e986 100644 --- a/theories/Reals/R_Ifp.v +++ b/theories/Reals/R_Ifp.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -13,7 +13,7 @@ Require Import Rbase. Require Import Omega. -Open Local Scope R_scope. +Local Open Scope R_scope. (*********************************************************) (** * Fractional part *) @@ -45,7 +45,7 @@ Proof. intros; generalize (Rplus_le_compat_l 1 (IZR z) r H); intro; clear H; rewrite (Rplus_comm 1 (IZR z)) in H1; rewrite (Rplus_comm 1 r) in H1; cut (1 = IZR 1); auto with zarith real. - intro; generalize H1; pattern 1 at 1 in |- *; rewrite H; intro; clear H H1; + intro; generalize H1; pattern 1 at 1; rewrite H; intro; clear H H1; rewrite <- (plus_IZR z 1) in H2; apply (tech_up r (z + 1)); auto with zarith real. Qed. @@ -53,12 +53,12 @@ Qed. (**********) Lemma fp_R0 : frac_part 0 = 0. Proof. - unfold frac_part in |- *; unfold Int_part in |- *; elim (archimed 0); intros; - unfold Rminus in |- *; elim (Rplus_ne (- IZR (up 0 - 1))); + unfold frac_part; unfold Int_part; elim (archimed 0); intros; + unfold Rminus; elim (Rplus_ne (- IZR (up 0 - 1))); intros a b; rewrite b; clear a b; rewrite <- Z_R_minus; cut (up 0 = 1%Z). intro; rewrite H1; - rewrite (Rminus_diag_eq (IZR 1) (IZR 1) (refl_equal (IZR 1))); + rewrite (Rminus_diag_eq (IZR 1) (IZR 1) (eq_refl (IZR 1))); apply Ropp_0. elim (archimed 0); intros; clear H2; unfold Rgt in H1; rewrite (Rminus_0_r (IZR (up 0))) in H0; generalize (lt_O_IZR (up 0) H1); @@ -81,21 +81,21 @@ Qed. (**********) Lemma base_fp : forall r:R, frac_part r >= 0 /\ frac_part r < 1. Proof. - intro; unfold frac_part in |- *; unfold Int_part in |- *; split. + intro; unfold frac_part; unfold Int_part; split. (*sup a O*) cut (r - IZR (up r) >= -1). - rewrite <- Z_R_minus; simpl in |- *; intro; unfold Rminus in |- *; + rewrite <- Z_R_minus; simpl; intro; unfold Rminus; rewrite Ropp_plus_distr; rewrite <- Rplus_assoc; - fold (r - IZR (up r)) in |- *; fold (r - IZR (up r) - -1) in |- *; + fold (r - IZR (up r)); fold (r - IZR (up r) - -1); apply Rge_minus; auto with zarith real. rewrite <- Ropp_minus_distr; apply Ropp_le_ge_contravar; elim (for_base_fp r); auto with zarith real. (*inf a 1*) cut (r - IZR (up r) < 0). - rewrite <- Z_R_minus; simpl in |- *; intro; unfold Rminus in |- *; + rewrite <- Z_R_minus; simpl; intro; unfold Rminus; rewrite Ropp_plus_distr; rewrite <- Rplus_assoc; - fold (r - IZR (up r)) in |- *; rewrite Ropp_involutive; - elim (Rplus_ne 1); intros a b; pattern 1 at 2 in |- *; + fold (r - IZR (up r)); rewrite Ropp_involutive; + elim (Rplus_ne 1); intros a b; pattern 1 at 2; rewrite <- a; clear a b; rewrite (Rplus_comm (r - IZR (up r)) 1); apply Rplus_lt_compat_l; auto with zarith real. elim (for_base_fp r); intros; rewrite <- Ropp_0; rewrite <- Ropp_minus_distr; @@ -110,8 +110,8 @@ Qed. Lemma base_Int_part : forall r:R, IZR (Int_part r) <= r /\ IZR (Int_part r) - r > -1. Proof. - intro; unfold Int_part in |- *; elim (archimed r); intros. - split; rewrite <- (Z_R_minus (up r) 1); simpl in |- *. + intro; unfold Int_part; elim (archimed r); intros. + split; rewrite <- (Z_R_minus (up r) 1); simpl. generalize (Rle_minus (IZR (up r) - r) 1 H0); intro; unfold Rminus in H1; rewrite (Rplus_assoc (IZR (up r)) (- r) (-1)) in H1; rewrite (Rplus_comm (- r) (-1)) in H1; @@ -130,31 +130,31 @@ Proof. Qed. (**********) -Lemma Int_part_INR : forall n:nat, Int_part (INR n) = Z_of_nat n. +Lemma Int_part_INR : forall n:nat, Int_part (INR n) = Z.of_nat n. Proof. - intros n; unfold Int_part in |- *. - cut (up (INR n) = (Z_of_nat n + Z_of_nat 1)%Z). - intros H'; rewrite H'; simpl in |- *; ring. - apply sym_equal; apply tech_up; auto. - replace (Z_of_nat n + Z_of_nat 1)%Z with (Z_of_nat (S n)). + intros n; unfold Int_part. + cut (up (INR n) = (Z.of_nat n + Z.of_nat 1)%Z). + intros H'; rewrite H'; simpl; ring. + symmetry; apply tech_up; auto. + replace (Z.of_nat n + Z.of_nat 1)%Z with (Z.of_nat (S n)). repeat rewrite <- INR_IZR_INZ. apply lt_INR; auto. - rewrite Zplus_comm; rewrite <- Znat.inj_plus; simpl in |- *; auto. - rewrite plus_IZR; simpl in |- *; auto with real. + rewrite Z.add_comm; rewrite <- Znat.Nat2Z.inj_add; simpl; auto. + rewrite plus_IZR; simpl; auto with real. repeat rewrite <- INR_IZR_INZ; auto with real. Qed. (**********) Lemma fp_nat : forall r:R, frac_part r = 0 -> exists c : Z, r = IZR c. Proof. - unfold frac_part in |- *; intros; split with (Int_part r); + unfold frac_part; intros; split with (Int_part r); apply Rminus_diag_uniq; auto with zarith real. Qed. (**********) Lemma R0_fp_O : forall r:R, 0 <> frac_part r -> 0 <> r. Proof. - red in |- *; intros; rewrite <- H0 in H; generalize fp_R0; intro; + red; intros; rewrite <- H0 in H; generalize fp_R0; intro; auto with zarith real. Qed. @@ -243,7 +243,7 @@ Proof. intro; rewrite H1 in H; clear H1; rewrite <- (plus_IZR (Int_part r1 - Int_part r2) 1) in H; generalize (up_tech (r1 - r2) (Int_part r1 - Int_part r2) H0 H); - intros; clear H H0; unfold Int_part at 1 in |- *; + intros; clear H H0; unfold Int_part at 1; omega. Qed. @@ -336,7 +336,7 @@ Proof. generalize (Rlt_le (IZR (Int_part r1 - Int_part r2 - 1)) (r1 - r2) H); intro; clear H; generalize (up_tech (r1 - r2) (Int_part r1 - Int_part r2 - 1) H1 H0); - intros; clear H0 H1; unfold Int_part at 1 in |- *; + intros; clear H0 H1; unfold Int_part at 1; omega. Qed. @@ -346,9 +346,9 @@ Lemma Rminus_fp1 : frac_part r1 >= frac_part r2 -> frac_part (r1 - r2) = frac_part r1 - frac_part r2. Proof. - intros; unfold frac_part in |- *; generalize (Rminus_Int_part1 r1 r2 H); + intros; unfold frac_part; generalize (Rminus_Int_part1 r1 r2 H); intro; rewrite H0; rewrite <- (Z_R_minus (Int_part r1) (Int_part r2)); - unfold Rminus in |- *; + unfold Rminus; rewrite (Ropp_plus_distr (IZR (Int_part r1)) (- IZR (Int_part r2))); rewrite (Ropp_plus_distr r2 (- IZR (Int_part r2))); rewrite (Ropp_involutive (IZR (Int_part r2))); @@ -366,17 +366,17 @@ Lemma Rminus_fp2 : frac_part r1 < frac_part r2 -> frac_part (r1 - r2) = frac_part r1 - frac_part r2 + 1. Proof. - intros; unfold frac_part in |- *; generalize (Rminus_Int_part2 r1 r2 H); + intros; unfold frac_part; generalize (Rminus_Int_part2 r1 r2 H); intro; rewrite H0; rewrite <- (Z_R_minus (Int_part r1 - Int_part r2) 1); rewrite <- (Z_R_minus (Int_part r1) (Int_part r2)); - unfold Rminus in |- *; + unfold Rminus; rewrite (Ropp_plus_distr (IZR (Int_part r1) + - IZR (Int_part r2)) (- IZR 1)) ; rewrite (Ropp_plus_distr r2 (- IZR (Int_part r2))); rewrite (Ropp_involutive (IZR 1)); rewrite (Ropp_involutive (IZR (Int_part r2))); rewrite (Ropp_plus_distr (IZR (Int_part r1))); - rewrite (Ropp_involutive (IZR (Int_part r2))); simpl in |- *; + rewrite (Ropp_involutive (IZR (Int_part r2))); simpl; rewrite <- (Rplus_assoc (r1 + - r2) (- IZR (Int_part r1) + IZR (Int_part r2)) 1) ; rewrite (Rplus_assoc r1 (- r2) (- IZR (Int_part r1) + IZR (Int_part r2))); @@ -451,7 +451,7 @@ Proof. rewrite <- (plus_IZR (Int_part r1 + Int_part r2) 1) in H0; rewrite <- (plus_IZR (Int_part r1 + Int_part r2 + 1) 1) in H0; generalize (up_tech (r1 + r2) (Int_part r1 + Int_part r2 + 1) H H0); - intro; clear H H0; unfold Int_part at 1 in |- *; omega. + intro; clear H H0; unfold Int_part at 1; omega. Qed. (**********) @@ -514,7 +514,7 @@ Proof. rewrite <- (plus_IZR (Int_part r1) (Int_part r2)) in H1; rewrite <- (plus_IZR (Int_part r1 + Int_part r2) 1) in H1; generalize (up_tech (r1 + r2) (Int_part r1 + Int_part r2) H0 H1); - intro; clear H0 H1; unfold Int_part at 1 in |- *; + intro; clear H0 H1; unfold Int_part at 1; omega. Qed. @@ -524,17 +524,17 @@ Lemma plus_frac_part1 : frac_part r1 + frac_part r2 >= 1 -> frac_part (r1 + r2) = frac_part r1 + frac_part r2 - 1. Proof. - intros; unfold frac_part in |- *; generalize (plus_Int_part1 r1 r2 H); intro; + intros; unfold frac_part; generalize (plus_Int_part1 r1 r2 H); intro; rewrite H0; rewrite (plus_IZR (Int_part r1 + Int_part r2) 1); - rewrite (plus_IZR (Int_part r1) (Int_part r2)); simpl in |- *; - unfold Rminus at 3 4 in |- *; + rewrite (plus_IZR (Int_part r1) (Int_part r2)); simpl; + unfold Rminus at 3 4; rewrite (Rplus_assoc r1 (- IZR (Int_part r1)) (r2 + - IZR (Int_part r2))); rewrite (Rplus_comm r2 (- IZR (Int_part r2))); rewrite <- (Rplus_assoc (- IZR (Int_part r1)) (- IZR (Int_part r2)) r2); rewrite (Rplus_comm (- IZR (Int_part r1) + - IZR (Int_part r2)) r2); rewrite <- (Rplus_assoc r1 r2 (- IZR (Int_part r1) + - IZR (Int_part r2))); rewrite <- (Ropp_plus_distr (IZR (Int_part r1)) (IZR (Int_part r2))); - unfold Rminus in |- *; + unfold Rminus; rewrite (Rplus_assoc (r1 + r2) (- (IZR (Int_part r1) + IZR (Int_part r2))) (-1)) ; rewrite <- (Ropp_plus_distr (IZR (Int_part r1) + IZR (Int_part r2)) 1); @@ -547,14 +547,14 @@ Lemma plus_frac_part2 : frac_part r1 + frac_part r2 < 1 -> frac_part (r1 + r2) = frac_part r1 + frac_part r2. Proof. - intros; unfold frac_part in |- *; generalize (plus_Int_part2 r1 r2 H); intro; + intros; unfold frac_part; generalize (plus_Int_part2 r1 r2 H); intro; rewrite H0; rewrite (plus_IZR (Int_part r1) (Int_part r2)); - unfold Rminus at 2 3 in |- *; + unfold Rminus at 2 3; rewrite (Rplus_assoc r1 (- IZR (Int_part r1)) (r2 + - IZR (Int_part r2))); rewrite (Rplus_comm r2 (- IZR (Int_part r2))); rewrite <- (Rplus_assoc (- IZR (Int_part r1)) (- IZR (Int_part r2)) r2); rewrite (Rplus_comm (- IZR (Int_part r1) + - IZR (Int_part r2)) r2); rewrite <- (Rplus_assoc r1 r2 (- IZR (Int_part r1) + - IZR (Int_part r2))); rewrite <- (Ropp_plus_distr (IZR (Int_part r1)) (IZR (Int_part r2))); - unfold Rminus in |- *; trivial with zarith real. + unfold Rminus; trivial with zarith real. Qed. diff --git a/theories/Reals/R_sqr.v b/theories/Reals/R_sqr.v index f23b9f17..d6e18d9d 100644 --- a/theories/Reals/R_sqr.v +++ b/theories/Reals/R_sqr.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -8,13 +8,13 @@ Require Import Rbase. Require Import Rbasic_fun. -Open Local Scope R_scope. +Local Open Scope R_scope. (****************************************************) (** Rsqr : some results *) (****************************************************) -Ltac ring_Rsqr := unfold Rsqr in |- *; ring. +Ltac ring_Rsqr := unfold Rsqr; ring. Lemma Rsqr_neg : forall x:R, Rsqr x = Rsqr (- x). Proof. @@ -48,25 +48,25 @@ Qed. Lemma Rsqr_gt_0_0 : forall x:R, 0 < Rsqr x -> x <> 0. Proof. - intros; red in |- *; intro; rewrite H0 in H; rewrite Rsqr_0 in H; + intros; red; intro; rewrite H0 in H; rewrite Rsqr_0 in H; elim (Rlt_irrefl 0 H). Qed. Lemma Rsqr_pos_lt : forall x:R, x <> 0 -> 0 < Rsqr x. Proof. intros; case (Rtotal_order 0 x); intro; - [ unfold Rsqr in |- *; apply Rmult_lt_0_compat; assumption + [ unfold Rsqr; apply Rmult_lt_0_compat; assumption | elim H0; intro; - [ elim H; symmetry in |- *; exact H1 + [ elim H; symmetry ; exact H1 | rewrite Rsqr_neg; generalize (Ropp_lt_gt_contravar x 0 H1); - rewrite Ropp_0; intro; unfold Rsqr in |- *; + rewrite Ropp_0; intro; unfold Rsqr; apply Rmult_lt_0_compat; assumption ] ]. Qed. Lemma Rsqr_div : forall x y:R, y <> 0 -> Rsqr (x / y) = Rsqr x / Rsqr y. Proof. - intros; unfold Rsqr in |- *. - unfold Rdiv in |- *. + intros; unfold Rsqr. + unfold Rdiv. rewrite Rinv_mult_distr. repeat rewrite Rmult_assoc. apply Rmult_eq_compat_l. @@ -80,7 +80,7 @@ Qed. Lemma Rsqr_eq_0 : forall x:R, Rsqr x = 0 -> x = 0. Proof. - unfold Rsqr in |- *; intros; generalize (Rmult_integral x x H); intro; + unfold Rsqr; intros; generalize (Rmult_integral x x H); intro; elim H0; intro; assumption. Qed. @@ -122,7 +122,7 @@ Qed. Lemma Rsqr_incr_1 : forall x y:R, x <= y -> 0 <= x -> 0 <= y -> Rsqr x <= Rsqr y. Proof. - intros; unfold Rsqr in |- *; apply Rmult_le_compat; assumption. + intros; unfold Rsqr; apply Rmult_le_compat; assumption. Qed. Lemma Rsqr_incrst_0 : @@ -140,7 +140,7 @@ Qed. Lemma Rsqr_incrst_1 : forall x y:R, x < y -> 0 <= x -> 0 <= y -> Rsqr x < Rsqr y. Proof. - intros; unfold Rsqr in |- *; apply Rmult_le_0_lt_compat; assumption. + intros; unfold Rsqr; apply Rmult_le_0_lt_compat; assumption. Qed. Lemma Rsqr_neg_pos_le_0 : @@ -183,7 +183,7 @@ Qed. Lemma Rsqr_abs : forall x:R, Rsqr x = Rsqr (Rabs x). Proof. - intro; unfold Rabs in |- *; case (Rcase_abs x); intro; + intro; unfold Rabs; case (Rcase_abs x); intro; [ apply Rsqr_neg | reflexivity ]. Qed. @@ -220,7 +220,7 @@ Qed. Lemma Rsqr_eq_abs_0 : forall x y:R, Rsqr x = Rsqr y -> Rabs x = Rabs y. Proof. - intros; unfold Rabs in |- *; case (Rcase_abs x); case (Rcase_abs y); intros. + intros; unfold Rabs; case (Rcase_abs x); case (Rcase_abs y); intros. rewrite (Rsqr_neg x) in H; rewrite (Rsqr_neg y) in H; generalize (Ropp_lt_gt_contravar y 0 r); generalize (Ropp_lt_gt_contravar x 0 r0); rewrite Ropp_0; @@ -288,7 +288,7 @@ Qed. Lemma Rsqr_inv : forall x:R, x <> 0 -> Rsqr (/ x) = / Rsqr x. Proof. - intros; unfold Rsqr in |- *. + intros; unfold Rsqr. rewrite Rinv_mult_distr; try reflexivity || assumption. Qed. @@ -302,7 +302,7 @@ Proof. repeat rewrite Rmult_plus_distr_l. repeat rewrite Rplus_assoc. apply Rplus_eq_compat_l. - unfold Rdiv, Rminus in |- *. + unfold Rdiv, Rminus. replace (2 * 1 + 2 * 1) with 4; [ idtac | ring ]. rewrite (Rmult_plus_distr_r (4 * a * c) (- Rsqr b) (/ (4 * a))). rewrite Rsqr_mult. @@ -332,7 +332,7 @@ Proof. rewrite (Rmult_comm x). apply Rplus_eq_compat_l. rewrite (Rmult_comm (/ a)). - unfold Rsqr in |- *; repeat rewrite Rmult_assoc. + unfold Rsqr; repeat rewrite Rmult_assoc. rewrite <- Rinv_l_sym. rewrite Rmult_1_r. ring. @@ -357,7 +357,7 @@ Proof. rewrite Rplus_opp_l; replace (- (y * y) + x * x) with ((x - y) * (x + y)). intro; generalize (Rmult_integral (x - y) (x + y) H0); intro; elim H1; intros. left; apply Rminus_diag_uniq; assumption. - right; apply Rminus_diag_uniq; unfold Rminus in |- *; rewrite Ropp_involutive; + right; apply Rminus_diag_uniq; unfold Rminus; rewrite Ropp_involutive; assumption. ring. Qed. diff --git a/theories/Reals/R_sqrt.v b/theories/Reals/R_sqrt.v index 2c5ede23..2d9419bd 100644 --- a/theories/Reals/R_sqrt.v +++ b/theories/Reals/R_sqrt.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,7 +9,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import Rsqrt_def. -Open Local Scope R_scope. +Local Open Scope R_scope. (** * Continuous extension of Rsqrt on R *) Definition sqrt (x:R) : R := @@ -36,7 +36,7 @@ Qed. Lemma sqrt_sqrt : forall x:R, 0 <= x -> sqrt x * sqrt x = x. Proof. intros. - unfold sqrt in |- *. + unfold sqrt. case (Rcase_abs x); intro. elim (Rlt_irrefl _ (Rlt_le_trans _ _ _ r H)). rewrite Rsqrt_Rsqrt; reflexivity. @@ -44,7 +44,7 @@ Qed. Lemma sqrt_0 : sqrt 0 = 0. Proof. - apply Rsqr_eq_0; unfold Rsqr in |- *; apply sqrt_sqrt; right; reflexivity. + apply Rsqr_eq_0; unfold Rsqr; apply sqrt_sqrt; right; reflexivity. Qed. Lemma sqrt_1 : sqrt 1 = 1. @@ -52,7 +52,7 @@ Proof. apply (Rsqr_inj (sqrt 1) 1); [ apply sqrt_positivity; left | left - | unfold Rsqr in |- *; rewrite sqrt_sqrt; [ ring | left ] ]; + | unfold Rsqr; rewrite sqrt_sqrt; [ ring | left ] ]; apply Rlt_0_1. Qed. @@ -73,7 +73,7 @@ Proof. intros; apply Rsqr_inj; [ apply (sqrt_positivity x H) | assumption - | unfold Rsqr in |- *; rewrite H1; apply (sqrt_sqrt x H) ]. + | unfold Rsqr; rewrite H1; apply (sqrt_sqrt x H) ]. Qed. Lemma sqrt_def : forall x:R, 0 <= x -> sqrt x * sqrt x = x. @@ -86,12 +86,12 @@ Proof. intros; apply (Rsqr_inj (sqrt (Rsqr x)) x (sqrt_positivity (Rsqr x) (Rle_0_sqr x)) H); - unfold Rsqr in |- *; apply (sqrt_sqrt (Rsqr x) (Rle_0_sqr x)). + unfold Rsqr; apply (sqrt_sqrt (Rsqr x) (Rle_0_sqr x)). Qed. Lemma sqrt_Rsqr : forall x:R, 0 <= x -> sqrt (Rsqr x) = x. Proof. - intros; unfold Rsqr in |- *; apply sqrt_square; assumption. + intros; unfold Rsqr; apply sqrt_square; assumption. Qed. Lemma sqrt_Rsqr_abs : forall x:R, sqrt (Rsqr x) = Rabs x. @@ -101,7 +101,7 @@ Qed. Lemma Rsqr_sqrt : forall x:R, 0 <= x -> Rsqr (sqrt x) = x. Proof. - intros x H1; unfold Rsqr in |- *; apply (sqrt_sqrt x H1). + intros x H1; unfold Rsqr; apply (sqrt_sqrt x H1). Qed. Lemma sqrt_mult_alt : @@ -300,7 +300,7 @@ Proof. intros x H1 H2; generalize (sqrt_lt_1 x 1 (Rlt_le 0 x H1) (Rlt_le 0 1 Rlt_0_1) H2); intro H3; rewrite sqrt_1 in H3; generalize (Rmult_ne (sqrt x)); - intro H4; elim H4; intros H5 H6; rewrite <- H5; pattern x at 1 in |- *; + intro H4; elim H4; intros H5 H6; rewrite <- H5; pattern x at 1; rewrite <- (sqrt_def x (Rlt_le 0 x H1)); apply (Rmult_lt_compat_l (sqrt x) (sqrt x) 1 (sqrt_lt_R0 x H1) H3). Qed. @@ -310,7 +310,7 @@ Lemma sqrt_cauchy : a * c + b * d <= sqrt (Rsqr a + Rsqr b) * sqrt (Rsqr c + Rsqr d). Proof. intros a b c d; apply Rsqr_incr_0_var; - [ rewrite Rsqr_mult; repeat rewrite Rsqr_sqrt; unfold Rsqr in |- *; + [ rewrite Rsqr_mult; repeat rewrite Rsqr_sqrt; unfold Rsqr; [ replace ((a * c + b * d) * (a * c + b * d)) with (a * a * c * c + b * b * d * d + 2 * a * b * c * d); [ replace ((a * a + b * b) * (c * c + d * d)) with @@ -319,11 +319,11 @@ Proof. replace (a * a * d * d + b * b * c * c) with (2 * a * b * c * d + (a * a * d * d + b * b * c * c - 2 * a * b * c * d)); - [ pattern (2 * a * b * c * d) at 1 in |- *; rewrite <- Rplus_0_r; + [ pattern (2 * a * b * c * d) at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; replace (a * a * d * d + b * b * c * c - 2 * a * b * c * d) with (Rsqr (a * d - b * c)); - [ apply Rle_0_sqr | unfold Rsqr in |- *; ring ] + [ apply Rle_0_sqr | unfold Rsqr; ring ] | ring ] | ring ] | ring ] @@ -355,16 +355,16 @@ Lemma Rsqr_sol_eq_0_1 : x = sol_x1 a b c \/ x = sol_x2 a b c -> a * Rsqr x + b * x + c = 0. Proof. intros; elim H0; intro. - unfold sol_x1 in H1; unfold Delta in H1; rewrite H1; unfold Rdiv in |- *; + unfold sol_x1 in H1; unfold Delta in H1; rewrite H1; unfold Rdiv; repeat rewrite Rsqr_mult; rewrite Rsqr_plus; rewrite <- Rsqr_neg; rewrite Rsqr_sqrt. rewrite Rsqr_inv. - unfold Rsqr in |- *; repeat rewrite Rinv_mult_distr. + unfold Rsqr; repeat rewrite Rinv_mult_distr. repeat rewrite Rmult_assoc; rewrite (Rmult_comm a). repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r; rewrite Rmult_plus_distr_r. repeat rewrite Rmult_assoc. - pattern 2 at 2 in |- *; rewrite (Rmult_comm 2). + pattern 2 at 2; rewrite (Rmult_comm 2). repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r. rewrite @@ -376,7 +376,7 @@ Proof. (b * (- b * (/ 2 * / a)) + (b * (sqrt (b * b - 2 * (2 * (a * c))) * (/ 2 * / a)) + c))) with (b * (- b * (/ 2 * / a)) + c). - unfold Rminus in |- *; repeat rewrite <- Rplus_assoc. + unfold Rminus; repeat rewrite <- Rplus_assoc. replace (b * b + b * b) with (2 * (b * b)). rewrite Rmult_plus_distr_r; repeat rewrite Rmult_assoc. rewrite (Rmult_comm 2); repeat rewrite Rmult_assoc. @@ -407,17 +407,17 @@ Proof. apply prod_neq_R0; [ discrR | apply (cond_nonzero a) ]. apply prod_neq_R0; [ discrR | apply (cond_nonzero a) ]. assumption. - unfold sol_x2 in H1; unfold Delta in H1; rewrite H1; unfold Rdiv in |- *; + unfold sol_x2 in H1; unfold Delta in H1; rewrite H1; unfold Rdiv; repeat rewrite Rsqr_mult; rewrite Rsqr_minus; rewrite <- Rsqr_neg; rewrite Rsqr_sqrt. rewrite Rsqr_inv. - unfold Rsqr in |- *; repeat rewrite Rinv_mult_distr; + unfold Rsqr; repeat rewrite Rinv_mult_distr; repeat rewrite Rmult_assoc. rewrite (Rmult_comm a); repeat rewrite Rmult_assoc. rewrite <- Rinv_l_sym. - rewrite Rmult_1_r; unfold Rminus in |- *; rewrite Rmult_plus_distr_r. + rewrite Rmult_1_r; unfold Rminus; rewrite Rmult_plus_distr_r. rewrite Ropp_mult_distr_l_reverse; repeat rewrite Rmult_assoc; - pattern 2 at 2 in |- *; rewrite (Rmult_comm 2). + pattern 2 at 2; rewrite (Rmult_comm 2). repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r; rewrite @@ -480,23 +480,23 @@ Proof. intro; generalize (Rsqr_eq (x + b / (2 * a)) (sqrt (Delta a b c) / (2 * a)) H3); intro; elim H4; intro. - left; unfold sol_x1 in |- *; + left; unfold sol_x1; generalize (Rplus_eq_compat_l (- (b / (2 * a))) (x + b / (2 * a)) (sqrt (Delta a b c) / (2 * a)) H5); replace (- (b / (2 * a)) + (x + b / (2 * a))) with x. - intro; rewrite H6; unfold Rdiv in |- *; ring. + intro; rewrite H6; unfold Rdiv; ring. ring. - right; unfold sol_x2 in |- *; + right; unfold sol_x2; generalize (Rplus_eq_compat_l (- (b / (2 * a))) (x + b / (2 * a)) (- (sqrt (Delta a b c) / (2 * a))) H5); replace (- (b / (2 * a)) + (x + b / (2 * a))) with x. - intro; rewrite H6; unfold Rdiv in |- *; ring. + intro; rewrite H6; unfold Rdiv; ring. ring. rewrite Rsqr_div. rewrite Rsqr_sqrt. - unfold Rdiv in |- *. + unfold Rdiv. repeat rewrite Rmult_assoc. rewrite (Rmult_comm (/ a)). rewrite Rmult_assoc. @@ -510,9 +510,9 @@ Proof. assumption. apply prod_neq_R0; [ discrR | apply (cond_nonzero a) ]. rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. - symmetry in |- *; apply Rmult_1_l. + symmetry ; apply Rmult_1_l. apply (cond_nonzero a). - unfold Rdiv in |- *; rewrite <- Ropp_mult_distr_l_reverse. + unfold Rdiv; rewrite <- Ropp_mult_distr_l_reverse. rewrite Ropp_minus_distr. reflexivity. reflexivity. diff --git a/theories/Reals/Ranalysis.v b/theories/Reals/Ranalysis.v index 01715cf3..ad86a197 100644 --- a/theories/Reals/Ranalysis.v +++ b/theories/Reals/Ranalysis.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -26,775 +26,4 @@ Require Export RList. Require Export Sqrt_reg. Require Export Ranalysis4. Require Export Rpower. -Open Local Scope R_scope. - -Axiom AppVar : R. - -(**********) -Ltac intro_hyp_glob trm := - match constr:trm with - | (?X1 + ?X2)%F => - match goal with - | |- (derivable _) => intro_hyp_glob X1; intro_hyp_glob X2 - | |- (continuity _) => intro_hyp_glob X1; intro_hyp_glob X2 - | _ => idtac - end - | (?X1 - ?X2)%F => - match goal with - | |- (derivable _) => intro_hyp_glob X1; intro_hyp_glob X2 - | |- (continuity _) => intro_hyp_glob X1; intro_hyp_glob X2 - | _ => idtac - end - | (?X1 * ?X2)%F => - match goal with - | |- (derivable _) => intro_hyp_glob X1; intro_hyp_glob X2 - | |- (continuity _) => intro_hyp_glob X1; intro_hyp_glob X2 - | _ => idtac - end - | (?X1 / ?X2)%F => - let aux := constr:X2 in - match goal with - | _:(forall x0:R, aux x0 <> 0) |- (derivable _) => - intro_hyp_glob X1; intro_hyp_glob X2 - | _:(forall x0:R, aux x0 <> 0) |- (continuity _) => - intro_hyp_glob X1; intro_hyp_glob X2 - | |- (derivable _) => - cut (forall x0:R, aux x0 <> 0); - [ intro; intro_hyp_glob X1; intro_hyp_glob X2 | try assumption ] - | |- (continuity _) => - cut (forall x0:R, aux x0 <> 0); - [ intro; intro_hyp_glob X1; intro_hyp_glob X2 | try assumption ] - | _ => idtac - end - | (comp ?X1 ?X2) => - match goal with - | |- (derivable _) => intro_hyp_glob X1; intro_hyp_glob X2 - | |- (continuity _) => intro_hyp_glob X1; intro_hyp_glob X2 - | _ => idtac - end - | (- ?X1)%F => - match goal with - | |- (derivable _) => intro_hyp_glob X1 - | |- (continuity _) => intro_hyp_glob X1 - | _ => idtac - end - | (/ ?X1)%F => - let aux := constr:X1 in - match goal with - | _:(forall x0:R, aux x0 <> 0) |- (derivable _) => - intro_hyp_glob X1 - | _:(forall x0:R, aux x0 <> 0) |- (continuity _) => - intro_hyp_glob X1 - | |- (derivable _) => - cut (forall x0:R, aux x0 <> 0); - [ intro; intro_hyp_glob X1 | try assumption ] - | |- (continuity _) => - cut (forall x0:R, aux x0 <> 0); - [ intro; intro_hyp_glob X1 | try assumption ] - | _ => idtac - end - | cos => idtac - | sin => idtac - | cosh => idtac - | sinh => idtac - | exp => idtac - | Rsqr => idtac - | sqrt => idtac - | id => idtac - | (fct_cte _) => idtac - | (pow_fct _) => idtac - | Rabs => idtac - | ?X1 => - let p := constr:X1 in - match goal with - | _:(derivable p) |- _ => idtac - | |- (derivable p) => idtac - | |- (derivable _) => - cut (True -> derivable p); - [ intro HYPPD; cut (derivable p); - [ intro; clear HYPPD | apply HYPPD; clear HYPPD; trivial ] - | idtac ] - | _:(continuity p) |- _ => idtac - | |- (continuity p) => idtac - | |- (continuity _) => - cut (True -> continuity p); - [ intro HYPPD; cut (continuity p); - [ intro; clear HYPPD | apply HYPPD; clear HYPPD; trivial ] - | idtac ] - | _ => idtac - end - end. - -(**********) -Ltac intro_hyp_pt trm pt := - match constr:trm with - | (?X1 + ?X2)%F => - match goal with - | |- (derivable_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | |- (continuity_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | |- (derive_pt _ _ _ = _) => - intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | _ => idtac - end - | (?X1 - ?X2)%F => - match goal with - | |- (derivable_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | |- (continuity_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | |- (derive_pt _ _ _ = _) => - intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | _ => idtac - end - | (?X1 * ?X2)%F => - match goal with - | |- (derivable_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | |- (continuity_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | |- (derive_pt _ _ _ = _) => - intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | _ => idtac - end - | (?X1 / ?X2)%F => - let aux := constr:X2 in - match goal with - | _:(aux pt <> 0) |- (derivable_pt _ _) => - intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | _:(aux pt <> 0) |- (continuity_pt _ _) => - intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | _:(aux pt <> 0) |- (derive_pt _ _ _ = _) => - intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | id:(forall x0:R, aux x0 <> 0) |- (derivable_pt _ _) => - generalize (id pt); intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | id:(forall x0:R, aux x0 <> 0) |- (continuity_pt _ _) => - generalize (id pt); intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | id:(forall x0:R, aux x0 <> 0) |- (derive_pt _ _ _ = _) => - generalize (id pt); intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt - | |- (derivable_pt _ _) => - cut (aux pt <> 0); - [ intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt | try assumption ] - | |- (continuity_pt _ _) => - cut (aux pt <> 0); - [ intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt | try assumption ] - | |- (derive_pt _ _ _ = _) => - cut (aux pt <> 0); - [ intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt | try assumption ] - | _ => idtac - end - | (comp ?X1 ?X2) => - match goal with - | |- (derivable_pt _ _) => - let pt_f1 := eval cbv beta in (X2 pt) in - (intro_hyp_pt X1 pt_f1; intro_hyp_pt X2 pt) - | |- (continuity_pt _ _) => - let pt_f1 := eval cbv beta in (X2 pt) in - (intro_hyp_pt X1 pt_f1; intro_hyp_pt X2 pt) - | |- (derive_pt _ _ _ = _) => - let pt_f1 := eval cbv beta in (X2 pt) in - (intro_hyp_pt X1 pt_f1; intro_hyp_pt X2 pt) - | _ => idtac - end - | (- ?X1)%F => - match goal with - | |- (derivable_pt _ _) => intro_hyp_pt X1 pt - | |- (continuity_pt _ _) => intro_hyp_pt X1 pt - | |- (derive_pt _ _ _ = _) => intro_hyp_pt X1 pt - | _ => idtac - end - | (/ ?X1)%F => - let aux := constr:X1 in - match goal with - | _:(aux pt <> 0) |- (derivable_pt _ _) => - intro_hyp_pt X1 pt - | _:(aux pt <> 0) |- (continuity_pt _ _) => - intro_hyp_pt X1 pt - | _:(aux pt <> 0) |- (derive_pt _ _ _ = _) => - intro_hyp_pt X1 pt - | id:(forall x0:R, aux x0 <> 0) |- (derivable_pt _ _) => - generalize (id pt); intro; intro_hyp_pt X1 pt - | id:(forall x0:R, aux x0 <> 0) |- (continuity_pt _ _) => - generalize (id pt); intro; intro_hyp_pt X1 pt - | id:(forall x0:R, aux x0 <> 0) |- (derive_pt _ _ _ = _) => - generalize (id pt); intro; intro_hyp_pt X1 pt - | |- (derivable_pt _ _) => - cut (aux pt <> 0); [ intro; intro_hyp_pt X1 pt | try assumption ] - | |- (continuity_pt _ _) => - cut (aux pt <> 0); [ intro; intro_hyp_pt X1 pt | try assumption ] - | |- (derive_pt _ _ _ = _) => - cut (aux pt <> 0); [ intro; intro_hyp_pt X1 pt | try assumption ] - | _ => idtac - end - | cos => idtac - | sin => idtac - | cosh => idtac - | sinh => idtac - | exp => idtac - | Rsqr => idtac - | id => idtac - | (fct_cte _) => idtac - | (pow_fct _) => idtac - | sqrt => - match goal with - | |- (derivable_pt _ _) => cut (0 < pt); [ intro | try assumption ] - | |- (continuity_pt _ _) => - cut (0 <= pt); [ intro | try assumption ] - | |- (derive_pt _ _ _ = _) => - cut (0 < pt); [ intro | try assumption ] - | _ => idtac - end - | Rabs => - match goal with - | |- (derivable_pt _ _) => - cut (pt <> 0); [ intro | try assumption ] - | _ => idtac - end - | ?X1 => - let p := constr:X1 in - match goal with - | _:(derivable_pt p pt) |- _ => idtac - | |- (derivable_pt p pt) => idtac - | |- (derivable_pt _ _) => - cut (True -> derivable_pt p pt); - [ intro HYPPD; cut (derivable_pt p pt); - [ intro; clear HYPPD | apply HYPPD; clear HYPPD; trivial ] - | idtac ] - | _:(continuity_pt p pt) |- _ => idtac - | |- (continuity_pt p pt) => idtac - | |- (continuity_pt _ _) => - cut (True -> continuity_pt p pt); - [ intro HYPPD; cut (continuity_pt p pt); - [ intro; clear HYPPD | apply HYPPD; clear HYPPD; trivial ] - | idtac ] - | |- (derive_pt _ _ _ = _) => - cut (True -> derivable_pt p pt); - [ intro HYPPD; cut (derivable_pt p pt); - [ intro; clear HYPPD | apply HYPPD; clear HYPPD; trivial ] - | idtac ] - | _ => idtac - end - end. - -(**********) -Ltac is_diff_pt := - match goal with - | |- (derivable_pt Rsqr _) => - - (* fonctions de base *) - apply derivable_pt_Rsqr - | |- (derivable_pt id ?X1) => apply (derivable_pt_id X1) - | |- (derivable_pt (fct_cte _) _) => apply derivable_pt_const - | |- (derivable_pt sin _) => apply derivable_pt_sin - | |- (derivable_pt cos _) => apply derivable_pt_cos - | |- (derivable_pt sinh _) => apply derivable_pt_sinh - | |- (derivable_pt cosh _) => apply derivable_pt_cosh - | |- (derivable_pt exp _) => apply derivable_pt_exp - | |- (derivable_pt (pow_fct _) _) => - unfold pow_fct in |- *; apply derivable_pt_pow - | |- (derivable_pt sqrt ?X1) => - apply (derivable_pt_sqrt X1); - assumption || - unfold plus_fct, minus_fct, opp_fct, mult_fct, div_fct, inv_fct, - comp, id, fct_cte, pow_fct in |- * - | |- (derivable_pt Rabs ?X1) => - apply (Rderivable_pt_abs X1); - assumption || - unfold plus_fct, minus_fct, opp_fct, mult_fct, div_fct, inv_fct, - comp, id, fct_cte, pow_fct in |- * - (* regles de differentiabilite *) - (* PLUS *) - | |- (derivable_pt (?X1 + ?X2) ?X3) => - apply (derivable_pt_plus X1 X2 X3); is_diff_pt - (* MOINS *) - | |- (derivable_pt (?X1 - ?X2) ?X3) => - apply (derivable_pt_minus X1 X2 X3); is_diff_pt - (* OPPOSE *) - | |- (derivable_pt (- ?X1) ?X2) => - apply (derivable_pt_opp X1 X2); - is_diff_pt - (* MULTIPLICATION PAR UN SCALAIRE *) - | |- (derivable_pt (mult_real_fct ?X1 ?X2) ?X3) => - apply (derivable_pt_scal X2 X1 X3); is_diff_pt - (* MULTIPLICATION *) - | |- (derivable_pt (?X1 * ?X2) ?X3) => - apply (derivable_pt_mult X1 X2 X3); is_diff_pt - (* DIVISION *) - | |- (derivable_pt (?X1 / ?X2) ?X3) => - apply (derivable_pt_div X1 X2 X3); - [ is_diff_pt - | is_diff_pt - | try - assumption || - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, - comp, pow_fct, id, fct_cte in |- * ] - | |- (derivable_pt (/ ?X1) ?X2) => - - (* INVERSION *) - apply (derivable_pt_inv X1 X2); - [ assumption || - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, - comp, pow_fct, id, fct_cte in |- * - | is_diff_pt ] - | |- (derivable_pt (comp ?X1 ?X2) ?X3) => - - (* COMPOSITION *) - apply (derivable_pt_comp X2 X1 X3); is_diff_pt - | _:(derivable_pt ?X1 ?X2) |- (derivable_pt ?X1 ?X2) => - assumption - | _:(derivable ?X1) |- (derivable_pt ?X1 ?X2) => - cut (derivable X1); [ intro HypDDPT; apply HypDDPT | assumption ] - | |- (True -> derivable_pt _ _) => - intro HypTruE; clear HypTruE; is_diff_pt - | _ => - try - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, id, - fct_cte, comp, pow_fct in |- * - end. - -(**********) -Ltac is_diff_glob := - match goal with - | |- (derivable Rsqr) => - (* fonctions de base *) - apply derivable_Rsqr - | |- (derivable id) => apply derivable_id - | |- (derivable (fct_cte _)) => apply derivable_const - | |- (derivable sin) => apply derivable_sin - | |- (derivable cos) => apply derivable_cos - | |- (derivable cosh) => apply derivable_cosh - | |- (derivable sinh) => apply derivable_sinh - | |- (derivable exp) => apply derivable_exp - | |- (derivable (pow_fct _)) => - unfold pow_fct in |- *; - apply derivable_pow - (* regles de differentiabilite *) - (* PLUS *) - | |- (derivable (?X1 + ?X2)) => - apply (derivable_plus X1 X2); is_diff_glob - (* MOINS *) - | |- (derivable (?X1 - ?X2)) => - apply (derivable_minus X1 X2); is_diff_glob - (* OPPOSE *) - | |- (derivable (- ?X1)) => - apply (derivable_opp X1); - is_diff_glob - (* MULTIPLICATION PAR UN SCALAIRE *) - | |- (derivable (mult_real_fct ?X1 ?X2)) => - apply (derivable_scal X2 X1); is_diff_glob - (* MULTIPLICATION *) - | |- (derivable (?X1 * ?X2)) => - apply (derivable_mult X1 X2); is_diff_glob - (* DIVISION *) - | |- (derivable (?X1 / ?X2)) => - apply (derivable_div X1 X2); - [ is_diff_glob - | is_diff_glob - | try - assumption || - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, - id, fct_cte, comp, pow_fct in |- * ] - | |- (derivable (/ ?X1)) => - - (* INVERSION *) - apply (derivable_inv X1); - [ try - assumption || - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, - id, fct_cte, comp, pow_fct in |- * - | is_diff_glob ] - | |- (derivable (comp sqrt _)) => - - (* COMPOSITION *) - unfold derivable in |- *; intro; try is_diff_pt - | |- (derivable (comp Rabs _)) => - unfold derivable in |- *; intro; try is_diff_pt - | |- (derivable (comp ?X1 ?X2)) => - apply (derivable_comp X2 X1); is_diff_glob - | _:(derivable ?X1) |- (derivable ?X1) => assumption - | |- (True -> derivable _) => - intro HypTruE; clear HypTruE; is_diff_glob - | _ => - try - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, id, - fct_cte, comp, pow_fct in |- * - end. - -(**********) -Ltac is_cont_pt := - match goal with - | |- (continuity_pt Rsqr _) => - - (* fonctions de base *) - apply derivable_continuous_pt; apply derivable_pt_Rsqr - | |- (continuity_pt id ?X1) => - apply derivable_continuous_pt; apply (derivable_pt_id X1) - | |- (continuity_pt (fct_cte _) _) => - apply derivable_continuous_pt; apply derivable_pt_const - | |- (continuity_pt sin _) => - apply derivable_continuous_pt; apply derivable_pt_sin - | |- (continuity_pt cos _) => - apply derivable_continuous_pt; apply derivable_pt_cos - | |- (continuity_pt sinh _) => - apply derivable_continuous_pt; apply derivable_pt_sinh - | |- (continuity_pt cosh _) => - apply derivable_continuous_pt; apply derivable_pt_cosh - | |- (continuity_pt exp _) => - apply derivable_continuous_pt; apply derivable_pt_exp - | |- (continuity_pt (pow_fct _) _) => - unfold pow_fct in |- *; apply derivable_continuous_pt; - apply derivable_pt_pow - | |- (continuity_pt sqrt ?X1) => - apply continuity_pt_sqrt; - assumption || - unfold plus_fct, minus_fct, opp_fct, mult_fct, div_fct, inv_fct, - comp, id, fct_cte, pow_fct in |- * - | |- (continuity_pt Rabs ?X1) => - apply (Rcontinuity_abs X1) - (* regles de differentiabilite *) - (* PLUS *) - | |- (continuity_pt (?X1 + ?X2) ?X3) => - apply (continuity_pt_plus X1 X2 X3); is_cont_pt - (* MOINS *) - | |- (continuity_pt (?X1 - ?X2) ?X3) => - apply (continuity_pt_minus X1 X2 X3); is_cont_pt - (* OPPOSE *) - | |- (continuity_pt (- ?X1) ?X2) => - apply (continuity_pt_opp X1 X2); - is_cont_pt - (* MULTIPLICATION PAR UN SCALAIRE *) - | |- (continuity_pt (mult_real_fct ?X1 ?X2) ?X3) => - apply (continuity_pt_scal X2 X1 X3); is_cont_pt - (* MULTIPLICATION *) - | |- (continuity_pt (?X1 * ?X2) ?X3) => - apply (continuity_pt_mult X1 X2 X3); is_cont_pt - (* DIVISION *) - | |- (continuity_pt (?X1 / ?X2) ?X3) => - apply (continuity_pt_div X1 X2 X3); - [ is_cont_pt - | is_cont_pt - | try - assumption || - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, - comp, id, fct_cte, pow_fct in |- * ] - | |- (continuity_pt (/ ?X1) ?X2) => - - (* INVERSION *) - apply (continuity_pt_inv X1 X2); - [ is_cont_pt - | assumption || - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, - comp, id, fct_cte, pow_fct in |- * ] - | |- (continuity_pt (comp ?X1 ?X2) ?X3) => - - (* COMPOSITION *) - apply (continuity_pt_comp X2 X1 X3); is_cont_pt - | _:(continuity_pt ?X1 ?X2) |- (continuity_pt ?X1 ?X2) => - assumption - | _:(continuity ?X1) |- (continuity_pt ?X1 ?X2) => - cut (continuity X1); [ intro HypDDPT; apply HypDDPT | assumption ] - | _:(derivable_pt ?X1 ?X2) |- (continuity_pt ?X1 ?X2) => - apply derivable_continuous_pt; assumption - | _:(derivable ?X1) |- (continuity_pt ?X1 ?X2) => - cut (continuity X1); - [ intro HypDDPT; apply HypDDPT - | apply derivable_continuous; assumption ] - | |- (True -> continuity_pt _ _) => - intro HypTruE; clear HypTruE; is_cont_pt - | _ => - try - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, id, - fct_cte, comp, pow_fct in |- * - end. - -(**********) -Ltac is_cont_glob := - match goal with - | |- (continuity Rsqr) => - - (* fonctions de base *) - apply derivable_continuous; apply derivable_Rsqr - | |- (continuity id) => apply derivable_continuous; apply derivable_id - | |- (continuity (fct_cte _)) => - apply derivable_continuous; apply derivable_const - | |- (continuity sin) => apply derivable_continuous; apply derivable_sin - | |- (continuity cos) => apply derivable_continuous; apply derivable_cos - | |- (continuity exp) => apply derivable_continuous; apply derivable_exp - | |- (continuity (pow_fct _)) => - unfold pow_fct in |- *; apply derivable_continuous; apply derivable_pow - | |- (continuity sinh) => - apply derivable_continuous; apply derivable_sinh - | |- (continuity cosh) => - apply derivable_continuous; apply derivable_cosh - | |- (continuity Rabs) => - apply Rcontinuity_abs - (* regles de continuite *) - (* PLUS *) - | |- (continuity (?X1 + ?X2)) => - apply (continuity_plus X1 X2); - try is_cont_glob || assumption - (* MOINS *) - | |- (continuity (?X1 - ?X2)) => - apply (continuity_minus X1 X2); - try is_cont_glob || assumption - (* OPPOSE *) - | |- (continuity (- ?X1)) => - apply (continuity_opp X1); try is_cont_glob || assumption - (* INVERSE *) - | |- (continuity (/ ?X1)) => - apply (continuity_inv X1); - try is_cont_glob || assumption - (* MULTIPLICATION PAR UN SCALAIRE *) - | |- (continuity (mult_real_fct ?X1 ?X2)) => - apply (continuity_scal X2 X1); - try is_cont_glob || assumption - (* MULTIPLICATION *) - | |- (continuity (?X1 * ?X2)) => - apply (continuity_mult X1 X2); - try is_cont_glob || assumption - (* DIVISION *) - | |- (continuity (?X1 / ?X2)) => - apply (continuity_div X1 X2); - [ try is_cont_glob || assumption - | try is_cont_glob || assumption - | try - assumption || - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, - id, fct_cte, pow_fct in |- * ] - | |- (continuity (comp sqrt _)) => - - (* COMPOSITION *) - unfold continuity_pt in |- *; intro; try is_cont_pt - | |- (continuity (comp ?X1 ?X2)) => - apply (continuity_comp X2 X1); try is_cont_glob || assumption - | _:(continuity ?X1) |- (continuity ?X1) => assumption - | |- (True -> continuity _) => - intro HypTruE; clear HypTruE; is_cont_glob - | _:(derivable ?X1) |- (continuity ?X1) => - apply derivable_continuous; assumption - | _ => - try - unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, id, - fct_cte, comp, pow_fct in |- * - end. - -(**********) -Ltac rew_term trm := - match constr:trm with - | (?X1 + ?X2) => - let p1 := rew_term X1 with p2 := rew_term X2 in - match constr:p1 with - | (fct_cte ?X3) => - match constr:p2 with - | (fct_cte ?X4) => constr:(fct_cte (X3 + X4)) - | _ => constr:(p1 + p2)%F - end - | _ => constr:(p1 + p2)%F - end - | (?X1 - ?X2) => - let p1 := rew_term X1 with p2 := rew_term X2 in - match constr:p1 with - | (fct_cte ?X3) => - match constr:p2 with - | (fct_cte ?X4) => constr:(fct_cte (X3 - X4)) - | _ => constr:(p1 - p2)%F - end - | _ => constr:(p1 - p2)%F - end - | (?X1 / ?X2) => - let p1 := rew_term X1 with p2 := rew_term X2 in - match constr:p1 with - | (fct_cte ?X3) => - match constr:p2 with - | (fct_cte ?X4) => constr:(fct_cte (X3 / X4)) - | _ => constr:(p1 / p2)%F - end - | _ => - match constr:p2 with - | (fct_cte ?X4) => constr:(p1 * fct_cte (/ X4))%F - | _ => constr:(p1 / p2)%F - end - end - | (?X1 * / ?X2) => - let p1 := rew_term X1 with p2 := rew_term X2 in - match constr:p1 with - | (fct_cte ?X3) => - match constr:p2 with - | (fct_cte ?X4) => constr:(fct_cte (X3 / X4)) - | _ => constr:(p1 / p2)%F - end - | _ => - match constr:p2 with - | (fct_cte ?X4) => constr:(p1 * fct_cte (/ X4))%F - | _ => constr:(p1 / p2)%F - end - end - | (?X1 * ?X2) => - let p1 := rew_term X1 with p2 := rew_term X2 in - match constr:p1 with - | (fct_cte ?X3) => - match constr:p2 with - | (fct_cte ?X4) => constr:(fct_cte (X3 * X4)) - | _ => constr:(p1 * p2)%F - end - | _ => constr:(p1 * p2)%F - end - | (- ?X1) => - let p := rew_term X1 in - match constr:p with - | (fct_cte ?X2) => constr:(fct_cte (- X2)) - | _ => constr:(- p)%F - end - | (/ ?X1) => - let p := rew_term X1 in - match constr:p with - | (fct_cte ?X2) => constr:(fct_cte (/ X2)) - | _ => constr:(/ p)%F - end - | (?X1 AppVar) => constr:X1 - | (?X1 ?X2) => - let p := rew_term X2 in - match constr:p with - | (fct_cte ?X3) => constr:(fct_cte (X1 X3)) - | _ => constr:(comp X1 p) - end - | AppVar => constr:id - | (AppVar ^ ?X1) => constr:(pow_fct X1) - | (?X1 ^ ?X2) => - let p := rew_term X1 in - match constr:p with - | (fct_cte ?X3) => constr:(fct_cte (pow_fct X2 X3)) - | _ => constr:(comp (pow_fct X2) p) - end - | ?X1 => constr:(fct_cte X1) - end. - -(**********) -Ltac deriv_proof trm pt := - match constr:trm with - | (?X1 + ?X2)%F => - let p1 := deriv_proof X1 pt with p2 := deriv_proof X2 pt in - constr:(derivable_pt_plus X1 X2 pt p1 p2) - | (?X1 - ?X2)%F => - let p1 := deriv_proof X1 pt with p2 := deriv_proof X2 pt in - constr:(derivable_pt_minus X1 X2 pt p1 p2) - | (?X1 * ?X2)%F => - let p1 := deriv_proof X1 pt with p2 := deriv_proof X2 pt in - constr:(derivable_pt_mult X1 X2 pt p1 p2) - | (?X1 / ?X2)%F => - match goal with - | id:(?X2 pt <> 0) |- _ => - let p1 := deriv_proof X1 pt with p2 := deriv_proof X2 pt in - constr:(derivable_pt_div X1 X2 pt p1 p2 id) - | _ => constr:False - end - | (/ ?X1)%F => - match goal with - | id:(?X1 pt <> 0) |- _ => - let p1 := deriv_proof X1 pt in - constr:(derivable_pt_inv X1 pt p1 id) - | _ => constr:False - end - | (comp ?X1 ?X2) => - let pt_f1 := eval cbv beta in (X2 pt) in - let p1 := deriv_proof X1 pt_f1 with p2 := deriv_proof X2 pt in - constr:(derivable_pt_comp X2 X1 pt p2 p1) - | (- ?X1)%F => - let p1 := deriv_proof X1 pt in - constr:(derivable_pt_opp X1 pt p1) - | sin => constr:(derivable_pt_sin pt) - | cos => constr:(derivable_pt_cos pt) - | sinh => constr:(derivable_pt_sinh pt) - | cosh => constr:(derivable_pt_cosh pt) - | exp => constr:(derivable_pt_exp pt) - | id => constr:(derivable_pt_id pt) - | Rsqr => constr:(derivable_pt_Rsqr pt) - | sqrt => - match goal with - | id:(0 < pt) |- _ => constr:(derivable_pt_sqrt pt id) - | _ => constr:False - end - | (fct_cte ?X1) => constr:(derivable_pt_const X1 pt) - | ?X1 => - let aux := constr:X1 in - match goal with - | id:(derivable_pt aux pt) |- _ => constr:id - | id:(derivable aux) |- _ => constr:(id pt) - | _ => constr:False - end - end. - -(**********) -Ltac simplify_derive trm pt := - match constr:trm with - | (?X1 + ?X2)%F => - try rewrite derive_pt_plus; simplify_derive X1 pt; - simplify_derive X2 pt - | (?X1 - ?X2)%F => - try rewrite derive_pt_minus; simplify_derive X1 pt; - simplify_derive X2 pt - | (?X1 * ?X2)%F => - try rewrite derive_pt_mult; simplify_derive X1 pt; - simplify_derive X2 pt - | (?X1 / ?X2)%F => - try rewrite derive_pt_div; simplify_derive X1 pt; simplify_derive X2 pt - | (comp ?X1 ?X2) => - let pt_f1 := eval cbv beta in (X2 pt) in - (try rewrite derive_pt_comp; simplify_derive X1 pt_f1; - simplify_derive X2 pt) - | (- ?X1)%F => try rewrite derive_pt_opp; simplify_derive X1 pt - | (/ ?X1)%F => - try rewrite derive_pt_inv; simplify_derive X1 pt - | (fct_cte ?X1) => try rewrite derive_pt_const - | id => try rewrite derive_pt_id - | sin => try rewrite derive_pt_sin - | cos => try rewrite derive_pt_cos - | sinh => try rewrite derive_pt_sinh - | cosh => try rewrite derive_pt_cosh - | exp => try rewrite derive_pt_exp - | Rsqr => try rewrite derive_pt_Rsqr - | sqrt => try rewrite derive_pt_sqrt - | ?X1 => - let aux := constr:X1 in - match goal with - | id:(derive_pt aux pt ?X2 = _),H:(derivable aux) |- _ => - try replace (derive_pt aux pt (H pt)) with (derive_pt aux pt X2); - [ rewrite id | apply pr_nu ] - | id:(derive_pt aux pt ?X2 = _),H:(derivable_pt aux pt) |- _ => - try replace (derive_pt aux pt H) with (derive_pt aux pt X2); - [ rewrite id | apply pr_nu ] - | _ => idtac - end - | _ => idtac - end. - -(**********) -Ltac reg := - match goal with - | |- (derivable_pt ?X1 ?X2) => - let trm := eval cbv beta in (X1 AppVar) in - let aux := rew_term trm in - (intro_hyp_pt aux X2; - try (change (derivable_pt aux X2) in |- *; is_diff_pt) || is_diff_pt) - | |- (derivable ?X1) => - let trm := eval cbv beta in (X1 AppVar) in - let aux := rew_term trm in - (intro_hyp_glob aux; - try (change (derivable aux) in |- *; is_diff_glob) || is_diff_glob) - | |- (continuity ?X1) => - let trm := eval cbv beta in (X1 AppVar) in - let aux := rew_term trm in - (intro_hyp_glob aux; - try (change (continuity aux) in |- *; is_cont_glob) || is_cont_glob) - | |- (continuity_pt ?X1 ?X2) => - let trm := eval cbv beta in (X1 AppVar) in - let aux := rew_term trm in - (intro_hyp_pt aux X2; - try (change (continuity_pt aux X2) in |- *; is_cont_pt) || is_cont_pt) - | |- (derive_pt ?X1 ?X2 ?X3 = ?X4) => - let trm := eval cbv beta in (X1 AppVar) in - let aux := rew_term trm in - intro_hyp_pt aux X2; - (let aux2 := deriv_proof aux X2 in - try - (replace (derive_pt X1 X2 X3) with (derive_pt aux X2 aux2); - [ simplify_derive aux X2; - try unfold plus_fct, minus_fct, mult_fct, div_fct, id, fct_cte, - inv_fct, opp_fct in |- *; ring || ring_simplify - | try apply pr_nu ]) || is_diff_pt) - end. +Require Export Ranalysis_reg.
\ No newline at end of file diff --git a/theories/Reals/Ranalysis1.v b/theories/Reals/Ranalysis1.v index 3075bee8..2f54ee94 100644 --- a/theories/Reals/Ranalysis1.v +++ b/theories/Reals/Ranalysis1.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -10,7 +10,7 @@ Require Import Rbase. Require Import Rfunctions. Require Export Rlimit. Require Export Rderiv. -Open Local Scope R_scope. +Local Open Scope R_scope. Implicit Type f : R -> R. (****************************************************) @@ -43,7 +43,7 @@ Notation "- x" := (opp_fct x) : Rfun_scope. Infix "*" := mult_fct : Rfun_scope. Infix "-" := minus_fct : Rfun_scope. Infix "/" := div_fct : Rfun_scope. -Notation Local "f1 'o' f2" := (comp f1 f2) +Local Notation "f1 'o' f2" := (comp f1 f2) (at level 20, right associativity) : Rfun_scope. Notation "/ x" := (inv_fct x) : Rfun_scope. @@ -82,14 +82,14 @@ Lemma continuity_pt_plus : forall f1 f2 (x0:R), continuity_pt f1 x0 -> continuity_pt f2 x0 -> continuity_pt (f1 + f2) x0. Proof. - unfold continuity_pt, plus_fct in |- *; unfold continue_in in |- *; intros; + unfold continuity_pt, plus_fct; unfold continue_in; intros; apply limit_plus; assumption. Qed. Lemma continuity_pt_opp : forall f (x0:R), continuity_pt f x0 -> continuity_pt (- f) x0. Proof. - unfold continuity_pt, opp_fct in |- *; unfold continue_in in |- *; intros; + unfold continuity_pt, opp_fct; unfold continue_in; intros; apply limit_Ropp; assumption. Qed. @@ -97,7 +97,7 @@ Lemma continuity_pt_minus : forall f1 f2 (x0:R), continuity_pt f1 x0 -> continuity_pt f2 x0 -> continuity_pt (f1 - f2) x0. Proof. - unfold continuity_pt, minus_fct in |- *; unfold continue_in in |- *; intros; + unfold continuity_pt, minus_fct; unfold continue_in; intros; apply limit_minus; assumption. Qed. @@ -105,17 +105,17 @@ Lemma continuity_pt_mult : forall f1 f2 (x0:R), continuity_pt f1 x0 -> continuity_pt f2 x0 -> continuity_pt (f1 * f2) x0. Proof. - unfold continuity_pt, mult_fct in |- *; unfold continue_in in |- *; intros; + unfold continuity_pt, mult_fct; unfold continue_in; intros; apply limit_mul; assumption. Qed. Lemma continuity_pt_const : forall f (x0:R), constant f -> continuity_pt f x0. Proof. - unfold constant, continuity_pt in |- *; unfold continue_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; + unfold constant, continuity_pt; unfold continue_in; + unfold limit1_in; unfold limit_in; intros; exists 1; split; [ apply Rlt_0_1 - | intros; generalize (H x x0); intro; rewrite H2; simpl in |- *; + | intros; generalize (H x x0); intro; rewrite H2; simpl; rewrite R_dist_eq; assumption ]. Qed. @@ -123,9 +123,9 @@ Lemma continuity_pt_scal : forall f (a x0:R), continuity_pt f x0 -> continuity_pt (mult_real_fct a f) x0. Proof. - unfold continuity_pt, mult_real_fct in |- *; unfold continue_in in |- *; + unfold continuity_pt, mult_real_fct; unfold continue_in; intros; apply (limit_mul (fun x:R => a) f (D_x no_cond x0) a (f x0) x0). - unfold limit1_in in |- *; unfold limit_in in |- *; intros; exists 1; split. + unfold limit1_in; unfold limit_in; intros; exists 1; split. apply Rlt_0_1. intros; rewrite R_dist_eq; assumption. assumption. @@ -136,9 +136,9 @@ Lemma continuity_pt_inv : Proof. intros. replace (/ f)%F with (fun x:R => / f x). - unfold continuity_pt in |- *; unfold continue_in in |- *; intros; + unfold continuity_pt; unfold continue_in; intros; apply limit_inv; assumption. - unfold inv_fct in |- *; reflexivity. + unfold inv_fct; reflexivity. Qed. Lemma div_eq_inv : forall f1 f2, (f1 / f2)%F = (f1 * / f2)%F. @@ -159,8 +159,8 @@ Lemma continuity_pt_comp : forall f1 f2 (x:R), continuity_pt f1 x -> continuity_pt f2 (f1 x) -> continuity_pt (f2 o f1) x. Proof. - unfold continuity_pt in |- *; unfold continue_in in |- *; intros; - unfold comp in |- *. + unfold continuity_pt; unfold continue_in; intros; + unfold comp. cut (limit1_in (fun x0:R => f2 (f1 x0)) (Dgf (D_x no_cond x) (D_x no_cond (f1 x)) f1) ( @@ -170,23 +170,23 @@ Proof. eapply limit_comp. apply H. apply H0. - unfold limit1_in in |- *; unfold limit_in in |- *; unfold dist in |- *; - simpl in |- *; unfold R_dist in |- *; intros. + unfold limit1_in; unfold limit_in; unfold dist; + simpl; unfold R_dist; intros. assert (H3 := H1 eps H2). elim H3; intros. exists x0. split. elim H4; intros; assumption. intros; case (Req_dec (f1 x) (f1 x1)); intro. - rewrite H6; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + rewrite H6; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. elim H4; intros; apply H8. split. - unfold Dgf, D_x, no_cond in |- *. + unfold Dgf, D_x, no_cond. split. split. trivial. - elim H5; unfold D_x, no_cond in |- *; intros. + elim H5; unfold D_x, no_cond; intros. elim H9; intros; assumption. split. trivial. @@ -198,44 +198,44 @@ Qed. Lemma continuity_plus : forall f1 f2, continuity f1 -> continuity f2 -> continuity (f1 + f2). Proof. - unfold continuity in |- *; intros; + unfold continuity; intros; apply (continuity_pt_plus f1 f2 x (H x) (H0 x)). Qed. Lemma continuity_opp : forall f, continuity f -> continuity (- f). Proof. - unfold continuity in |- *; intros; apply (continuity_pt_opp f x (H x)). + unfold continuity; intros; apply (continuity_pt_opp f x (H x)). Qed. Lemma continuity_minus : forall f1 f2, continuity f1 -> continuity f2 -> continuity (f1 - f2). Proof. - unfold continuity in |- *; intros; + unfold continuity; intros; apply (continuity_pt_minus f1 f2 x (H x) (H0 x)). Qed. Lemma continuity_mult : forall f1 f2, continuity f1 -> continuity f2 -> continuity (f1 * f2). Proof. - unfold continuity in |- *; intros; + unfold continuity; intros; apply (continuity_pt_mult f1 f2 x (H x) (H0 x)). Qed. Lemma continuity_const : forall f, constant f -> continuity f. Proof. - unfold continuity in |- *; intros; apply (continuity_pt_const f x H). + unfold continuity; intros; apply (continuity_pt_const f x H). Qed. Lemma continuity_scal : forall f (a:R), continuity f -> continuity (mult_real_fct a f). Proof. - unfold continuity in |- *; intros; apply (continuity_pt_scal f a x (H x)). + unfold continuity; intros; apply (continuity_pt_scal f a x (H x)). Qed. Lemma continuity_inv : forall f, continuity f -> (forall x:R, f x <> 0) -> continuity (/ f). Proof. - unfold continuity in |- *; intros; apply (continuity_pt_inv f x (H x) (H0 x)). + unfold continuity; intros; apply (continuity_pt_inv f x (H x) (H0 x)). Qed. Lemma continuity_div : @@ -243,14 +243,14 @@ Lemma continuity_div : continuity f1 -> continuity f2 -> (forall x:R, f2 x <> 0) -> continuity (f1 / f2). Proof. - unfold continuity in |- *; intros; + unfold continuity; intros; apply (continuity_pt_div f1 f2 x (H x) (H0 x) (H1 x)). Qed. Lemma continuity_comp : forall f1 f2, continuity f1 -> continuity f2 -> continuity (f2 o f1). Proof. - unfold continuity in |- *; intros. + unfold continuity; intros. apply (continuity_pt_comp f1 f2 x (H x) (H0 (f1 x))). Qed. @@ -307,23 +307,23 @@ Proof. apply (single_limit (fun h:R => (f (x + h) - f x) / h) ( fun h:R => h <> 0) l1 l2 0); try assumption. - unfold adhDa in |- *; intros; exists (alp / 2). + unfold adhDa; intros; exists (alp / 2). split. - unfold Rdiv in |- *; apply prod_neq_R0. - red in |- *; intro; rewrite H2 in H1; elim (Rlt_irrefl _ H1). + unfold Rdiv; apply prod_neq_R0. + red; intro; rewrite H2 in H1; elim (Rlt_irrefl _ H1). apply Rinv_neq_0_compat; discrR. - unfold R_dist in |- *; unfold Rminus in |- *; rewrite Ropp_0; - rewrite Rplus_0_r; unfold Rdiv in |- *; rewrite Rabs_mult. + unfold R_dist; unfold Rminus; rewrite Ropp_0; + rewrite Rplus_0_r; unfold Rdiv; rewrite Rabs_mult. replace (Rabs (/ 2)) with (/ 2). replace (Rabs alp) with alp. apply Rmult_lt_reg_l with 2. prove_sup0. rewrite (Rmult_comm 2); rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ idtac | discrR ]; rewrite Rmult_1_r; rewrite double; - pattern alp at 1 in |- *; replace alp with (alp + 0); + pattern alp at 1; replace alp with (alp + 0); [ idtac | ring ]; apply Rplus_lt_compat_l; assumption. - symmetry in |- *; apply Rabs_right; left; assumption. - symmetry in |- *; apply Rabs_right; left; change (0 < / 2) in |- *; + symmetry ; apply Rabs_right; left; assumption. + symmetry ; apply Rabs_right; left; change (0 < / 2); apply Rinv_0_lt_compat; prove_sup0. Qed. @@ -332,14 +332,14 @@ Lemma uniqueness_step2 : derivable_pt_lim f x l -> limit1_in (fun h:R => (f (x + h) - f x) / h) (fun h:R => h <> 0) l 0. Proof. - unfold derivable_pt_lim in |- *; intros; unfold limit1_in in |- *; - unfold limit_in in |- *; intros. + unfold derivable_pt_lim; intros; unfold limit1_in; + unfold limit_in; intros. assert (H1 := H eps H0). elim H1; intros. exists (pos x0). split. apply (cond_pos x0). - simpl in |- *; unfold R_dist in |- *; intros. + simpl; unfold R_dist; intros. elim H3; intros. apply H2; [ assumption @@ -352,15 +352,15 @@ Lemma uniqueness_step3 : limit1_in (fun h:R => (f (x + h) - f x) / h) (fun h:R => h <> 0) l 0 -> derivable_pt_lim f x l. Proof. - unfold limit1_in, derivable_pt_lim in |- *; unfold limit_in in |- *; - unfold dist in |- *; simpl in |- *; intros. + unfold limit1_in, derivable_pt_lim; unfold limit_in; + unfold dist; simpl; intros. elim (H eps H0). intros; elim H1; intros. exists (mkposreal x0 H2). - simpl in |- *; intros; unfold R_dist in H3; apply (H3 h). + simpl; intros; unfold R_dist in H3; apply (H3 h). split; [ assumption - | unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; assumption ]. + | unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; assumption ]. Qed. Lemma uniqueness_limite : @@ -383,8 +383,8 @@ Proof. assumption. intro; assert (H1 := proj2_sig pr); unfold derivable_pt_abs in H1. assert (H2 := uniqueness_limite _ _ _ _ H H1). - unfold derive_pt in |- *; unfold derivable_pt_abs in |- *. - symmetry in |- *; assumption. + unfold derive_pt; unfold derivable_pt_abs. + symmetry ; assumption. Qed. (**********) @@ -414,25 +414,25 @@ Lemma derive_pt_D_in : D_in f df no_cond x <-> derive_pt f x pr = df x. Proof. intros; split. - unfold D_in in |- *; unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold R_dist in |- *; intros. + unfold D_in; unfold limit1_in; unfold limit_in; + simpl; unfold R_dist; intros. apply derive_pt_eq_0. - unfold derivable_pt_lim in |- *. + unfold derivable_pt_lim. intros; elim (H eps H0); intros alpha H1; elim H1; intros; exists (mkposreal alpha H2); intros; generalize (H3 (x + h)); intro; cut (x + h - x = h); [ intro; cut (D_x no_cond x (x + h) /\ Rabs (x + h - x) < alpha); [ intro; generalize (H6 H8); rewrite H7; intro; assumption | split; - [ unfold D_x in |- *; split; - [ unfold no_cond in |- *; trivial + [ unfold D_x; split; + [ unfold no_cond; trivial | apply Rminus_not_eq_right; rewrite H7; assumption ] | rewrite H7; assumption ] ] | ring ]. intro. assert (H0 := derive_pt_eq_1 f x (df x) pr H). - unfold D_in in |- *; unfold limit1_in in |- *; unfold limit_in in |- *; - unfold dist in |- *; simpl in |- *; unfold R_dist in |- *; + unfold D_in; unfold limit1_in; unfold limit_in; + unfold dist; simpl; unfold R_dist; intros. elim (H0 eps H1); intros alpha H2; exists (pos alpha); split. apply (cond_pos alpha). @@ -448,24 +448,24 @@ Lemma derivable_pt_lim_D_in : D_in f df no_cond x <-> derivable_pt_lim f x (df x). Proof. intros; split. - unfold D_in in |- *; unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold R_dist in |- *; intros. - unfold derivable_pt_lim in |- *. + unfold D_in; unfold limit1_in; unfold limit_in; + simpl; unfold R_dist; intros. + unfold derivable_pt_lim. intros; elim (H eps H0); intros alpha H1; elim H1; intros; exists (mkposreal alpha H2); intros; generalize (H3 (x + h)); intro; cut (x + h - x = h); [ intro; cut (D_x no_cond x (x + h) /\ Rabs (x + h - x) < alpha); [ intro; generalize (H6 H8); rewrite H7; intro; assumption | split; - [ unfold D_x in |- *; split; - [ unfold no_cond in |- *; trivial + [ unfold D_x; split; + [ unfold no_cond; trivial | apply Rminus_not_eq_right; rewrite H7; assumption ] | rewrite H7; assumption ] ] | ring ]. intro. unfold derivable_pt_lim in H. - unfold D_in in |- *; unfold limit1_in in |- *; unfold limit_in in |- *; - unfold dist in |- *; simpl in |- *; unfold R_dist in |- *; + unfold D_in; unfold limit1_in; unfold limit_in; + unfold dist; simpl; unfold R_dist; intros. elim (H eps H0); intros alpha H2; exists (pos alpha); split. apply (cond_pos alpha). @@ -486,7 +486,7 @@ Lemma derivable_derive : forall f (x:R) (pr:derivable_pt f x), exists l : R, derive_pt f x pr = l. Proof. intros; exists (proj1_sig pr). - unfold derive_pt in |- *; reflexivity. + unfold derive_pt; reflexivity. Qed. Theorem derivable_continuous_pt : @@ -501,14 +501,14 @@ Proof. generalize (derive_pt_D_in f (fct_cte l) x); intro. elim (H2 X); intros. generalize (H4 H1); intro. - unfold continuity_pt in |- *. + unfold continuity_pt. apply (cont_deriv f (fct_cte l) no_cond x H5). - unfold fct_cte in |- *; reflexivity. + unfold fct_cte; reflexivity. Qed. Theorem derivable_continuous : forall f, derivable f -> continuity f. Proof. - unfold derivable, continuity in |- *; intros f X x. + unfold derivable, continuity; intros f X x. apply (derivable_continuous_pt f x (X x)). Qed. @@ -524,7 +524,7 @@ Lemma derivable_pt_lim_plus : apply uniqueness_step3. assert (H1 := uniqueness_step2 _ _ _ H). assert (H2 := uniqueness_step2 _ _ _ H0). - unfold plus_fct in |- *. + unfold plus_fct. cut (forall h:R, (f1 (x + h) + f2 (x + h) - (f1 x + f2 x)) / h = @@ -533,15 +533,15 @@ Lemma derivable_pt_lim_plus : generalize (limit_plus (fun h':R => (f1 (x + h') - f1 x) / h') (fun h':R => (f2 (x + h') - f2 x) / h') (fun h:R => h <> 0) l1 l2 0 H1 H2). - unfold limit1_in in |- *; unfold limit_in in |- *; unfold dist in |- *; - simpl in |- *; unfold R_dist in |- *; intros. + unfold limit1_in; unfold limit_in; unfold dist; + simpl; unfold R_dist; intros. elim (H4 eps H5); intros. exists x0. elim H6; intros. split. assumption. intros; rewrite H3; apply H8; assumption. - intro; unfold Rdiv in |- *; ring. + intro; unfold Rdiv; ring. Qed. Lemma derivable_pt_lim_opp : @@ -550,20 +550,20 @@ Proof. intros. apply uniqueness_step3. assert (H1 := uniqueness_step2 _ _ _ H). - unfold opp_fct in |- *. + unfold opp_fct. cut (forall h:R, (- f (x + h) - - f x) / h = - ((f (x + h) - f x) / h)). intro. generalize (limit_Ropp (fun h:R => (f (x + h) - f x) / h) (fun h:R => h <> 0) l 0 H1). - unfold limit1_in in |- *; unfold limit_in in |- *; unfold dist in |- *; - simpl in |- *; unfold R_dist in |- *; intros. + unfold limit1_in; unfold limit_in; unfold dist; + simpl; unfold R_dist; intros. elim (H2 eps H3); intros. exists x0. elim H4; intros. split. assumption. intros; rewrite H0; apply H6; assumption. - intro; unfold Rdiv in |- *; ring. + intro; unfold Rdiv; ring. Qed. Lemma derivable_pt_lim_minus : @@ -575,7 +575,7 @@ Proof. apply uniqueness_step3. assert (H1 := uniqueness_step2 _ _ _ H). assert (H2 := uniqueness_step2 _ _ _ H0). - unfold minus_fct in |- *. + unfold minus_fct. cut (forall h:R, (f1 (x + h) - f1 x) / h - (f2 (x + h) - f2 x) / h = @@ -584,15 +584,15 @@ Proof. generalize (limit_minus (fun h':R => (f1 (x + h') - f1 x) / h') (fun h':R => (f2 (x + h') - f2 x) / h') (fun h:R => h <> 0) l1 l2 0 H1 H2). - unfold limit1_in in |- *; unfold limit_in in |- *; unfold dist in |- *; - simpl in |- *; unfold R_dist in |- *; intros. + unfold limit1_in; unfold limit_in; unfold dist; + simpl; unfold R_dist; intros. elim (H4 eps H5); intros. exists x0. elim H6; intros. split. assumption. intros; rewrite <- H3; apply H8; assumption. - intro; unfold Rdiv in |- *; ring. + intro; unfold Rdiv; ring. Qed. Lemma derivable_pt_lim_mult : @@ -615,15 +615,15 @@ Proof. elim H1; intros. clear H1 H3. apply H2. - unfold mult_fct in |- *. + unfold mult_fct. apply (Dmult no_cond (fun y:R => l1) (fun y:R => l2) f1 f2 x); assumption. Qed. Lemma derivable_pt_lim_const : forall a x:R, derivable_pt_lim (fct_cte a) x 0. Proof. - intros; unfold fct_cte, derivable_pt_lim in |- *. - intros; exists (mkposreal 1 Rlt_0_1); intros; unfold Rminus in |- *; - rewrite Rplus_opp_r; unfold Rdiv in |- *; rewrite Rmult_0_l; + intros; unfold fct_cte, derivable_pt_lim. + intros; exists (mkposreal 1 Rlt_0_1); intros; unfold Rminus; + rewrite Rplus_opp_r; unfold Rdiv; rewrite Rmult_0_l; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. Qed. @@ -636,34 +636,34 @@ Proof. replace (mult_real_fct a f) with (fct_cte a * f)%F. replace (a * l) with (0 * f x + a * l); [ idtac | ring ]. apply (derivable_pt_lim_mult (fct_cte a) f x 0 l); assumption. - unfold mult_real_fct, mult_fct, fct_cte in |- *; reflexivity. + unfold mult_real_fct, mult_fct, fct_cte; reflexivity. Qed. Lemma derivable_pt_lim_id : forall x:R, derivable_pt_lim id x 1. Proof. - intro; unfold derivable_pt_lim in |- *. + intro; unfold derivable_pt_lim. intros eps Heps; exists (mkposreal eps Heps); intros h H1 H2; - unfold id in |- *; replace ((x + h - x) / h - 1) with 0. + unfold id; replace ((x + h - x) / h - 1) with 0. rewrite Rabs_R0; apply Rle_lt_trans with (Rabs h). apply Rabs_pos. assumption. - unfold Rminus in |- *; rewrite Rplus_assoc; rewrite (Rplus_comm x); + unfold Rminus; rewrite Rplus_assoc; rewrite (Rplus_comm x); rewrite Rplus_assoc. - rewrite Rplus_opp_l; rewrite Rplus_0_r; unfold Rdiv in |- *; + rewrite Rplus_opp_l; rewrite Rplus_0_r; unfold Rdiv; rewrite <- Rinv_r_sym. - symmetry in |- *; apply Rplus_opp_r. + symmetry ; apply Rplus_opp_r. assumption. Qed. Lemma derivable_pt_lim_Rsqr : forall x:R, derivable_pt_lim Rsqr x (2 * x). Proof. - intro; unfold derivable_pt_lim in |- *. - unfold Rsqr in |- *; intros eps Heps; exists (mkposreal eps Heps); + intro; unfold derivable_pt_lim. + unfold Rsqr; intros eps Heps; exists (mkposreal eps Heps); intros h H1 H2; replace (((x + h) * (x + h) - x * x) / h - 2 * x) with h. assumption. replace ((x + h) * (x + h) - x * x) with (2 * x * h + h * h); [ idtac | ring ]. - unfold Rdiv in |- *; rewrite Rmult_plus_distr_r. + unfold Rdiv; rewrite Rmult_plus_distr_r. repeat rewrite Rmult_assoc. repeat rewrite <- Rinv_r_sym; [ idtac | assumption ]. ring. @@ -684,7 +684,7 @@ Proof. assert (H1 := derivable_pt_lim_D_in (f2 o f1)%F (fun y:R => l2 * l1) x). elim H1; intros. clear H1 H3; apply H2. - unfold comp in |- *; + unfold comp; cut (D_in (fun x0:R => f2 (f1 x0)) (fun y:R => l2 * l1) (Dgf no_cond no_cond f1) x -> @@ -693,14 +693,14 @@ Proof. rewrite Rmult_comm; apply (Dcomp no_cond no_cond (fun y:R => l1) (fun y:R => l2) f1 f2 x); assumption. - unfold Dgf, D_in, no_cond in |- *; unfold limit1_in in |- *; - unfold limit_in in |- *; unfold dist in |- *; simpl in |- *; - unfold R_dist in |- *; intros. + unfold Dgf, D_in, no_cond; unfold limit1_in; + unfold limit_in; unfold dist; simpl; + unfold R_dist; intros. elim (H1 eps H3); intros. exists x0; intros; split. elim H5; intros; assumption. intros; elim H5; intros; apply H9; split. - unfold D_x in |- *; split. + unfold D_x; split. split; trivial. elim H6; intros; unfold D_x in H10; elim H10; intros; assumption. elim H6; intros; assumption. @@ -710,7 +710,7 @@ Lemma derivable_pt_plus : forall f1 f2 (x:R), derivable_pt f1 x -> derivable_pt f2 x -> derivable_pt (f1 + f2) x. Proof. - unfold derivable_pt in |- *; intros f1 f2 x X X0. + unfold derivable_pt; intros f1 f2 x X X0. elim X; intros. elim X0; intros. exists (x0 + x1). @@ -720,7 +720,7 @@ Qed. Lemma derivable_pt_opp : forall f (x:R), derivable_pt f x -> derivable_pt (- f) x. Proof. - unfold derivable_pt in |- *; intros f x X. + unfold derivable_pt; intros f x X. elim X; intros. exists (- x0). apply derivable_pt_lim_opp; assumption. @@ -730,7 +730,7 @@ Lemma derivable_pt_minus : forall f1 f2 (x:R), derivable_pt f1 x -> derivable_pt f2 x -> derivable_pt (f1 - f2) x. Proof. - unfold derivable_pt in |- *; intros f1 f2 x X X0. + unfold derivable_pt; intros f1 f2 x X X0. elim X; intros. elim X0; intros. exists (x0 - x1). @@ -741,7 +741,7 @@ Lemma derivable_pt_mult : forall f1 f2 (x:R), derivable_pt f1 x -> derivable_pt f2 x -> derivable_pt (f1 * f2) x. Proof. - unfold derivable_pt in |- *; intros f1 f2 x X X0. + unfold derivable_pt; intros f1 f2 x X X0. elim X; intros. elim X0; intros. exists (x0 * f2 x + f1 x * x1). @@ -750,7 +750,7 @@ Qed. Lemma derivable_pt_const : forall a x:R, derivable_pt (fct_cte a) x. Proof. - intros; unfold derivable_pt in |- *. + intros; unfold derivable_pt. exists 0. apply derivable_pt_lim_const. Qed. @@ -758,7 +758,7 @@ Qed. Lemma derivable_pt_scal : forall f (a x:R), derivable_pt f x -> derivable_pt (mult_real_fct a f) x. Proof. - unfold derivable_pt in |- *; intros f1 a x X. + unfold derivable_pt; intros f1 a x X. elim X; intros. exists (a * x0). apply derivable_pt_lim_scal; assumption. @@ -766,14 +766,14 @@ Qed. Lemma derivable_pt_id : forall x:R, derivable_pt id x. Proof. - unfold derivable_pt in |- *; intro. + unfold derivable_pt; intro. exists 1. apply derivable_pt_lim_id. Qed. Lemma derivable_pt_Rsqr : forall x:R, derivable_pt Rsqr x. Proof. - unfold derivable_pt in |- *; intro; exists (2 * x). + unfold derivable_pt; intro; exists (2 * x). apply derivable_pt_lim_Rsqr. Qed. @@ -781,7 +781,7 @@ Lemma derivable_pt_comp : forall f1 f2 (x:R), derivable_pt f1 x -> derivable_pt f2 (f1 x) -> derivable_pt (f2 o f1) x. Proof. - unfold derivable_pt in |- *; intros f1 f2 x X X0. + unfold derivable_pt; intros f1 f2 x X X0. elim X; intros. elim X0; intros. exists (x1 * x0). @@ -791,57 +791,57 @@ Qed. Lemma derivable_plus : forall f1 f2, derivable f1 -> derivable f2 -> derivable (f1 + f2). Proof. - unfold derivable in |- *; intros f1 f2 X X0 x. + unfold derivable; intros f1 f2 X X0 x. apply (derivable_pt_plus _ _ x (X _) (X0 _)). Qed. Lemma derivable_opp : forall f, derivable f -> derivable (- f). Proof. - unfold derivable in |- *; intros f X x. + unfold derivable; intros f X x. apply (derivable_pt_opp _ x (X _)). Qed. Lemma derivable_minus : forall f1 f2, derivable f1 -> derivable f2 -> derivable (f1 - f2). Proof. - unfold derivable in |- *; intros f1 f2 X X0 x. + unfold derivable; intros f1 f2 X X0 x. apply (derivable_pt_minus _ _ x (X _) (X0 _)). Qed. Lemma derivable_mult : forall f1 f2, derivable f1 -> derivable f2 -> derivable (f1 * f2). Proof. - unfold derivable in |- *; intros f1 f2 X X0 x. + unfold derivable; intros f1 f2 X X0 x. apply (derivable_pt_mult _ _ x (X _) (X0 _)). Qed. Lemma derivable_const : forall a:R, derivable (fct_cte a). Proof. - unfold derivable in |- *; intros. + unfold derivable; intros. apply derivable_pt_const. Qed. Lemma derivable_scal : forall f (a:R), derivable f -> derivable (mult_real_fct a f). Proof. - unfold derivable in |- *; intros f a X x. + unfold derivable; intros f a X x. apply (derivable_pt_scal _ a x (X _)). Qed. Lemma derivable_id : derivable id. Proof. - unfold derivable in |- *; intro; apply derivable_pt_id. + unfold derivable; intro; apply derivable_pt_id. Qed. Lemma derivable_Rsqr : derivable Rsqr. Proof. - unfold derivable in |- *; intro; apply derivable_pt_Rsqr. + unfold derivable; intro; apply derivable_pt_Rsqr. Qed. Lemma derivable_comp : forall f1 f2, derivable f1 -> derivable f2 -> derivable (f2 o f1). Proof. - unfold derivable in |- *; intros f1 f2 X X0 x. + unfold derivable; intros f1 f2 X X0 x. apply (derivable_pt_comp _ _ x (X _) (X0 _)). Qed. @@ -996,13 +996,13 @@ Proof. elim (lt_irrefl _ H). cut (n = 0%nat \/ (0 < n)%nat). intro; elim H0; intro. - rewrite H1; simpl in |- *. + rewrite H1; simpl. replace (fun y:R => y * 1) with (id * fct_cte 1)%F. replace (1 * 1) with (1 * fct_cte 1 x + id x * 0). apply derivable_pt_lim_mult. apply derivable_pt_lim_id. apply derivable_pt_lim_const. - unfold fct_cte, id in |- *; ring. + unfold fct_cte, id; ring. reflexivity. replace (fun y:R => y ^ S n) with (fun y:R => y * y ^ n). replace (pred (S n)) with n; [ idtac | reflexivity ]. @@ -1011,13 +1011,13 @@ Proof. replace (INR (S n) * x ^ n) with (1 * f x + id x * (INR n * x ^ pred n)). apply derivable_pt_lim_mult. apply derivable_pt_lim_id. - unfold f in |- *; apply Hrecn; assumption. - unfold f in |- *. - pattern n at 1 5 in |- *; replace n with (S (pred n)). - unfold id in |- *; rewrite S_INR; simpl in |- *. + unfold f; apply Hrecn; assumption. + unfold f. + pattern n at 1 5; replace n with (S (pred n)). + unfold id; rewrite S_INR; simpl. ring. - symmetry in |- *; apply S_pred with 0%nat; assumption. - unfold mult_fct, id in |- *; reflexivity. + symmetry ; apply S_pred with 0%nat; assumption. + unfold mult_fct, id; reflexivity. reflexivity. inversion H. left; reflexivity. @@ -1033,7 +1033,7 @@ Lemma derivable_pt_lim_pow : Proof. intros. induction n as [| n Hrecn]. - simpl in |- *. + simpl. rewrite Rmult_0_l. replace (fun _:R => 1) with (fct_cte 1); [ apply derivable_pt_lim_const | reflexivity ]. @@ -1044,14 +1044,14 @@ Qed. Lemma derivable_pt_pow : forall (n:nat) (x:R), derivable_pt (fun y:R => y ^ n) x. Proof. - intros; unfold derivable_pt in |- *. + intros; unfold derivable_pt. exists (INR n * x ^ pred n). apply derivable_pt_lim_pow. Qed. Lemma derivable_pow : forall n:nat, derivable (fun y:R => y ^ n). Proof. - intro; unfold derivable in |- *; intro; apply derivable_pt_pow. + intro; unfold derivable; intro; apply derivable_pt_pow. Qed. Lemma derive_pt_pow : @@ -1073,7 +1073,7 @@ Proof. elim pr2; intros. unfold derivable_pt_abs in p. unfold derivable_pt_abs in p0. - simpl in |- *. + simpl. apply (uniqueness_limite f x x0 x1 p p0). Qed. @@ -1094,7 +1094,7 @@ Proof. assert (H5 := derive_pt_eq_1 f c l pr H4). cut (0 < l / 2); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ] ]. elim (H5 (l / 2) H6); intros delta H7. cut (0 < (b - c) / 2). @@ -1119,7 +1119,7 @@ Proof. (Rabs ((f (c + Rmin (delta / 2) ((b + - c) / 2)) + - f c) / Rmin (delta / 2) ((b + - c) / 2) + - l) < l / 2). - unfold Rabs in |- *; + unfold Rabs; case (Rcase_abs ((f (c + Rmin (delta / 2) ((b + - c) / 2)) + - f c) / @@ -1157,7 +1157,7 @@ Proof. (Rlt_le_trans 0 ((f (c + Rmin (delta / 2) ((b + - c) / 2)) + - f c) / Rmin (delta / 2) ((b + - c) / 2)) 0 H22 H16)). - pattern l at 2 in |- *; rewrite double_var. + pattern l at 2; rewrite double_var. ring. ring. intro. @@ -1183,7 +1183,7 @@ Proof. l + - ((f (c + Rmin (delta / 2) ((b + - c) / 2)) - f c) / - Rmin (delta / 2) ((b + - c) / 2))) in |- *; apply Rplus_lt_le_0_compat; + Rmin (delta / 2) ((b + - c) / 2))); apply Rplus_lt_le_0_compat; [ assumption | rewrite <- Ropp_0; apply Ropp_ge_le_contravar; apply Rle_ge; assumption ]. unfold Rminus; ring. @@ -1195,13 +1195,13 @@ Proof. ((f c - f (c + Rmin (delta / 2) ((b - c) / 2))) / Rmin (delta / 2) ((b - c) / 2))). rewrite <- Ropp_0; apply Ropp_ge_le_contravar; apply Rle_ge; - unfold Rdiv in |- *; apply Rmult_le_pos; + unfold Rdiv; apply Rmult_le_pos; [ generalize (Rplus_le_compat_r (- f (c + Rmin (delta * / 2) ((b - c) * / 2))) (f (c + Rmin (delta * / 2) ((b - c) * / 2))) ( f c) H15); rewrite Rplus_opp_r; intro; assumption | left; apply Rinv_0_lt_compat; assumption ]. - unfold Rdiv in |- *. + unfold Rdiv. rewrite <- Ropp_mult_distr_l_reverse. repeat rewrite <- (Rmult_comm (/ Rmin (delta * / 2) ((b - c) * / 2))). apply Rmult_eq_reg_l with (Rmin (delta * / 2) ((b - c) * / 2)). @@ -1209,9 +1209,9 @@ Proof. rewrite <- Rinv_r_sym. repeat rewrite Rmult_1_l. ring. - red in |- *; intro. + red; intro. unfold Rdiv in H12; rewrite H16 in H12; elim (Rlt_irrefl 0 H12). - red in |- *; intro. + red; intro. unfold Rdiv in H12; rewrite H16 in H12; elim (Rlt_irrefl 0 H12). assert (H14 := Rmin_r (delta / 2) ((b - c) / 2)). assert @@ -1225,7 +1225,7 @@ Proof. replace (2 * b) with (b + b). apply Rplus_lt_compat_r; assumption. ring. - unfold Rdiv in |- *; rewrite Rmult_plus_distr_l. + unfold Rdiv; rewrite Rmult_plus_distr_l. repeat rewrite (Rmult_comm 2). rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r. @@ -1233,51 +1233,51 @@ Proof. discrR. apply Rlt_trans with c. assumption. - pattern c at 1 in |- *; rewrite <- (Rplus_0_r c); apply Rplus_lt_compat_l; + pattern c at 1; rewrite <- (Rplus_0_r c); apply Rplus_lt_compat_l; assumption. cut (0 < delta / 2). intro; apply (Rmin_stable_in_posreal (mkposreal (delta / 2) H12) (mkposreal ((b - c) / 2) H8)). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos delta) | apply Rinv_0_lt_compat; prove_sup0 ]. - unfold Rabs in |- *; case (Rcase_abs (Rmin (delta / 2) ((b - c) / 2))). + unfold Rabs; case (Rcase_abs (Rmin (delta / 2) ((b - c) / 2))). intro. cut (0 < delta / 2). intro. generalize (Rmin_stable_in_posreal (mkposreal (delta / 2) H10) - (mkposreal ((b - c) / 2) H8)); simpl in |- *; intro; + (mkposreal ((b - c) / 2) H8)); simpl; intro; elim (Rlt_irrefl 0 (Rlt_trans 0 (Rmin (delta / 2) ((b - c) / 2)) 0 H11 r)). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos delta) | apply Rinv_0_lt_compat; prove_sup0 ]. intro; apply Rle_lt_trans with (delta / 2). apply Rmin_l. - unfold Rdiv in |- *; apply Rmult_lt_reg_l with 2. + unfold Rdiv; apply Rmult_lt_reg_l with 2. prove_sup0. rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_l. replace (2 * delta) with (delta + delta). - pattern delta at 2 in |- *; rewrite <- (Rplus_0_r delta); + pattern delta at 2; rewrite <- (Rplus_0_r delta); apply Rplus_lt_compat_l. rewrite Rplus_0_r; apply (cond_pos delta). - symmetry in |- *; apply double. + symmetry ; apply double. discrR. cut (0 < delta / 2). intro; generalize (Rmin_stable_in_posreal (mkposreal (delta / 2) H9) - (mkposreal ((b - c) / 2) H8)); simpl in |- *; - intro; red in |- *; intro; rewrite H11 in H10; elim (Rlt_irrefl 0 H10). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + (mkposreal ((b - c) / 2) H8)); simpl; + intro; red; intro; rewrite H11 in H10; elim (Rlt_irrefl 0 H10). + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos delta) | apply Rinv_0_lt_compat; prove_sup0 ]. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. generalize (Rplus_lt_compat_r (- c) c b H0); rewrite Rplus_opp_r; intro; assumption. apply Rinv_0_lt_compat; prove_sup0. elim H2; intro. - symmetry in |- *; assumption. + symmetry ; assumption. generalize (derivable_derive f c pr); intro; elim H4; intros l H5. rewrite H5 in H3; generalize (derive_pt_eq_1 f c l pr H5); intro; cut (0 < - (l / 2)). @@ -1307,7 +1307,7 @@ Proof. ((f (c + Rmax (- (delta / 2)) ((a + - c) / 2)) + - f c) / Rmax (- (delta / 2)) ((a + - c) / 2) + - l) < - (l / 2)). - unfold Rabs in |- *; + unfold Rabs; case (Rcase_abs ((f (c + Rmax (- (delta / 2)) ((a + - c) / 2)) + - f c) / @@ -1339,12 +1339,12 @@ Proof. Rmax (- (delta / 2)) ((a - c) / 2)) 0 H17 H23)). rewrite <- (Ropp_involutive (l / 2)); rewrite <- Ropp_0; apply Ropp_lt_gt_contravar; assumption. - pattern l at 3 in |- *; rewrite double_var. + pattern l at 3; rewrite double_var. ring. assumption. apply Rplus_le_lt_0_compat; assumption. rewrite <- Ropp_0; apply Ropp_lt_gt_contravar; assumption. - unfold Rdiv in |- *; + unfold Rdiv; replace ((f (c + Rmax (- (delta * / 2)) ((a - c) * / 2)) - f c) * / Rmax (- (delta * / 2)) ((a - c) * / 2)) with @@ -1361,7 +1361,7 @@ Proof. ring. left; apply Rinv_0_lt_compat; rewrite <- Ropp_0; apply Ropp_lt_gt_contravar; assumption. - unfold Rdiv in |- *. + unfold Rdiv. rewrite <- Ropp_inv_permute. rewrite Rmult_opp_opp. reflexivity. @@ -1380,7 +1380,7 @@ Proof. apply Rplus_lt_compat_l; assumption. field; discrR. assumption. - unfold Rabs in |- *; case (Rcase_abs (Rmax (- (delta / 2)) ((a - c) / 2))). + unfold Rabs; case (Rcase_abs (Rmax (- (delta / 2)) ((a - c) / 2))). intro; generalize (RmaxLess1 (- (delta / 2)) ((a - c) / 2)); intro; generalize (Ropp_le_ge_contravar (- (delta / 2)) (Rmax (- (delta / 2)) ((a - c) / 2)) @@ -1390,10 +1390,10 @@ Proof. assumption. apply Rmult_lt_reg_l with 2. prove_sup0. - unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_l; rewrite double. - pattern delta at 2 in |- *; rewrite <- (Rplus_0_r delta); + pattern delta at 2; rewrite <- (Rplus_0_r delta); apply Rplus_lt_compat_l; rewrite Rplus_0_r; apply (cond_pos delta). discrR. cut (- (delta / 2) < 0). @@ -1401,7 +1401,7 @@ Proof. intros; generalize (Rmax_stable_in_negreal (mknegreal (- (delta / 2)) H13) - (mknegreal ((a - c) / 2) H12)); simpl in |- *; + (mknegreal ((a - c) / 2) H12)); simpl; intro; generalize (Rge_le (Rmax (- (delta / 2)) ((a - c) / 2)) 0 r); intro; elim @@ -1410,41 +1410,41 @@ Proof. rewrite <- Ropp_0; rewrite <- (Ropp_involutive ((a - c) / 2)); apply Ropp_lt_gt_contravar; replace (- ((a - c) / 2)) with ((c - a) / 2). assumption. - unfold Rdiv in |- *. + unfold Rdiv. rewrite <- Ropp_mult_distr_l_reverse. rewrite (Ropp_minus_distr a c). reflexivity. - rewrite <- Ropp_0; apply Ropp_lt_gt_contravar; unfold Rdiv in |- *; + rewrite <- Ropp_0; apply Ropp_lt_gt_contravar; unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos delta) | assert (Hyp : 0 < 2); [ prove_sup0 | apply (Rinv_0_lt_compat 2 Hyp) ] ]. - red in |- *; intro; rewrite H11 in H10; elim (Rlt_irrefl 0 H10). + red; intro; rewrite H11 in H10; elim (Rlt_irrefl 0 H10). cut ((a - c) / 2 < 0). intro; cut (- (delta / 2) < 0). intro; apply (Rmax_stable_in_negreal (mknegreal (- (delta / 2)) H11) (mknegreal ((a - c) / 2) H10)). - rewrite <- Ropp_0; apply Ropp_lt_gt_contravar; unfold Rdiv in |- *; + rewrite <- Ropp_0; apply Ropp_lt_gt_contravar; unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos delta) | assert (Hyp : 0 < 2); [ prove_sup0 | apply (Rinv_0_lt_compat 2 Hyp) ] ]. rewrite <- Ropp_0; rewrite <- (Ropp_involutive ((a - c) / 2)); apply Ropp_lt_gt_contravar; replace (- ((a - c) / 2)) with ((c - a) / 2). assumption. - unfold Rdiv in |- *. + unfold Rdiv. rewrite <- Ropp_mult_distr_l_reverse. rewrite (Ropp_minus_distr a c). reflexivity. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ generalize (Rplus_lt_compat_r (- a) a c H); rewrite Rplus_opp_r; intro; assumption | assert (Hyp : 0 < 2); [ prove_sup0 | apply (Rinv_0_lt_compat 2 Hyp) ] ]. replace (- (l / 2)) with (- l / 2). - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. rewrite <- Ropp_0; apply Ropp_lt_gt_contravar; assumption. assert (Hyp : 0 < 2); [ prove_sup0 | apply (Rinv_0_lt_compat 2 Hyp) ]. - unfold Rdiv in |- *; apply Ropp_mult_distr_l_reverse. + unfold Rdiv; apply Ropp_mult_distr_l_reverse. Qed. Theorem deriv_minimum : @@ -1460,7 +1460,7 @@ Proof. cut (forall x:R, a < x -> x < b -> (- f)%F x <= (- f)%F c). intro. apply (deriv_maximum (- f)%F a b c (derivable_pt_opp _ _ pr) H H0 H2). - intros; unfold opp_fct in |- *; apply Ropp_ge_le_contravar; apply Rle_ge. + intros; unfold opp_fct; apply Ropp_ge_le_contravar; apply Rle_ge. apply (H1 x H2 H3). Qed. @@ -1493,7 +1493,7 @@ Proof. intro; decompose [and] H7; intros; generalize (H6 (delta / 2) H8 H11); cut (0 <= (f (x + delta / 2) - f x) / (delta / 2)). intro; cut (0 <= (f (x + delta / 2) - f x) / (delta / 2) - l). - intro; unfold Rabs in |- *; + intro; unfold Rabs; case (Rcase_abs ((f (x + delta / 2) - f x) / (delta / 2) - l)). intro; elim @@ -1502,7 +1502,7 @@ Proof. intros; generalize (Rplus_lt_compat_r l ((f (x + delta / 2) - f x) / (delta / 2) - l) - (- (l / 2)) H13); unfold Rminus in |- *; + (- (l / 2)) H13); unfold Rminus; replace (- (l / 2) + l) with (l / 2). rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; intro; generalize @@ -1512,50 +1512,50 @@ Proof. rewrite <- Ropp_0 in H5; generalize (Ropp_lt_gt_contravar (-0) (- (l / 2)) H5); repeat rewrite Ropp_involutive; intro; assumption. - pattern l at 3 in |- *; rewrite double_var. + pattern l at 3; rewrite double_var. ring. - unfold Rminus in |- *; apply Rplus_le_le_0_compat. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Rminus; apply Rplus_le_le_0_compat. + unfold Rdiv; apply Rmult_le_pos. cut (x <= x + delta * / 2). intro; generalize (H x (x + delta * / 2) H12); intro; generalize (Rplus_le_compat_l (- f x) (f x) (f (x + delta * / 2)) H13); rewrite Rplus_opp_l; rewrite Rplus_comm; intro; assumption. - pattern x at 1 in |- *; rewrite <- (Rplus_0_r x); apply Rplus_le_compat_l; + pattern x at 1; rewrite <- (Rplus_0_r x); apply Rplus_le_compat_l; left; assumption. left; apply Rinv_0_lt_compat; assumption. left; rewrite <- Ropp_0; apply Ropp_lt_gt_contravar; assumption. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Rdiv; apply Rmult_le_pos. cut (x <= x + delta * / 2). intro; generalize (H x (x + delta * / 2) H9); intro; generalize (Rplus_le_compat_l (- f x) (f x) (f (x + delta * / 2)) H12); rewrite Rplus_opp_l; rewrite Rplus_comm; intro; assumption. - pattern x at 1 in |- *; rewrite <- (Rplus_0_r x); apply Rplus_le_compat_l; + pattern x at 1; rewrite <- (Rplus_0_r x); apply Rplus_le_compat_l; left; assumption. left; apply Rinv_0_lt_compat; assumption. split. - unfold Rdiv in |- *; apply prod_neq_R0. - generalize (cond_pos delta); intro; red in |- *; intro H9; rewrite H9 in H7; + unfold Rdiv; apply prod_neq_R0. + generalize (cond_pos delta); intro; red; intro H9; rewrite H9 in H7; elim (Rlt_irrefl 0 H7). apply Rinv_neq_0_compat; discrR. split. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos delta) | apply Rinv_0_lt_compat; prove_sup0 ]. replace (Rabs (delta / 2)) with (delta / 2). - unfold Rdiv in |- *; apply Rmult_lt_reg_l with 2. + unfold Rdiv; apply Rmult_lt_reg_l with 2. prove_sup0. rewrite (Rmult_comm 2). rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ idtac | discrR ]. rewrite Rmult_1_r. rewrite double. - pattern (pos delta) at 1 in |- *; rewrite <- Rplus_0_r. + pattern (pos delta) at 1; rewrite <- Rplus_0_r. apply Rplus_lt_compat_l; apply (cond_pos delta). - symmetry in |- *; apply Rabs_right. - left; change (0 < delta / 2) in |- *; unfold Rdiv in |- *; + symmetry ; apply Rabs_right. + left; change (0 < delta / 2); unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos delta) | apply Rinv_0_lt_compat; prove_sup0 ]. - unfold Rdiv in |- *; rewrite <- Ropp_mult_distr_l_reverse; + unfold Rdiv; rewrite <- Ropp_mult_distr_l_reverse; apply Rmult_lt_0_compat. apply Rplus_lt_reg_r with l. - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rplus_0_r; assumption. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rplus_0_r; assumption. apply Rinv_0_lt_compat; prove_sup0. Qed. diff --git a/theories/Reals/Ranalysis2.v b/theories/Reals/Ranalysis2.v index ed80ac43..3c15a305 100644 --- a/theories/Reals/Ranalysis2.v +++ b/theories/Reals/Ranalysis2.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,7 +9,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import Ranalysis1. -Open Local Scope R_scope. +Local Open Scope R_scope. (**********) Lemma formule : @@ -24,7 +24,7 @@ Lemma formule : f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) - f2 x) / h - l2) + l2 * f1 x / (Rsqr (f2 x) * f2 (x + h)) * (f2 (x + h) - f2 x). Proof. - intros; unfold Rdiv, Rminus, Rsqr in |- *. + intros; unfold Rdiv, Rminus, Rsqr. repeat rewrite Rmult_plus_distr_r; repeat rewrite Rmult_plus_distr_l; repeat rewrite Rinv_mult_distr; try assumption. replace (l1 * f2 x * (/ f2 x * / f2 x)) with (l1 * / f2 x * (f2 x * / f2 x)); @@ -81,10 +81,10 @@ Proof. rewrite Rabs_Rinv; [ left; exact H7 | assumption ]. apply Rlt_le_trans with (2 / Rabs (f2 x) * Rabs (eps * f2 x / 8)). apply Rmult_lt_compat_l. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ prove_sup0 | apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption ]. exact H8. - right; unfold Rdiv in |- *. + right; unfold Rdiv. repeat rewrite Rabs_mult. rewrite Rabs_Rinv; discrR. replace (Rabs 8) with 8. @@ -96,8 +96,8 @@ Proof. replace (Rabs eps) with eps. repeat rewrite <- Rinv_r_sym; try discrR || (apply Rabs_no_R0; assumption). ring. - symmetry in |- *; apply Rabs_right; left; assumption. - symmetry in |- *; apply Rabs_right; left; prove_sup. + symmetry ; apply Rabs_right; left; assumption. + symmetry ; apply Rabs_right; left; prove_sup. Qed. Lemma maj_term2 : @@ -129,11 +129,11 @@ Proof. (Rabs (2 * (l1 / (f2 x * f2 x))) * Rabs (eps * Rsqr (f2 x) / (8 * l1))). apply Rmult_lt_compat_r. apply Rabs_pos_lt. - unfold Rdiv in |- *; unfold Rsqr in |- *; repeat apply prod_neq_R0; + unfold Rdiv; unfold Rsqr; repeat apply prod_neq_R0; try assumption || discrR. - red in |- *; intro H10; rewrite H10 in H; elim (Rlt_irrefl _ H). + red; intro H10; rewrite H10 in H; elim (Rlt_irrefl _ H). apply Rinv_neq_0_compat; apply prod_neq_R0; try assumption || discrR. - unfold Rdiv in |- *. + unfold Rdiv. repeat rewrite Rinv_mult_distr; try assumption. repeat rewrite Rabs_mult. replace (Rabs 2) with 2. @@ -147,9 +147,9 @@ Proof. repeat rewrite Rabs_Rinv; try assumption. rewrite <- (Rmult_comm 2). unfold Rdiv in H8; exact H8. - symmetry in |- *; apply Rabs_right; left; prove_sup0. + symmetry ; apply Rabs_right; left; prove_sup0. right. - unfold Rsqr, Rdiv in |- *. + unfold Rsqr, Rdiv. do 1 rewrite Rinv_mult_distr; try assumption || discrR. do 1 rewrite Rinv_mult_distr; try assumption || discrR. repeat rewrite Rabs_mult. @@ -166,9 +166,9 @@ Proof. (Rabs (f2 x) * / Rabs (f2 x)) * (2 * / 2)); [ idtac | ring ]. repeat rewrite <- Rinv_r_sym; try (apply Rabs_no_R0; assumption) || discrR. ring. - symmetry in |- *; apply Rabs_right; left; prove_sup0. - symmetry in |- *; apply Rabs_right; left; prove_sup. - symmetry in |- *; apply Rabs_right; left; assumption. + symmetry ; apply Rabs_right; left; prove_sup0. + symmetry ; apply Rabs_right; left; prove_sup. + symmetry ; apply Rabs_right; left; assumption. Qed. Lemma maj_term3 : @@ -204,11 +204,11 @@ Proof. (Rabs (2 * (f1 x / (f2 x * f2 x))) * Rabs (Rsqr (f2 x) * eps / (8 * f1 x))). apply Rmult_lt_compat_r. apply Rabs_pos_lt. - unfold Rdiv in |- *; unfold Rsqr in |- *; repeat apply prod_neq_R0; + unfold Rdiv; unfold Rsqr; repeat apply prod_neq_R0; try assumption. - red in |- *; intro H10; rewrite H10 in H; elim (Rlt_irrefl _ H). + red; intro H10; rewrite H10 in H; elim (Rlt_irrefl _ H). apply Rinv_neq_0_compat; apply prod_neq_R0; discrR || assumption. - unfold Rdiv in |- *. + unfold Rdiv. repeat rewrite Rinv_mult_distr; try assumption. repeat rewrite Rabs_mult. replace (Rabs 2) with 2. @@ -222,9 +222,9 @@ Proof. repeat rewrite Rabs_Rinv; assumption || idtac. rewrite <- (Rmult_comm 2). unfold Rdiv in H9; exact H9. - symmetry in |- *; apply Rabs_right; left; prove_sup0. + symmetry ; apply Rabs_right; left; prove_sup0. right. - unfold Rsqr, Rdiv in |- *. + unfold Rsqr, Rdiv. rewrite Rinv_mult_distr; try assumption || discrR. rewrite Rinv_mult_distr; try assumption || discrR. repeat rewrite Rabs_mult. @@ -241,9 +241,9 @@ Proof. (Rabs (f1 x) * / Rabs (f1 x)) * (2 * / 2)); [ idtac | ring ]. repeat rewrite <- Rinv_r_sym; try discrR || (apply Rabs_no_R0; assumption). ring. - symmetry in |- *; apply Rabs_right; left; prove_sup0. - symmetry in |- *; apply Rabs_right; left; prove_sup. - symmetry in |- *; apply Rabs_right; left; assumption. + symmetry ; apply Rabs_right; left; prove_sup0. + symmetry ; apply Rabs_right; left; prove_sup. + symmetry ; apply Rabs_right; left; assumption. Qed. Lemma maj_term4 : @@ -281,17 +281,17 @@ Proof. Rabs (Rsqr (f2 x) * f2 x * eps / (8 * f1 x * l2))). apply Rmult_lt_compat_r. apply Rabs_pos_lt. - unfold Rdiv in |- *; unfold Rsqr in |- *; repeat apply prod_neq_R0; + unfold Rdiv; unfold Rsqr; repeat apply prod_neq_R0; assumption || idtac. - red in |- *; intro H11; rewrite H11 in H; elim (Rlt_irrefl _ H). + red; intro H11; rewrite H11 in H; elim (Rlt_irrefl _ H). apply Rinv_neq_0_compat; apply prod_neq_R0. apply prod_neq_R0. discrR. assumption. assumption. - unfold Rdiv in |- *. + unfold Rdiv. repeat rewrite Rinv_mult_distr; - try assumption || (unfold Rsqr in |- *; apply prod_neq_R0; assumption). + try assumption || (unfold Rsqr; apply prod_neq_R0; assumption). repeat rewrite Rabs_mult. replace (Rabs 2) with 2. replace @@ -305,13 +305,13 @@ Proof. repeat apply Rmult_lt_compat_l. apply Rabs_pos_lt; assumption. apply Rabs_pos_lt; assumption. - apply Rabs_pos_lt; apply Rinv_neq_0_compat; unfold Rsqr in |- *; + apply Rabs_pos_lt; apply Rinv_neq_0_compat; unfold Rsqr; apply prod_neq_R0; assumption. repeat rewrite Rabs_Rinv; [ idtac | assumption | assumption ]. rewrite <- (Rmult_comm 2). unfold Rdiv in H10; exact H10. - symmetry in |- *; apply Rabs_right; left; prove_sup0. - right; unfold Rsqr, Rdiv in |- *. + symmetry ; apply Rabs_right; left; prove_sup0. + right; unfold Rsqr, Rdiv. rewrite Rinv_mult_distr; try assumption || discrR. rewrite Rinv_mult_distr; try assumption || discrR. rewrite Rinv_mult_distr; try assumption || discrR. @@ -333,9 +333,9 @@ Proof. (Rabs (f2 x) * / Rabs (f2 x)) * (2 * / 2)); [ idtac | ring ]. repeat rewrite <- Rinv_r_sym; try discrR || (apply Rabs_no_R0; assumption). ring. - symmetry in |- *; apply Rabs_right; left; prove_sup0. - symmetry in |- *; apply Rabs_right; left; prove_sup. - symmetry in |- *; apply Rabs_right; left; assumption. + symmetry ; apply Rabs_right; left; prove_sup0. + symmetry ; apply Rabs_right; left; prove_sup. + symmetry ; apply Rabs_right; left; assumption. apply prod_neq_R0; assumption || discrR. apply prod_neq_R0; assumption. Qed. @@ -343,11 +343,11 @@ Qed. Lemma D_x_no_cond : forall x a:R, a <> 0 -> D_x no_cond x (x + a). Proof. intros. - unfold D_x, no_cond in |- *. + unfold D_x, no_cond. split. trivial. apply Rminus_not_eq. - unfold Rminus in |- *. + unfold Rminus. rewrite Ropp_plus_distr. rewrite <- Rplus_assoc. rewrite Rplus_opp_r. @@ -394,7 +394,7 @@ Qed. Lemma quadruple_var : forall x:R, x = x / 4 + x / 4 + x / 4 + x / 4. Proof. intro; rewrite <- quadruple. - unfold Rdiv in |- *; rewrite <- Rmult_assoc; rewrite Rinv_r_simpl_m; discrR. + unfold Rdiv; rewrite <- Rmult_assoc; rewrite Rinv_r_simpl_m; discrR. reflexivity. Qed. @@ -413,10 +413,10 @@ Proof. cut (dist R_met (x0 + h) x0 < x -> dist R_met (f (x0 + h)) (f x0) < Rabs (f x0 / 2)). - unfold dist in |- *; simpl in |- *; unfold R_dist in |- *; + unfold dist; simpl; unfold R_dist; replace (x0 + h - x0) with h. intros; assert (H7 := H6 H4). - red in |- *; intro. + red; intro. rewrite H8 in H7; unfold Rminus in H7; rewrite Rplus_0_l in H7; rewrite Rabs_Ropp in H7; unfold Rdiv in H7; rewrite Rabs_mult in H7; pattern (Rabs (f x0)) at 1 in H7; rewrite <- Rmult_1_r in H7. @@ -429,10 +429,10 @@ Proof. rewrite Rmult_1_r in H12; rewrite <- Rinv_r_sym in H12; [ idtac | discrR ]. cut (IZR 1 < IZR 2). - unfold IZR in |- *; unfold INR, nat_of_P in |- *; simpl in |- *; intro; + unfold IZR; unfold INR, Pos.to_nat; simpl; intro; elim (Rlt_irrefl 1 (Rlt_trans _ _ _ H13 H12)). apply IZR_lt; omega. - unfold Rabs in |- *; case (Rcase_abs (/ 2)); intro. + unfold Rabs; case (Rcase_abs (/ 2)); intro. assert (Hyp : 0 < 2). prove_sup0. assert (H11 := Rmult_lt_compat_l 2 _ _ Hyp r); rewrite Rmult_0_r in H11; @@ -442,18 +442,18 @@ Proof. apply (Rabs_pos_lt _ H0). ring. assert (H6 := Req_dec x0 (x0 + h)); elim H6; intro. - intro; rewrite <- H7; unfold dist, R_met in |- *; unfold R_dist in |- *; - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + intro; rewrite <- H7; unfold dist, R_met; unfold R_dist; + unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply Rabs_pos_lt. - unfold Rdiv in |- *; apply prod_neq_R0; + unfold Rdiv; apply prod_neq_R0; [ assumption | apply Rinv_neq_0_compat; discrR ]. intro; apply H5. split. - unfold D_x, no_cond in |- *. + unfold D_x, no_cond. split; trivial || assumption. assumption. - change (0 < Rabs (f x0 / 2)) in |- *. - apply Rabs_pos_lt; unfold Rdiv in |- *; apply prod_neq_R0. + change (0 < Rabs (f x0 / 2)). + apply Rabs_pos_lt; unfold Rdiv; apply prod_neq_R0. assumption. apply Rinv_neq_0_compat; discrR. Qed. diff --git a/theories/Reals/Ranalysis3.v b/theories/Reals/Ranalysis3.v index afd4a4ee..5eaf5a57 100644 --- a/theories/Reals/Ranalysis3.v +++ b/theories/Reals/Ranalysis3.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -10,7 +10,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import Ranalysis1. Require Import Ranalysis2. -Open Local Scope R_scope. +Local Open Scope R_scope. (** Division *) Theorem derivable_pt_lim_div : @@ -22,17 +22,17 @@ Theorem derivable_pt_lim_div : Proof. intros f1 f2 x l1 l2 H H0 H1. cut (derivable_pt f2 x); - [ intro X | unfold derivable_pt in |- *; exists l2; exact H0 ]. + [ intro X | unfold derivable_pt; exists l2; exact H0 ]. assert (H2 := continuous_neq_0 _ _ (derivable_continuous_pt _ _ X) H1). elim H2; clear H2; intros eps_f2 H2. - unfold div_fct in |- *. + unfold div_fct. assert (H3 := derivable_continuous_pt _ _ X). unfold continuity_pt in H3; unfold continue_in in H3; unfold limit1_in in H3; unfold limit_in in H3; unfold dist in H3. simpl in H3; unfold R_dist in H3. elim (H3 (Rabs (f2 x) / 2)); [ idtac - | unfold Rdiv in |- *; change (0 < Rabs (f2 x) * / 2) in |- *; + | unfold Rdiv; change (0 < Rabs (f2 x) * / 2); apply Rmult_lt_0_compat; [ apply Rabs_pos_lt; assumption | apply Rinv_0_lt_compat; prove_sup0 ] ]. clear H3; intros alp_f2 H3. @@ -46,12 +46,12 @@ Proof. (forall a:R, Rabs a < Rmin eps_f2 alp_f2 -> / Rabs (f2 (x + a)) < 2 / Rabs (f2 x)). intro Maj. - unfold derivable_pt_lim in |- *; intros. + unfold derivable_pt_lim; intros. elim (H (Rabs (eps * f2 x / 8))); [ idtac - | unfold Rdiv in |- *; change (0 < Rabs (eps * f2 x * / 8)) in |- *; + | unfold Rdiv; change (0 < Rabs (eps * f2 x * / 8)); apply Rabs_pos_lt; repeat apply prod_neq_R0; - [ red in |- *; intro H7; rewrite H7 in H6; elim (Rlt_irrefl _ H6) + [ red; intro H7; rewrite H7 in H6; elim (Rlt_irrefl _ H6) | assumption | apply Rinv_neq_0_compat; discrR ] ]. intros alp_f1d H7. @@ -68,7 +68,7 @@ Proof. | elim H3; intros; assumption | apply (cond_pos alp_f1d) ] ]. exists (mkposreal (Rmin eps_f2 (Rmin alp_f2 alp_f1d)) H10). - simpl in |- *; intros. + simpl; intros. assert (H13 := Rlt_le_trans _ _ _ H12 (Rmin_r _ _)). assert (H14 := Rlt_le_trans _ _ _ H12 (Rmin_l _ _)). assert (H15 := Rlt_le_trans _ _ _ H13 (Rmin_r _ _)). @@ -80,7 +80,7 @@ Proof. Rabs (l1 / (f2 x * f2 (x + h)) * (f2 x - f2 (x + h))) + Rabs (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) - f2 x) / h - l2)) + Rabs (l2 * f1 x / (Rsqr (f2 x) * f2 (x + h)) * (f2 (x + h) - f2 x))). - unfold Rminus in |- *. + unfold Rminus. rewrite <- (Rabs_Ropp (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) + - f2 x) / h + - l2))) . @@ -98,15 +98,15 @@ Proof. intros. apply Rlt_4; assumption. rewrite H8. - unfold Rdiv in |- *; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. + unfold Rdiv; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. rewrite Rabs_R0; rewrite Rmult_0_l. apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup ]. rewrite H8. - unfold Rdiv in |- *; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. + unfold Rdiv; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. rewrite Rabs_R0; rewrite Rmult_0_l. apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup ]. rewrite H9. - unfold Rdiv in |- *; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. + unfold Rdiv; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. rewrite Rabs_R0; rewrite Rmult_0_l. apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup ]. rewrite <- Rabs_mult. @@ -114,7 +114,7 @@ Proof. try assumption || apply H2. apply H14. apply Rmin_2; assumption. - right; symmetry in |- *; apply quadruple_var. + right; symmetry ; apply quadruple_var. (***********************************) (* Second case *) (* (f1 x)=0 l1<>0 *) @@ -137,7 +137,7 @@ Proof. cut (0 < Rmin (Rmin eps_f2 alp_f1d) (Rmin alp_f2 alp_f2t2)). intro. exists (mkposreal (Rmin (Rmin eps_f2 alp_f1d) (Rmin alp_f2 alp_f2t2)) H12). - simpl in |- *. + simpl. intros. assert (H15 := Rlt_le_trans _ _ _ H14 (Rmin_r _ _)). assert (H16 := Rlt_le_trans _ _ _ H14 (Rmin_l _ _)). @@ -152,7 +152,7 @@ Proof. Rabs (l1 / (f2 x * f2 (x + h)) * (f2 x - f2 (x + h))) + Rabs (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) - f2 x) / h - l2)) + Rabs (l2 * f1 x / (Rsqr (f2 x) * f2 (x + h)) * (f2 (x + h) - f2 x))). - unfold Rminus in |- *. + unfold Rminus. rewrite <- (Rabs_Ropp (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) + - f2 x) / h + - l2))) . @@ -170,11 +170,11 @@ Proof. intros. apply Rlt_4; assumption. rewrite H8. - unfold Rdiv in |- *; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. + unfold Rdiv; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. rewrite Rabs_R0; rewrite Rmult_0_l. apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup ]. rewrite H8. - unfold Rdiv in |- *; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. + unfold Rdiv; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. rewrite Rabs_R0; rewrite Rmult_0_l. apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup ]. rewrite <- Rabs_mult. @@ -185,7 +185,7 @@ Proof. apply (maj_term1 x h eps l1 alp_f2 eps_f2 alp_f1d f1 f2); try assumption. apply H2; assumption. apply Rmin_2; assumption. - right; symmetry in |- *; apply quadruple_var. + right; symmetry ; apply quadruple_var. apply H2; assumption. repeat apply Rmin_pos. apply (cond_pos eps_f2). @@ -196,21 +196,21 @@ Proof. elim H10; intros. case (Req_dec a 0); intro. rewrite H14; rewrite Rplus_0_r. - unfold Rminus in |- *; rewrite Rplus_opp_r. + unfold Rminus; rewrite Rplus_opp_r. rewrite Rabs_R0. apply Rabs_pos_lt. - unfold Rdiv, Rsqr in |- *; repeat rewrite Rmult_assoc. + unfold Rdiv, Rsqr; repeat rewrite Rmult_assoc. repeat apply prod_neq_R0; try assumption. - red in |- *; intro; rewrite H15 in H6; elim (Rlt_irrefl _ H6). + red; intro; rewrite H15 in H6; elim (Rlt_irrefl _ H6). apply Rinv_neq_0_compat; repeat apply prod_neq_R0; discrR || assumption. apply H13. split. apply D_x_no_cond; assumption. replace (x + a - x) with a; [ assumption | ring ]. - change (0 < Rabs (eps * Rsqr (f2 x) / (8 * l1))) in |- *. - apply Rabs_pos_lt; unfold Rdiv, Rsqr in |- *; repeat rewrite Rmult_assoc; + change (0 < Rabs (eps * Rsqr (f2 x) / (8 * l1))). + apply Rabs_pos_lt; unfold Rdiv, Rsqr; repeat rewrite Rmult_assoc; repeat apply prod_neq_R0. - red in |- *; intro; rewrite H11 in H6; elim (Rlt_irrefl _ H6). + red; intro; rewrite H11 in H6; elim (Rlt_irrefl _ H6). assumption. assumption. apply Rinv_neq_0_compat; repeat apply prod_neq_R0; @@ -223,17 +223,17 @@ Proof. case (Req_dec l2 0); intro. elim (H0 (Rabs (Rsqr (f2 x) * eps / (8 * f1 x)))); [ idtac - | apply Rabs_pos_lt; unfold Rdiv, Rsqr in |- *; repeat rewrite Rmult_assoc; + | apply Rabs_pos_lt; unfold Rdiv, Rsqr; repeat rewrite Rmult_assoc; repeat apply prod_neq_R0; [ assumption | assumption - | red in |- *; intro; rewrite H11 in H6; elim (Rlt_irrefl _ H6) + | red; intro; rewrite H11 in H6; elim (Rlt_irrefl _ H6) | apply Rinv_neq_0_compat; repeat apply prod_neq_R0; discrR || assumption ] ]. intros alp_f2d H12. cut (0 < Rmin (Rmin eps_f2 alp_f2) (Rmin alp_f1d alp_f2d)). intro. exists (mkposreal (Rmin (Rmin eps_f2 alp_f2) (Rmin alp_f1d alp_f2d)) H11). - simpl in |- *. + simpl. intros. assert (H15 := Rlt_le_trans _ _ _ H14 (Rmin_l _ _)). assert (H16 := Rlt_le_trans _ _ _ H14 (Rmin_r _ _)). @@ -248,7 +248,7 @@ Proof. Rabs (l1 / (f2 x * f2 (x + h)) * (f2 x - f2 (x + h))) + Rabs (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) - f2 x) / h - l2)) + Rabs (l2 * f1 x / (Rsqr (f2 x) * f2 (x + h)) * (f2 (x + h) - f2 x))). - unfold Rminus in |- *. + unfold Rminus. rewrite <- (Rabs_Ropp (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) + - f2 x) / h + - l2))) . @@ -266,7 +266,7 @@ Proof. intros. apply Rlt_4; assumption. rewrite H10. - unfold Rdiv in |- *; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. + unfold Rdiv; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. rewrite Rabs_R0; rewrite Rmult_0_l. apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup ]. rewrite <- Rabs_mult. @@ -274,14 +274,14 @@ Proof. apply H2; assumption. apply Rmin_2; assumption. rewrite H9. - unfold Rdiv in |- *; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. + unfold Rdiv; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. rewrite Rabs_R0; rewrite Rmult_0_l. apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup ]. rewrite <- Rabs_mult. apply (maj_term1 x h eps l1 alp_f2 eps_f2 alp_f1d f1 f2); assumption || idtac. apply H2; assumption. apply Rmin_2; assumption. - right; symmetry in |- *; apply quadruple_var. + right; symmetry ; apply quadruple_var. apply H2; assumption. repeat apply Rmin_pos. apply (cond_pos eps_f2). @@ -294,7 +294,7 @@ Proof. (***********************************) elim (H0 (Rabs (Rsqr (f2 x) * eps / (8 * f1 x)))); [ idtac - | apply Rabs_pos_lt; unfold Rsqr, Rdiv in |- *; + | apply Rabs_pos_lt; unfold Rsqr, Rdiv; repeat rewrite Rinv_mult_distr; repeat apply prod_neq_R0; try assumption || discrR ]. intros alp_f2d H11. @@ -313,7 +313,7 @@ Proof. exists (mkposreal (Rmin (Rmin eps_f2 alp_f2) (Rmin alp_f1d (Rmin alp_f2d alp_f2c))) H14). - simpl in |- *; intros. + simpl; intros. assert (H17 := Rlt_le_trans _ _ _ H16 (Rmin_l _ _)). assert (H18 := Rlt_le_trans _ _ _ H16 (Rmin_r _ _)). assert (H19 := Rlt_le_trans _ _ _ H18 (Rmin_r _ _)). @@ -335,7 +335,7 @@ Proof. Rabs (l1 / (f2 x * f2 (x + h)) * (f2 x - f2 (x + h))) + Rabs (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) - f2 x) / h - l2)) + Rabs (l2 * f1 x / (Rsqr (f2 x) * f2 (x + h)) * (f2 (x + h) - f2 x))). - unfold Rminus in |- *. + unfold Rminus. rewrite <- (Rabs_Ropp (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) + - f2 x) / h + - l2))) . @@ -361,24 +361,24 @@ Proof. apply H2; assumption. apply Rmin_2; assumption. rewrite H9. - unfold Rdiv in |- *; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. + unfold Rdiv; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. rewrite Rabs_R0; rewrite Rmult_0_l. apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup ]. rewrite <- Rabs_mult. apply (maj_term1 x h eps l1 alp_f2 eps_f2 alp_f1d f1 f2); try assumption. apply H2; assumption. apply Rmin_2; assumption. - right; symmetry in |- *; apply quadruple_var. + right; symmetry ; apply quadruple_var. apply H2; assumption. intros. case (Req_dec a 0); intro. rewrite H17; rewrite Rplus_0_r. - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0. apply Rabs_pos_lt. - unfold Rdiv, Rsqr in |- *. + unfold Rdiv, Rsqr. repeat rewrite Rinv_mult_distr; try assumption. repeat apply prod_neq_R0; try assumption. - red in |- *; intro H18; rewrite H18 in H6; elim (Rlt_irrefl _ H6). + red; intro H18; rewrite H18 in H6; elim (Rlt_irrefl _ H6). apply Rinv_neq_0_compat; discrR. apply Rinv_neq_0_compat; discrR. apply Rinv_neq_0_compat; discrR. @@ -401,19 +401,19 @@ Proof. apply (cond_pos alp_f1d). apply (cond_pos alp_f2d). elim H13; intros; assumption. - change (0 < Rabs (Rsqr (f2 x) * f2 x * eps / (8 * f1 x * l2))) in |- *. + change (0 < Rabs (Rsqr (f2 x) * f2 x * eps / (8 * f1 x * l2))). apply Rabs_pos_lt. - unfold Rsqr, Rdiv in |- *. + unfold Rsqr, Rdiv. repeat rewrite Rinv_mult_distr; try assumption || discrR. repeat apply prod_neq_R0; try assumption. - red in |- *; intro H13; rewrite H13 in H6; elim (Rlt_irrefl _ H6). + red; intro H13; rewrite H13 in H6; elim (Rlt_irrefl _ H6). apply Rinv_neq_0_compat; discrR. apply Rinv_neq_0_compat; discrR. apply Rinv_neq_0_compat; discrR. apply Rinv_neq_0_compat; assumption. apply Rinv_neq_0_compat; assumption. apply prod_neq_R0; [ discrR | assumption ]. - red in |- *; intro H11; rewrite H11 in H6; elim (Rlt_irrefl _ H6). + red; intro H11; rewrite H11 in H6; elim (Rlt_irrefl _ H6). apply Rinv_neq_0_compat; discrR. apply Rinv_neq_0_compat; discrR. apply Rinv_neq_0_compat; discrR. @@ -440,7 +440,7 @@ Proof. exists (mkposreal (Rmin (Rmin eps_f2 alp_f2) (Rmin alp_f1d (Rmin alp_f2d alp_f2t2))) H13). - simpl in |- *. + simpl. intros. cut (forall a:R, @@ -462,7 +462,7 @@ Proof. Rabs (l1 / (f2 x * f2 (x + h)) * (f2 x - f2 (x + h))) + Rabs (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) - f2 x) / h - l2)) + Rabs (l2 * f1 x / (Rsqr (f2 x) * f2 (x + h)) * (f2 (x + h) - f2 x))). - unfold Rminus in |- *. + unfold Rminus. rewrite <- (Rabs_Ropp (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) + - f2 x) / h + - l2))) . @@ -480,7 +480,7 @@ Proof. intros. apply Rlt_4; assumption. rewrite H10. - unfold Rdiv in |- *; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. + unfold Rdiv; repeat rewrite Rmult_0_r || rewrite Rmult_0_l. rewrite Rabs_R0; rewrite Rmult_0_l. apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup ]. rewrite <- Rabs_mult. @@ -495,20 +495,20 @@ Proof. apply (maj_term1 x h eps l1 alp_f2 eps_f2 alp_f1d f1 f2); try assumption. apply H2; assumption. apply Rmin_2; assumption. - right; symmetry in |- *; apply quadruple_var. + right; symmetry ; apply quadruple_var. apply H2; assumption. intros. case (Req_dec a 0); intro. - rewrite H17; rewrite Rplus_0_r; unfold Rminus in |- *; rewrite Rplus_opp_r; + rewrite H17; rewrite Rplus_0_r; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0. apply Rabs_pos_lt. - unfold Rdiv in |- *; rewrite Rinv_mult_distr; try discrR || assumption. - unfold Rsqr in |- *. + unfold Rdiv; rewrite Rinv_mult_distr; try discrR || assumption. + unfold Rsqr. repeat apply prod_neq_R0; assumption || (apply Rinv_neq_0_compat; assumption) || (apply Rinv_neq_0_compat; discrR) || - (red in |- *; intro H18; rewrite H18 in H6; elim (Rlt_irrefl _ H6)). + (red; intro H18; rewrite H18 in H6; elim (Rlt_irrefl _ H6)). elim H11; intros. apply H19. split. @@ -521,20 +521,20 @@ Proof. apply (cond_pos alp_f2d). elim H11; intros; assumption. apply Rabs_pos_lt. - unfold Rdiv, Rsqr in |- *; rewrite Rinv_mult_distr; try discrR || assumption. + unfold Rdiv, Rsqr; rewrite Rinv_mult_distr; try discrR || assumption. repeat apply prod_neq_R0; assumption || (apply Rinv_neq_0_compat; assumption) || (apply Rinv_neq_0_compat; discrR) || - (red in |- *; intro H12; rewrite H12 in H6; elim (Rlt_irrefl _ H6)). - change (0 < Rabs (eps * Rsqr (f2 x) / (8 * l1))) in |- *. + (red; intro H12; rewrite H12 in H6; elim (Rlt_irrefl _ H6)). + change (0 < Rabs (eps * Rsqr (f2 x) / (8 * l1))). apply Rabs_pos_lt. - unfold Rdiv, Rsqr in |- *; rewrite Rinv_mult_distr; try discrR || assumption. + unfold Rdiv, Rsqr; rewrite Rinv_mult_distr; try discrR || assumption. repeat apply prod_neq_R0; assumption || (apply Rinv_neq_0_compat; assumption) || (apply Rinv_neq_0_compat; discrR) || - (red in |- *; intro H12; rewrite H12 in H6; elim (Rlt_irrefl _ H6)). + (red; intro H12; rewrite H12 in H6; elim (Rlt_irrefl _ H6)). (***********************************) (* Sixth case *) (* (f1 x)<>0 l1<>0 l2<>0 *) @@ -562,7 +562,7 @@ Proof. (mkposreal (Rmin (Rmin (Rmin eps_f2 alp_f2) (Rmin alp_f1d alp_f2d)) (Rmin alp_f2c alp_f2t2)) H15). - simpl in |- *. + simpl. intros. assert (H18 := Rlt_le_trans _ _ _ H17 (Rmin_l _ _)). assert (H19 := Rlt_le_trans _ _ _ H17 (Rmin_r _ _)). @@ -591,7 +591,7 @@ Proof. Rabs (l1 / (f2 x * f2 (x + h)) * (f2 x - f2 (x + h))) + Rabs (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) - f2 x) / h - l2)) + Rabs (l2 * f1 x / (Rsqr (f2 x) * f2 (x + h)) * (f2 (x + h) - f2 x))). - unfold Rminus in |- *. + unfold Rminus. rewrite <- (Rabs_Ropp (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) + - f2 x) / h + - l2))) . @@ -624,18 +624,18 @@ Proof. apply (maj_term1 x h eps l1 alp_f2 eps_f2 alp_f1d f1 f2); try assumption. apply H2; assumption. apply Rmin_2; assumption. - right; symmetry in |- *; apply quadruple_var. + right; symmetry ; apply quadruple_var. apply H2; assumption. intros. case (Req_dec a 0); intro. - rewrite H18; rewrite Rplus_0_r; unfold Rminus in |- *; rewrite Rplus_opp_r; + rewrite H18; rewrite Rplus_0_r; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply Rabs_pos_lt. - unfold Rdiv, Rsqr in |- *; rewrite Rinv_mult_distr. + unfold Rdiv, Rsqr; rewrite Rinv_mult_distr. repeat apply prod_neq_R0; assumption || (apply Rinv_neq_0_compat; assumption) || (apply Rinv_neq_0_compat; discrR) || - (red in |- *; intro H28; rewrite H28 in H6; elim (Rlt_irrefl _ H6)). + (red; intro H28; rewrite H28 in H6; elim (Rlt_irrefl _ H6)). apply prod_neq_R0; [ discrR | assumption ]. apply prod_neq_R0; [ discrR | assumption ]. assumption. @@ -646,20 +646,20 @@ Proof. replace (x + a - x) with a; [ assumption | ring ]. intros. case (Req_dec a 0); intro. - rewrite H18; rewrite Rplus_0_r; unfold Rminus in |- *; rewrite Rplus_opp_r; + rewrite H18; rewrite Rplus_0_r; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply Rabs_pos_lt. - unfold Rdiv, Rsqr in |- *; rewrite Rinv_mult_distr. + unfold Rdiv, Rsqr; rewrite Rinv_mult_distr. repeat apply prod_neq_R0; assumption || (apply Rinv_neq_0_compat; assumption) || (apply Rinv_neq_0_compat; discrR) || - (red in |- *; intro H28; rewrite H28 in H6; elim (Rlt_irrefl _ H6)). + (red; intro H28; rewrite H28 in H6; elim (Rlt_irrefl _ H6)). discrR. assumption. elim H14; intros. apply H20. split. - unfold D_x, no_cond in |- *; split. + unfold D_x, no_cond; split. trivial. apply Rminus_not_eq_right. replace (x + a - x) with a; [ assumption | ring ]. @@ -671,34 +671,34 @@ Proof. apply (cond_pos alp_f2d). elim H13; intros; assumption. elim H14; intros; assumption. - change (0 < Rabs (eps * Rsqr (f2 x) / (8 * l1))) in |- *; apply Rabs_pos_lt. - unfold Rdiv, Rsqr in |- *; rewrite Rinv_mult_distr; try discrR || assumption. + change (0 < Rabs (eps * Rsqr (f2 x) / (8 * l1))); apply Rabs_pos_lt. + unfold Rdiv, Rsqr; rewrite Rinv_mult_distr; try discrR || assumption. repeat apply prod_neq_R0; assumption || (apply Rinv_neq_0_compat; assumption) || (apply Rinv_neq_0_compat; discrR) || - (red in |- *; intro H14; rewrite H14 in H6; elim (Rlt_irrefl _ H6)). - change (0 < Rabs (Rsqr (f2 x) * f2 x * eps / (8 * f1 x * l2))) in |- *; + (red; intro H14; rewrite H14 in H6; elim (Rlt_irrefl _ H6)). + change (0 < Rabs (Rsqr (f2 x) * f2 x * eps / (8 * f1 x * l2))); apply Rabs_pos_lt. - unfold Rdiv, Rsqr in |- *; rewrite Rinv_mult_distr. + unfold Rdiv, Rsqr; rewrite Rinv_mult_distr. repeat apply prod_neq_R0; assumption || (apply Rinv_neq_0_compat; assumption) || (apply Rinv_neq_0_compat; discrR) || - (red in |- *; intro H13; rewrite H13 in H6; elim (Rlt_irrefl _ H6)). + (red; intro H13; rewrite H13 in H6; elim (Rlt_irrefl _ H6)). apply prod_neq_R0; [ discrR | assumption ]. apply prod_neq_R0; [ discrR | assumption ]. assumption. apply Rabs_pos_lt. - unfold Rdiv, Rsqr in |- *; rewrite Rinv_mult_distr; + unfold Rdiv, Rsqr; rewrite Rinv_mult_distr; [ idtac | discrR | assumption ]. repeat apply prod_neq_R0; assumption || (apply Rinv_neq_0_compat; assumption) || (apply Rinv_neq_0_compat; discrR) || - (red in |- *; intro H11; rewrite H11 in H6; elim (Rlt_irrefl _ H6)). + (red; intro H11; rewrite H11 in H6; elim (Rlt_irrefl _ H6)). intros. - unfold Rdiv in |- *. + unfold Rdiv. apply Rmult_lt_reg_l with (Rabs (f2 (x + a))). apply Rabs_pos_lt; apply H2. apply Rlt_le_trans with (Rmin eps_f2 alp_f2). @@ -739,13 +739,13 @@ Proof. unfold Rminus in H7; assumption. intros. case (Req_dec x x0); intro. - rewrite <- H5; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + rewrite <- H5; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply Rabs_pos_lt; assumption | apply Rinv_0_lt_compat; prove_sup0 ]. elim H3; intros. apply H7. split. - unfold D_x, no_cond in |- *; split. + unfold D_x, no_cond; split. trivial. assumption. assumption. @@ -756,7 +756,7 @@ Lemma derivable_pt_div : derivable_pt f1 x -> derivable_pt f2 x -> f2 x <> 0 -> derivable_pt (f1 / f2) x. Proof. - unfold derivable_pt in |- *. + unfold derivable_pt. intros f1 f2 x X X0 H. elim X; intros. elim X0; intros. @@ -769,7 +769,7 @@ Lemma derivable_div : derivable f1 -> derivable f2 -> (forall x:R, f2 x <> 0) -> derivable (f1 / f2). Proof. - unfold derivable in |- *; intros f1 f2 X X0 H x. + unfold derivable; intros f1 f2 X X0 H x. apply (derivable_pt_div _ _ _ (X x) (X0 x) (H x)). Qed. diff --git a/theories/Reals/Ranalysis4.v b/theories/Reals/Ranalysis4.v index cc658fee..00c07592 100644 --- a/theories/Reals/Ranalysis4.v +++ b/theories/Reals/Ranalysis4.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,11 +9,11 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. -Require Import Rtrigo. +Require Import Rtrigo1. Require Import Ranalysis1. Require Import Ranalysis3. Require Import Exp_prop. -Open Local Scope R_scope. +Local Open Scope R_scope. (**********) Lemma derivable_pt_inv : @@ -26,12 +26,12 @@ Proof. apply derivable_pt_const. assumption. assumption. - unfold div_fct, inv_fct, fct_cte in |- *; intro X0; elim X0; intros; - unfold derivable_pt in |- *; exists x0; - unfold derivable_pt_abs in |- *; unfold derivable_pt_lim in |- *; + unfold div_fct, inv_fct, fct_cte; intro X0; elim X0; intros; + unfold derivable_pt; exists x0; + unfold derivable_pt_abs; unfold derivable_pt_lim; unfold derivable_pt_abs in p; unfold derivable_pt_lim in p; intros; elim (p eps H0); intros; exists x1; intros; - unfold Rdiv in H1; unfold Rdiv in |- *; rewrite <- (Rmult_1_l (/ f x)); + unfold Rdiv in H1; unfold Rdiv; rewrite <- (Rmult_1_l (/ f x)); rewrite <- (Rmult_1_l (/ f (x + h))). apply H1; assumption. Qed. @@ -41,10 +41,10 @@ Lemma pr_nu_var : forall (f g:R -> R) (x:R) (pr1:derivable_pt f x) (pr2:derivable_pt g x), f = g -> derive_pt f x pr1 = derive_pt g x pr2. Proof. - unfold derivable_pt, derive_pt in |- *; intros. + unfold derivable_pt, derive_pt; intros. elim pr1; intros. elim pr2; intros. - simpl in |- *. + simpl. rewrite H in p. apply uniqueness_limite with g x; assumption. Qed. @@ -54,17 +54,17 @@ Lemma pr_nu_var2 : forall (f g:R -> R) (x:R) (pr1:derivable_pt f x) (pr2:derivable_pt g x), (forall h:R, f h = g h) -> derive_pt f x pr1 = derive_pt g x pr2. Proof. - unfold derivable_pt, derive_pt in |- *; intros. + unfold derivable_pt, derive_pt; intros. elim pr1; intros. elim pr2; intros. - simpl in |- *. + simpl. assert (H0 := uniqueness_step2 _ _ _ p). assert (H1 := uniqueness_step2 _ _ _ p0). cut (limit1_in (fun h:R => (f (x + h) - f x) / h) (fun h:R => h <> 0) x1 0). intro; assert (H3 := uniqueness_step1 _ _ _ _ H0 H2). assumption. - unfold limit1_in in |- *; unfold limit_in in |- *; unfold dist in |- *; - simpl in |- *; unfold R_dist in |- *; unfold limit1_in in H1; + unfold limit1_in; unfold limit_in; unfold dist; + simpl; unfold R_dist; unfold limit1_in in H1; unfold limit_in in H1; unfold dist in H1; simpl in H1; unfold R_dist in H1. intros; elim (H1 eps H2); intros. @@ -80,7 +80,7 @@ Lemma derivable_inv : forall f:R -> R, (forall x:R, f x <> 0) -> derivable f -> derivable (/ f). Proof. intros f H X. - unfold derivable in |- *; intro x. + unfold derivable; intro x. apply derivable_pt_inv. apply (H x). apply (X x). @@ -95,25 +95,25 @@ Proof. replace (derive_pt (/ f) x (derivable_pt_inv f x na pr)) with (derive_pt (fct_cte 1 / f) x (derivable_pt_div (fct_cte 1) f x (derivable_pt_const 1 x) pr na)). - rewrite derive_pt_div; rewrite derive_pt_const; unfold fct_cte in |- *; - rewrite Rmult_0_l; rewrite Rmult_1_r; unfold Rminus in |- *; + rewrite derive_pt_div; rewrite derive_pt_const; unfold fct_cte; + rewrite Rmult_0_l; rewrite Rmult_1_r; unfold Rminus; rewrite Rplus_0_l; reflexivity. apply pr_nu_var2. - intro; unfold div_fct, fct_cte, inv_fct in |- *. - unfold Rdiv in |- *; ring. + intro; unfold div_fct, fct_cte, inv_fct. + unfold Rdiv; ring. Qed. (** Rabsolu *) Lemma Rabs_derive_1 : forall x:R, 0 < x -> derivable_pt_lim Rabs x 1. Proof. intros. - unfold derivable_pt_lim in |- *; intros. + unfold derivable_pt_lim; intros. exists (mkposreal x H); intros. rewrite (Rabs_right x). rewrite (Rabs_right (x + h)). rewrite Rplus_comm. - unfold Rminus in |- *; rewrite Rplus_assoc; rewrite Rplus_opp_r. - rewrite Rplus_0_r; unfold Rdiv in |- *; rewrite <- Rinv_r_sym. + unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_r. + rewrite Rplus_0_r; unfold Rdiv; rewrite <- Rinv_r_sym. rewrite Rplus_opp_r; rewrite Rabs_R0; apply H0. apply H1. apply Rle_ge. @@ -131,16 +131,16 @@ Qed. Lemma Rabs_derive_2 : forall x:R, x < 0 -> derivable_pt_lim Rabs x (-1). Proof. intros. - unfold derivable_pt_lim in |- *; intros. + unfold derivable_pt_lim; intros. cut (0 < - x). intro; exists (mkposreal (- x) H1); intros. rewrite (Rabs_left x). rewrite (Rabs_left (x + h)). rewrite Rplus_comm. rewrite Ropp_plus_distr. - unfold Rminus in |- *; rewrite Ropp_involutive; rewrite Rplus_assoc; + unfold Rminus; rewrite Ropp_involutive; rewrite Rplus_assoc; rewrite Rplus_opp_l. - rewrite Rplus_0_r; unfold Rdiv in |- *. + rewrite Rplus_0_r; unfold Rdiv. rewrite Ropp_mult_distr_l_reverse. rewrite <- Rinv_r_sym. rewrite Ropp_involutive; rewrite Rplus_opp_l; rewrite Rabs_R0; apply H0. @@ -163,24 +163,24 @@ Proof. intros. case (total_order_T x 0); intro. elim s; intro. - unfold derivable_pt in |- *; exists (-1). + unfold derivable_pt; exists (-1). apply (Rabs_derive_2 x a). elim H; exact b. - unfold derivable_pt in |- *; exists 1. + unfold derivable_pt; exists 1. apply (Rabs_derive_1 x r). Qed. (** Rabsolu is continuous for all x *) Lemma Rcontinuity_abs : continuity Rabs. Proof. - unfold continuity in |- *; intro. + unfold continuity; intro. case (Req_dec x 0); intro. - unfold continuity_pt in |- *; unfold continue_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold R_dist in |- *; intros; exists eps; + unfold continuity_pt; unfold continue_in; + unfold limit1_in; unfold limit_in; + simpl; unfold R_dist; intros; exists eps; split. apply H0. - intros; rewrite H; rewrite Rabs_R0; unfold Rminus in |- *; rewrite Ropp_0; + intros; rewrite H; rewrite Rabs_R0; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite Rabs_Rabsolu; elim H1; intros; rewrite H in H3; unfold Rminus in H3; rewrite Ropp_0 in H3; rewrite Rplus_0_r in H3; apply H3. @@ -192,11 +192,11 @@ Lemma continuity_finite_sum : forall (An:nat -> R) (N:nat), continuity (fun y:R => sum_f_R0 (fun k:nat => An k * y ^ k) N). Proof. - intros; unfold continuity in |- *; intro. + intros; unfold continuity; intro. induction N as [| N HrecN]. - simpl in |- *. + simpl. apply continuity_pt_const. - unfold constant in |- *; intros; reflexivity. + unfold constant; intros; reflexivity. replace (fun y:R => sum_f_R0 (fun k:nat => An k * y ^ k) (S N)) with ((fun y:R => sum_f_R0 (fun k:nat => (An k * y ^ k)%R) N) + (fun y:R => (An (S N) * y ^ S N)%R))%F. @@ -222,7 +222,7 @@ Proof. cut (N = 0%nat \/ (0 < N)%nat). intro; elim H0; intro. rewrite H1. - simpl in |- *. + simpl. replace (fun y:R => An 0%nat * 1 + An 1%nat * (y * 1)) with (fct_cte (An 0%nat * 1) + mult_real_fct (An 1%nat) (id * fct_cte 1))%F. replace (1 * An 1%nat * 1) with (0 + An 1%nat * (1 * fct_cte 1 x + id x * 0)). @@ -232,7 +232,7 @@ Proof. apply derivable_pt_lim_mult. apply derivable_pt_lim_id. apply derivable_pt_lim_const. - unfold fct_cte, id in |- *; ring. + unfold fct_cte, id; ring. reflexivity. replace (fun y:R => sum_f_R0 (fun k:nat => An k * y ^ k) (S N)) with ((fun y:R => sum_f_R0 (fun k:nat => (An k * y ^ k)%R) N) + @@ -248,7 +248,7 @@ Proof. (mult_real_fct (An (S N)) (fun y:R => y ^ S N)). apply derivable_pt_lim_scal. replace (pred (S N)) with N; [ idtac | reflexivity ]. - pattern N at 3 in |- *; replace N with (pred (S N)). + pattern N at 3; replace N with (pred (S N)). apply derivable_pt_lim_pow. reflexivity. reflexivity. @@ -259,10 +259,10 @@ Proof. rewrite <- H2. replace (pred (S N)) with N; [ idtac | reflexivity ]. ring. - simpl in |- *. + simpl. apply S_pred with 0%nat; assumption. - unfold plus_fct in |- *. - simpl in |- *; reflexivity. + unfold plus_fct. + simpl; reflexivity. inversion H. left; reflexivity. right; apply lt_le_trans with 1%nat; [ apply lt_O_Sn | assumption ]. @@ -278,7 +278,7 @@ Lemma derivable_pt_lim_finite_sum : Proof. intros. induction N as [| N HrecN]. - simpl in |- *. + simpl. rewrite Rmult_1_r. replace (fun _:R => An 0%nat) with (fct_cte (An 0%nat)); [ apply derivable_pt_lim_const | reflexivity ]. @@ -290,7 +290,7 @@ Lemma derivable_pt_finite_sum : derivable_pt (fun y:R => sum_f_R0 (fun k:nat => An k * y ^ k) N) x. Proof. intros. - unfold derivable_pt in |- *. + unfold derivable_pt. assert (H := derivable_pt_lim_finite_sum An x N). induction N as [| N HrecN]. exists 0; apply H. @@ -303,14 +303,14 @@ Lemma derivable_finite_sum : forall (An:nat -> R) (N:nat), derivable (fun y:R => sum_f_R0 (fun k:nat => An k * y ^ k) N). Proof. - intros; unfold derivable in |- *; intro; apply derivable_pt_finite_sum. + intros; unfold derivable; intro; apply derivable_pt_finite_sum. Qed. (** Regularity of hyperbolic functions *) Lemma derivable_pt_lim_cosh : forall x:R, derivable_pt_lim cosh x (sinh x). Proof. intro. - unfold cosh, sinh in |- *; unfold Rdiv in |- *. + unfold cosh, sinh; unfold Rdiv. replace (fun x0:R => (exp x0 + exp (- x0)) * / 2) with ((exp + comp exp (- id)) * fct_cte (/ 2))%F; [ idtac | reflexivity ]. replace ((exp x - exp (- x)) * / 2) with @@ -324,13 +324,13 @@ Proof. apply derivable_pt_lim_id. apply derivable_pt_lim_exp. apply derivable_pt_lim_const. - unfold plus_fct, mult_real_fct, comp, opp_fct, id, fct_cte in |- *; ring. + unfold plus_fct, mult_real_fct, comp, opp_fct, id, fct_cte; ring. Qed. Lemma derivable_pt_lim_sinh : forall x:R, derivable_pt_lim sinh x (cosh x). Proof. intro. - unfold cosh, sinh in |- *; unfold Rdiv in |- *. + unfold cosh, sinh; unfold Rdiv. replace (fun x0:R => (exp x0 - exp (- x0)) * / 2) with ((exp - comp exp (- id)) * fct_cte (/ 2))%F; [ idtac | reflexivity ]. replace ((exp x + exp (- x)) * / 2) with @@ -344,13 +344,13 @@ Proof. apply derivable_pt_lim_id. apply derivable_pt_lim_exp. apply derivable_pt_lim_const. - unfold plus_fct, mult_real_fct, comp, opp_fct, id, fct_cte in |- *; ring. + unfold plus_fct, mult_real_fct, comp, opp_fct, id, fct_cte; ring. Qed. Lemma derivable_pt_exp : forall x:R, derivable_pt exp x. Proof. intro. - unfold derivable_pt in |- *. + unfold derivable_pt. exists (exp x). apply derivable_pt_lim_exp. Qed. @@ -358,7 +358,7 @@ Qed. Lemma derivable_pt_cosh : forall x:R, derivable_pt cosh x. Proof. intro. - unfold derivable_pt in |- *. + unfold derivable_pt. exists (sinh x). apply derivable_pt_lim_cosh. Qed. @@ -366,24 +366,24 @@ Qed. Lemma derivable_pt_sinh : forall x:R, derivable_pt sinh x. Proof. intro. - unfold derivable_pt in |- *. + unfold derivable_pt. exists (cosh x). apply derivable_pt_lim_sinh. Qed. Lemma derivable_exp : derivable exp. Proof. - unfold derivable in |- *; apply derivable_pt_exp. + unfold derivable; apply derivable_pt_exp. Qed. Lemma derivable_cosh : derivable cosh. Proof. - unfold derivable in |- *; apply derivable_pt_cosh. + unfold derivable; apply derivable_pt_cosh. Qed. Lemma derivable_sinh : derivable sinh. Proof. - unfold derivable in |- *; apply derivable_pt_sinh. + unfold derivable; apply derivable_pt_sinh. Qed. Lemma derive_pt_exp : diff --git a/theories/Reals/Ranalysis5.v b/theories/Reals/Ranalysis5.v new file mode 100644 index 00000000..c8a2e1a8 --- /dev/null +++ b/theories/Reals/Ranalysis5.v @@ -0,0 +1,1348 @@ +Require Import Rbase. +Require Import Ranalysis_reg. +Require Import Rfunctions. +Require Import Rseries. +Require Import Fourier. +Require Import RiemannInt. +Require Import SeqProp. +Require Import Max. +Local Open Scope R_scope. + +(** * Preliminaries lemmas *) + +Lemma f_incr_implies_g_incr_interv : forall f g:R->R, forall lb ub, + lb < ub -> + (forall x y, lb <= x -> x < y -> y <= ub -> f x < f y) -> + (forall x, f lb <= x -> x <= f ub -> (comp f g) x = id x) -> + (forall x , f lb <= x -> x <= f ub -> lb <= g x <= ub) -> + (forall x y, f lb <= x -> x < y -> y <= f ub -> g x < g y). +Proof. +intros f g lb ub lb_lt_ub f_incr f_eq_g g_ok x y lb_le_x x_lt_y y_le_ub. + assert (x_encad : f lb <= x <= f ub). + split ; [assumption | apply Rle_trans with (r2:=y) ; [apply Rlt_le|] ; assumption]. + assert (y_encad : f lb <= y <= f ub). + split ; [apply Rle_trans with (r2:=x) ; [|apply Rlt_le] ; assumption | assumption]. + assert (Temp1 : lb <= lb) by intuition ; assert (Temp2 : ub <= ub) by intuition. + assert (gx_encad := g_ok _ (proj1 x_encad) (proj2 x_encad)). + assert (gy_encad := g_ok _ (proj1 y_encad) (proj2 y_encad)). + clear Temp1 Temp2. + case (Rlt_dec (g x) (g y)). + intuition. + intros Hfalse. + assert (Temp := Rnot_lt_le _ _ Hfalse). + assert (Hcontradiction : y <= x). + replace y with (id y) by intuition ; replace x with (id x) by intuition ; + rewrite <- f_eq_g. rewrite <- f_eq_g. + assert (f_incr2 : forall x y, lb <= x -> x <= y -> y < ub -> f x <= f y). + intros m n lb_le_m m_le_n n_lt_ub. + case (m_le_n). + intros ; apply Rlt_le ; apply f_incr ; [| | apply Rlt_le] ; assumption. + intros Hyp ; rewrite Hyp ; apply Req_le ; reflexivity. + apply f_incr2. + intuition. intuition. + Focus 3. intuition. + Focus 2. intuition. + Focus 2. intuition. Focus 2. intuition. + assert (Temp2 : g x <> ub). + intro Hf. + assert (Htemp : (comp f g) x = f ub). + unfold comp ; rewrite Hf ; reflexivity. + rewrite f_eq_g in Htemp ; unfold id in Htemp. + assert (Htemp2 : x < f ub). + apply Rlt_le_trans with (r2:=y) ; intuition. + clear -Htemp Htemp2. fourier. + intuition. intuition. + clear -Temp2 gx_encad. + case (proj2 gx_encad). + intuition. + intro Hfalse ; apply False_ind ; apply Temp2 ; assumption. + apply False_ind. clear - Hcontradiction x_lt_y. fourier. +Qed. + +Lemma derivable_pt_id_interv : forall (lb ub x:R), + lb <= x <= ub -> + derivable_pt id x. +Proof. +intros. + reg. +Qed. + +Lemma pr_nu_var2_interv : forall (f g : R -> R) (lb ub x : R) (pr1 : derivable_pt f x) + (pr2 : derivable_pt g x), + lb < ub -> + lb < x < ub -> + (forall h : R, lb < h < ub -> f h = g h) -> derive_pt f x pr1 = derive_pt g x pr2. +Proof. +intros f g lb ub x Prf Prg lb_lt_ub x_encad local_eq. +assert (forall x l, lb < x < ub -> (derivable_pt_abs f x l <-> derivable_pt_abs g x l)). + intros a l a_encad. + unfold derivable_pt_abs, derivable_pt_lim. + split. + intros Hyp eps eps_pos. + elim (Hyp eps eps_pos) ; intros delta Hyp2. + assert (Pos_cond : Rmin delta (Rmin (ub - a) (a - lb)) > 0). + clear-a lb ub a_encad delta. + apply Rmin_pos ; [exact (delta.(cond_pos)) | apply Rmin_pos ] ; apply Rlt_Rminus ; intuition. + exists (mkposreal (Rmin delta (Rmin (ub - a) (a - lb))) Pos_cond). + intros h h_neq h_encad. + replace (g (a + h) - g a) with (f (a + h) - f a). + apply Hyp2 ; intuition. + apply Rlt_le_trans with (r2:=Rmin delta (Rmin (ub - a) (a - lb))). + assumption. apply Rmin_l. + assert (local_eq2 : forall h : R, lb < h < ub -> - f h = - g h). + intros ; apply Ropp_eq_compat ; intuition. + rewrite local_eq ; unfold Rminus. rewrite local_eq2. reflexivity. + assumption. + assert (Sublemma2 : forall x y, Rabs x < Rabs y -> y > 0 -> x < y). + intros m n Hyp_abs y_pos. apply Rlt_le_trans with (r2:=Rabs n). + apply Rle_lt_trans with (r2:=Rabs m) ; [ | assumption] ; apply RRle_abs. + apply Req_le ; apply Rabs_right ; apply Rgt_ge ; assumption. + split. + assert (Sublemma : forall x y z, -z < y - x -> x < y + z). + intros ; fourier. + apply Sublemma. + apply Sublemma2. rewrite Rabs_Ropp. + apply Rlt_le_trans with (r2:=a-lb) ; [| apply RRle_abs] ; + apply Rlt_le_trans with (r2:=Rmin (ub - a) (a - lb)) ; [| apply Rmin_r] ; + apply Rlt_le_trans with (r2:=Rmin delta (Rmin (ub - a) (a - lb))) ; [| apply Rmin_r] ; assumption. + apply Rlt_le_trans with (r2:=Rmin (ub - a) (a - lb)) ; [| apply Rmin_r] ; + apply Rlt_le_trans with (r2:=Rmin delta (Rmin (ub - a) (a - lb))) ; [| apply Rmin_r] ; assumption. + assert (Sublemma : forall x y z, y < z - x -> x + y < z). + intros ; fourier. + apply Sublemma. + apply Sublemma2. + apply Rlt_le_trans with (r2:=ub-a) ; [| apply RRle_abs] ; + apply Rlt_le_trans with (r2:=Rmin (ub - a) (a - lb)) ; [| apply Rmin_l] ; + apply Rlt_le_trans with (r2:=Rmin delta (Rmin (ub - a) (a - lb))) ; [| apply Rmin_r] ; assumption. + apply Rlt_le_trans with (r2:=Rmin (ub - a) (a - lb)) ; [| apply Rmin_l] ; + apply Rlt_le_trans with (r2:=Rmin delta (Rmin (ub - a) (a - lb))) ; [| apply Rmin_r] ; assumption. + intros Hyp eps eps_pos. + elim (Hyp eps eps_pos) ; intros delta Hyp2. + assert (Pos_cond : Rmin delta (Rmin (ub - a) (a - lb)) > 0). + clear-a lb ub a_encad delta. + apply Rmin_pos ; [exact (delta.(cond_pos)) | apply Rmin_pos ] ; apply Rlt_Rminus ; intuition. + exists (mkposreal (Rmin delta (Rmin (ub - a) (a - lb))) Pos_cond). + intros h h_neq h_encad. + replace (f (a + h) - f a) with (g (a + h) - g a). + apply Hyp2 ; intuition. + apply Rlt_le_trans with (r2:=Rmin delta (Rmin (ub - a) (a - lb))). + assumption. apply Rmin_l. + assert (local_eq2 : forall h : R, lb < h < ub -> - f h = - g h). + intros ; apply Ropp_eq_compat ; intuition. + rewrite local_eq ; unfold Rminus. rewrite local_eq2. reflexivity. + assumption. + assert (Sublemma2 : forall x y, Rabs x < Rabs y -> y > 0 -> x < y). + intros m n Hyp_abs y_pos. apply Rlt_le_trans with (r2:=Rabs n). + apply Rle_lt_trans with (r2:=Rabs m) ; [ | assumption] ; apply RRle_abs. + apply Req_le ; apply Rabs_right ; apply Rgt_ge ; assumption. + split. + assert (Sublemma : forall x y z, -z < y - x -> x < y + z). + intros ; fourier. + apply Sublemma. + apply Sublemma2. rewrite Rabs_Ropp. + apply Rlt_le_trans with (r2:=a-lb) ; [| apply RRle_abs] ; + apply Rlt_le_trans with (r2:=Rmin (ub - a) (a - lb)) ; [| apply Rmin_r] ; + apply Rlt_le_trans with (r2:=Rmin delta (Rmin (ub - a) (a - lb))) ; [| apply Rmin_r] ; assumption. + apply Rlt_le_trans with (r2:=Rmin (ub - a) (a - lb)) ; [| apply Rmin_r] ; + apply Rlt_le_trans with (r2:=Rmin delta (Rmin (ub - a) (a - lb))) ; [| apply Rmin_r] ; assumption. + assert (Sublemma : forall x y z, y < z - x -> x + y < z). + intros ; fourier. + apply Sublemma. + apply Sublemma2. + apply Rlt_le_trans with (r2:=ub-a) ; [| apply RRle_abs] ; + apply Rlt_le_trans with (r2:=Rmin (ub - a) (a - lb)) ; [| apply Rmin_l] ; + apply Rlt_le_trans with (r2:=Rmin delta (Rmin (ub - a) (a - lb))) ; [| apply Rmin_r] ; assumption. + apply Rlt_le_trans with (r2:=Rmin (ub - a) (a - lb)) ; [| apply Rmin_l] ; + apply Rlt_le_trans with (r2:=Rmin delta (Rmin (ub - a) (a - lb))) ; [| apply Rmin_r] ; assumption. + unfold derivable_pt in Prf. + unfold derivable_pt in Prg. + elim Prf; intros. + elim Prg; intros. + assert (Temp := p); rewrite H in Temp. + unfold derivable_pt_abs in p. + unfold derivable_pt_abs in p0. + simpl in |- *. + apply (uniqueness_limite g x x0 x1 Temp p0). + assumption. +Qed. + + +(* begin hide *) +Lemma leftinv_is_rightinv : forall (f g:R->R), + (forall x y, x < y -> f x < f y) -> + (forall x, (comp f g) x = id x) -> + (forall x, (comp g f) x = id x). +Proof. +intros f g f_incr Hyp x. + assert (forall x, f (g (f x)) = f x). + intros ; apply Hyp. + assert(f_inj : forall x y, f x = f y -> x = y). + intros a b fa_eq_fb. + case(total_order_T a b). + intro s ; case s ; clear s. + intro Hf. + assert (Hfalse := f_incr a b Hf). + apply False_ind. apply (Rlt_not_eq (f a) (f b)) ; assumption. + intuition. + intro Hf. assert (Hfalse := f_incr b a Hf). + apply False_ind. apply (Rlt_not_eq (f b) (f a)) ; [|symmetry] ; assumption. + apply f_inj. unfold comp. + unfold comp in Hyp. + rewrite Hyp. + unfold id. + reflexivity. +Qed. +(* end hide *) + +Lemma leftinv_is_rightinv_interv : forall (f g:R->R) (lb ub:R), + (forall x y, lb <= x -> x < y -> y <= ub -> f x < f y) -> + (forall y, f lb <= y -> y <= f ub -> (comp f g) y = id y) -> + (forall x, f lb <= x -> x <= f ub -> lb <= g x <= ub) -> + forall x, + lb <= x <= ub -> + (comp g f) x = id x. +Proof. +intros f g lb ub f_incr_interv Hyp g_wf x x_encad. + assert(f_inj : forall x y, lb <= x <= ub -> lb <= y <= ub -> f x = f y -> x = y). + intros a b a_encad b_encad fa_eq_fb. + case(total_order_T a b). + intro s ; case s ; clear s. + intro Hf. + assert (Hfalse := f_incr_interv a b (proj1 a_encad) Hf (proj2 b_encad)). + apply False_ind. apply (Rlt_not_eq (f a) (f b)) ; assumption. + intuition. + intro Hf. assert (Hfalse := f_incr_interv b a (proj1 b_encad) Hf (proj2 a_encad)). + apply False_ind. apply (Rlt_not_eq (f b) (f a)) ; [|symmetry] ; assumption. + assert (f_incr_interv2 : forall x y, lb <= x -> x <= y -> y <= ub -> f x <= f y). + intros m n cond1 cond2 cond3. + case cond2. + intro cond. apply Rlt_le ; apply f_incr_interv ; assumption. + intro cond ; right ; rewrite cond ; reflexivity. + assert (Hyp2:forall x, lb <= x <= ub -> f (g (f x)) = f x). + intros ; apply Hyp. apply f_incr_interv2 ; intuition. + apply f_incr_interv2 ; intuition. + unfold comp ; unfold comp in Hyp. + apply f_inj. + apply g_wf ; apply f_incr_interv2 ; intuition. + unfold id ; assumption. + apply Hyp2 ; unfold id ; assumption. +Qed. + + +(** Intermediate Value Theorem on an Interval (Proof mainly taken from Reals.Rsqrt_def) and its corollary *) + +Lemma IVT_interv_prelim0 : forall (x y:R) (P:R->bool) (N:nat), + x < y -> + x <= Dichotomy_ub x y P N <= y /\ x <= Dichotomy_lb x y P N <= y. +Proof. +assert (Sublemma : forall x y lb ub, lb <= x <= ub /\ lb <= y <= ub -> lb <= (x+y) / 2 <= ub). + intros x y lb ub Hyp. + split. + replace lb with ((lb + lb) * /2) by field. + unfold Rdiv ; apply Rmult_le_compat_r ; intuition. + replace ub with ((ub + ub) * /2) by field. + unfold Rdiv ; apply Rmult_le_compat_r ; intuition. +intros x y P N x_lt_y. +induction N. + simpl ; intuition. + simpl. + case (P ((Dichotomy_lb x y P N + Dichotomy_ub x y P N) / 2)). + split. apply Sublemma ; intuition. + intuition. + split. intuition. + apply Sublemma ; intuition. +Qed. + +Lemma IVT_interv_prelim1 : forall (x y x0:R) (D : R -> bool), + x < y -> + Un_cv (dicho_up x y D) x0 -> + x <= x0 <= y. +Proof. +intros x y x0 D x_lt_y bnd. + assert (Main : forall n, x <= dicho_up x y D n <= y). + intro n. unfold dicho_up. + apply (proj1 (IVT_interv_prelim0 x y D n x_lt_y)). + split. + apply Rle_cv_lim with (Vn:=dicho_up x y D) (Un:=fun n => x). + intro n ; exact (proj1 (Main n)). + unfold Un_cv ; intros ; exists 0%nat ; intros ; unfold R_dist ; replace (x -x) with 0 by field ; rewrite Rabs_R0 ; assumption. + assumption. + apply Rle_cv_lim with (Un:=dicho_up x y D) (Vn:=fun n => y). + intro n ; exact (proj2 (Main n)). + assumption. + unfold Un_cv ; intros ; exists 0%nat ; intros ; unfold R_dist ; replace (y -y) with 0 by field ; rewrite Rabs_R0 ; assumption. +Qed. + +Lemma IVT_interv : forall (f : R -> R) (x y : R), + (forall a, x <= a <= y -> continuity_pt f a) -> + x < y -> + f x < 0 -> + 0 < f y -> + {z : R | x <= z <= y /\ f z = 0}. +Proof. +intros. (* f x y f_cont_interv x_lt_y fx_neg fy_pos.*) + cut (x <= y). + intro. + generalize (dicho_lb_cv x y (fun z:R => cond_positivity (f z)) H3). + generalize (dicho_up_cv x y (fun z:R => cond_positivity (f z)) H3). + intros X X0. + elim X; intros. + elim X0; intros. + assert (H4 := cv_dicho _ _ _ _ _ H3 p0 p). + rewrite H4 in p0. + exists x0. + split. + split. + apply Rle_trans with (dicho_lb x y (fun z:R => cond_positivity (f z)) 0). + simpl in |- *. + right; reflexivity. + apply growing_ineq. + apply dicho_lb_growing; assumption. + assumption. + apply Rle_trans with (dicho_up x y (fun z:R => cond_positivity (f z)) 0). + apply decreasing_ineq. + apply dicho_up_decreasing; assumption. + assumption. + right; reflexivity. + 2: left; assumption. + set (Vn := fun n:nat => dicho_lb x y (fun z:R => cond_positivity (f z)) n). + set (Wn := fun n:nat => dicho_up x y (fun z:R => cond_positivity (f z)) n). + cut ((forall n:nat, f (Vn n) <= 0) -> f x0 <= 0). + cut ((forall n:nat, 0 <= f (Wn n)) -> 0 <= f x0). + intros. + cut (forall n:nat, f (Vn n) <= 0). + cut (forall n:nat, 0 <= f (Wn n)). + intros. + assert (H9 := H6 H8). + assert (H10 := H5 H7). + apply Rle_antisym; assumption. + intro. + unfold Wn in |- *. + cut (forall z:R, cond_positivity z = true <-> 0 <= z). + intro. + assert (H8 := dicho_up_car x y (fun z:R => cond_positivity (f z)) n). + elim (H7 (f (dicho_up x y (fun z:R => cond_positivity (f z)) n))); intros. + apply H9. + apply H8. + elim (H7 (f y)); intros. + apply H12. + left; assumption. + intro. + unfold cond_positivity in |- *. + case (Rle_dec 0 z); intro. + split. + intro; assumption. + intro; reflexivity. + split. + intro feqt;discriminate feqt. + intro. + elim n0; assumption. + unfold Vn in |- *. + cut (forall z:R, cond_positivity z = false <-> z < 0). + intros. + assert (H8 := dicho_lb_car x y (fun z:R => cond_positivity (f z)) n). + left. + elim (H7 (f (dicho_lb x y (fun z:R => cond_positivity (f z)) n))); intros. + apply H9. + apply H8. + elim (H7 (f x)); intros. + apply H12. + assumption. + intro. + unfold cond_positivity in |- *. + case (Rle_dec 0 z); intro. + split. + intro feqt; discriminate feqt. + intro; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r H7)). + split. + intro; auto with real. + intro; reflexivity. + cut (Un_cv Wn x0). + intros. + assert (Temp : x <= x0 <= y). + apply IVT_interv_prelim1 with (D:=(fun z : R => cond_positivity (f z))) ; assumption. + assert (H7 := continuity_seq f Wn x0 (H x0 Temp) H5). + case (total_order_T 0 (f x0)); intro. + elim s; intro. + left; assumption. + rewrite <- b; right; reflexivity. + unfold Un_cv in H7; unfold R_dist in H7. + cut (0 < - f x0). + intro. + elim (H7 (- f x0) H8); intros. + cut (x2 >= x2)%nat; [ intro | unfold ge in |- *; apply le_n ]. + assert (H11 := H9 x2 H10). + rewrite Rabs_right in H11. + pattern (- f x0) at 1 in H11; rewrite <- Rplus_0_r in H11. + unfold Rminus in H11; rewrite (Rplus_comm (f (Wn x2))) in H11. + assert (H12 := Rplus_lt_reg_r _ _ _ H11). + assert (H13 := H6 x2). + elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H13 H12)). + apply Rle_ge; left; unfold Rminus in |- *; apply Rplus_le_lt_0_compat. + apply H6. + exact H8. + apply Ropp_0_gt_lt_contravar; assumption. + unfold Wn in |- *; assumption. + cut (Un_cv Vn x0). + intros. + assert (Temp : x <= x0 <= y). + apply IVT_interv_prelim1 with (D:=(fun z : R => cond_positivity (f z))) ; assumption. + assert (H7 := continuity_seq f Vn x0 (H x0 Temp) H5). + case (total_order_T 0 (f x0)); intro. + elim s; intro. + unfold Un_cv in H7; unfold R_dist in H7. + elim (H7 (f x0) a); intros. + cut (x2 >= x2)%nat; [ intro | unfold ge in |- *; apply le_n ]. + assert (H10 := H8 x2 H9). + rewrite Rabs_left in H10. + pattern (f x0) at 2 in H10; rewrite <- Rplus_0_r in H10. + rewrite Ropp_minus_distr' in H10. + unfold Rminus in H10. + assert (H11 := Rplus_lt_reg_r _ _ _ H10). + assert (H12 := H6 x2). + cut (0 < f (Vn x2)). + intro. + elim (Rlt_irrefl _ (Rlt_le_trans _ _ _ H13 H12)). + rewrite <- (Ropp_involutive (f (Vn x2))). + apply Ropp_0_gt_lt_contravar; assumption. + apply Rplus_lt_reg_r with (f x0 - f (Vn x2)). + rewrite Rplus_0_r; replace (f x0 - f (Vn x2) + (f (Vn x2) - f x0)) with 0; + [ unfold Rminus in |- *; apply Rplus_lt_le_0_compat | ring ]. + assumption. + apply Ropp_0_ge_le_contravar; apply Rle_ge; apply H6. + right; rewrite <- b; reflexivity. + left; assumption. + unfold Vn in |- *; assumption. +Qed. + +(* begin hide *) +Ltac case_le H := + let t := type of H in + let h' := fresh in + match t with ?x <= ?y => case (total_order_T x y); + [intros h'; case h'; clear h' | + intros h'; clear -H h'; elimtype False; fourier ] end. +(* end hide *) + + +Lemma f_interv_is_interv : forall (f:R->R) (lb ub y:R), + lb < ub -> + f lb <= y <= f ub -> + (forall x, lb <= x <= ub -> continuity_pt f x) -> + {x | lb <= x <= ub /\ f x = y}. +Proof. +intros f lb ub y lb_lt_ub y_encad f_cont_interv. + case y_encad ; intro y_encad1. + case_le y_encad1 ; intros y_encad2 y_encad3 ; case_le y_encad3. + intro y_encad4. + clear y_encad y_encad1 y_encad3. + assert (Cont : forall a : R, lb <= a <= ub -> continuity_pt (fun x => f x - y) a). + intros a a_encad. unfold continuity_pt, continue_in, limit1_in, limit_in ; simpl ; unfold R_dist. + intros eps eps_pos. elim (f_cont_interv a a_encad eps eps_pos). + intros alpha alpha_pos. destruct alpha_pos as (alpha_pos,Temp). + exists alpha. split. + assumption. intros x x_cond. + replace (f x - y - (f a - y)) with (f x - f a) by field. + exact (Temp x x_cond). + assert (H1 : (fun x : R => f x - y) lb < 0). + apply Rlt_minus. assumption. + assert (H2 : 0 < (fun x : R => f x - y) ub). + apply Rgt_minus ; assumption. + destruct (IVT_interv (fun x => f x - y) lb ub Cont lb_lt_ub H1 H2) as (x,Hx). + exists x. + destruct Hx as (Hyp,Result). + intuition. + intro H ; exists ub ; intuition. + intro H ; exists lb ; intuition. + intro H ; exists ub ; intuition. +Qed. + +(** ** The derivative of a reciprocal function *) + + +(** * Continuity of the reciprocal function *) + +Lemma continuity_pt_recip_prelim : forall (f g:R->R) (lb ub : R) (Pr1:lb < ub), + (forall x y, lb <= x -> x < y -> y <= ub -> f x < f y) -> + (forall x, lb <= x <= ub -> (comp g f) x = id x) -> + (forall a, lb <= a <= ub -> continuity_pt f a) -> + forall b, + f lb < b < f ub -> + continuity_pt g b. +Proof. +assert (Sublemma : forall x y z, Rmax x y < z <-> x < z /\ y < z). + intros x y z. split. + unfold Rmax. case (Rle_dec x y) ; intros Hyp Hyp2. + split. apply Rle_lt_trans with (r2:=y) ; assumption. assumption. + split. assumption. apply Rlt_trans with (r2:=x). + assert (Temp : forall x y, ~ x <= y -> x > y). + intros m n Hypmn. intuition. + apply Temp ; clear Temp ; assumption. + assumption. + intros Hyp. + unfold Rmax. case (Rle_dec x y). + intro ; exact (proj2 Hyp). + intro ; exact (proj1 Hyp). +assert (Sublemma2 : forall x y z, Rmin x y > z <-> x > z /\ y > z). + intros x y z. split. + unfold Rmin. case (Rle_dec x y) ; intros Hyp Hyp2. + split. assumption. + apply Rlt_le_trans with (r2:=x) ; intuition. + split. + apply Rlt_trans with (r2:=y). intuition. + assert (Temp : forall x y, ~ x <= y -> x > y). + intros m n Hypmn. intuition. + apply Temp ; clear Temp ; assumption. + assumption. + intros Hyp. + unfold Rmin. case (Rle_dec x y). + intro ; exact (proj1 Hyp). + intro ; exact (proj2 Hyp). +assert (Sublemma3 : forall x y, x <= y /\ x <> y -> x < y). + intros m n Hyp. unfold Rle in Hyp. + destruct Hyp as (Hyp1,Hyp2). + case Hyp1. + intuition. + intro Hfalse ; apply False_ind ; apply Hyp2 ; exact Hfalse. +intros f g lb ub lb_lt_ub f_incr_interv f_eq_g f_cont_interv b b_encad. + assert (f_incr_interv2 : forall x y, lb <= x -> x <= y -> y <= ub -> f x <= f y). + intros m n cond1 cond2 cond3. + case cond2. + intro cond. apply Rlt_le ; apply f_incr_interv ; assumption. + intro cond ; right ; rewrite cond ; reflexivity. + unfold continuity_pt, continue_in, limit1_in, limit_in ; intros eps eps_pos. + unfold dist ; simpl ; unfold R_dist. + assert (b_encad_e : f lb <= b <= f ub) by intuition. + elim (f_interv_is_interv f lb ub b lb_lt_ub b_encad_e f_cont_interv) ; intros x Temp. + destruct Temp as (x_encad,f_x_b). + assert (lb_lt_x : lb < x). + assert (Temp : x <> lb). + intro Hfalse. + assert (Temp' : b = f lb). + rewrite <- f_x_b ; rewrite Hfalse ; reflexivity. + assert (Temp'' : b <> f lb). + apply Rgt_not_eq ; exact (proj1 b_encad). + apply Temp'' ; exact Temp'. + apply Sublemma3. + split. exact (proj1 x_encad). + assert (Temp2 : forall x y:R, x <> y <-> y <> x). + intros m n. split ; intuition. + rewrite Temp2 ; assumption. + assert (x_lt_ub : x < ub). + assert (Temp : x <> ub). + intro Hfalse. + assert (Temp' : b = f ub). + rewrite <- f_x_b ; rewrite Hfalse ; reflexivity. + assert (Temp'' : b <> f ub). + apply Rlt_not_eq ; exact (proj2 b_encad). + apply Temp'' ; exact Temp'. + apply Sublemma3. + split ; [exact (proj2 x_encad) | assumption]. + pose (x1 := Rmax (x - eps) lb). + pose (x2 := Rmin (x + eps) ub). + assert (Hx1 : x1 = Rmax (x - eps) lb) by intuition. + assert (Hx2 : x2 = Rmin (x + eps) ub) by intuition. + assert (x1_encad : lb <= x1 <= ub). + split. apply RmaxLess2. + apply Rlt_le. rewrite Hx1. rewrite Sublemma. + split. apply Rlt_trans with (r2:=x) ; fourier. + assumption. + assert (x2_encad : lb <= x2 <= ub). + split. apply Rlt_le ; rewrite Hx2 ; apply Rgt_lt ; rewrite Sublemma2. + split. apply Rgt_trans with (r2:=x) ; fourier. + assumption. + apply Rmin_r. + assert (x_lt_x2 : x < x2). + rewrite Hx2. + apply Rgt_lt. rewrite Sublemma2. + split ; fourier. + assert (x1_lt_x : x1 < x). + rewrite Hx1. + rewrite Sublemma. + split ; fourier. + exists (Rmin (f x - f x1) (f x2 - f x)). + split. apply Rmin_pos ; apply Rgt_minus. apply f_incr_interv ; [apply RmaxLess2 | | ] ; fourier. + apply f_incr_interv ; intuition. + intros y Temp. + destruct Temp as (_,y_cond). + rewrite <- f_x_b in y_cond. + assert (Temp : forall x y d1 d2, d1 > 0 -> d2 > 0 -> Rabs (y - x) < Rmin d1 d2 -> x - d1 <= y <= x + d2). + intros. + split. assert (H10 : forall x y z, x - y <= z -> x - z <= y). intuition. fourier. + apply H10. apply Rle_trans with (r2:=Rabs (y0 - x0)). + replace (Rabs (y0 - x0)) with (Rabs (x0 - y0)). apply RRle_abs. + rewrite <- Rabs_Ropp. unfold Rminus ; rewrite Ropp_plus_distr. rewrite Ropp_involutive. + intuition. + apply Rle_trans with (r2:= Rmin d1 d2). apply Rlt_le ; assumption. + apply Rmin_l. + assert (H10 : forall x y z, x - y <= z -> x <= y + z). intuition. fourier. + apply H10. apply Rle_trans with (r2:=Rabs (y0 - x0)). apply RRle_abs. + apply Rle_trans with (r2:= Rmin d1 d2). apply Rlt_le ; assumption. + apply Rmin_r. + assert (Temp' := Temp (f x) y (f x - f x1) (f x2 - f x)). + replace (f x - (f x - f x1)) with (f x1) in Temp' by field. + replace (f x + (f x2 - f x)) with (f x2) in Temp' by field. + assert (T : f x - f x1 > 0). + apply Rgt_minus. apply f_incr_interv ; intuition. + assert (T' : f x2 - f x > 0). + apply Rgt_minus. apply f_incr_interv ; intuition. + assert (Main := Temp' T T' y_cond). + clear Temp Temp' T T'. + assert (x1_lt_x2 : x1 < x2). + apply Rlt_trans with (r2:=x) ; assumption. + assert (f_cont_myinterv : forall a : R, x1 <= a <= x2 -> continuity_pt f a). + intros ; apply f_cont_interv ; split. + apply Rle_trans with (r2 := x1) ; intuition. + apply Rle_trans with (r2 := x2) ; intuition. + elim (f_interv_is_interv f x1 x2 y x1_lt_x2 Main f_cont_myinterv) ; intros x' Temp. + destruct Temp as (x'_encad,f_x'_y). + rewrite <- f_x_b ; rewrite <- f_x'_y. + unfold comp in f_eq_g. rewrite f_eq_g. rewrite f_eq_g. + unfold id. + assert (x'_encad2 : x - eps <= x' <= x + eps). + split. + apply Rle_trans with (r2:=x1) ; [ apply RmaxLess1|] ; intuition. + apply Rle_trans with (r2:=x2) ; [ | apply Rmin_l] ; intuition. + assert (x1_lt_x' : x1 < x'). + apply Sublemma3. + assert (x1_neq_x' : x1 <> x'). + intro Hfalse. rewrite Hfalse, f_x'_y in y_cond. + assert (Hf : Rabs (y - f x) < f x - y). + apply Rlt_le_trans with (r2:=Rmin (f x - y) (f x2 - f x)). fourier. + apply Rmin_l. + assert(Hfin : f x - y < f x - y). + apply Rle_lt_trans with (r2:=Rabs (y - f x)). + replace (Rabs (y - f x)) with (Rabs (f x - y)). apply RRle_abs. + rewrite <- Rabs_Ropp. replace (- (f x - y)) with (y - f x) by field ; reflexivity. fourier. + apply (Rlt_irrefl (f x - y)) ; assumption. + split ; intuition. + assert (x'_lb : x - eps < x'). + apply Sublemma3. + split. intuition. apply Rlt_not_eq. + apply Rle_lt_trans with (r2:=x1) ; [ apply RmaxLess1|] ; intuition. + assert (x'_lt_x2 : x' < x2). + apply Sublemma3. + assert (x1_neq_x' : x' <> x2). + intro Hfalse. rewrite <- Hfalse, f_x'_y in y_cond. + assert (Hf : Rabs (y - f x) < y - f x). + apply Rlt_le_trans with (r2:=Rmin (f x - f x1) (y - f x)). fourier. + apply Rmin_r. + assert(Hfin : y - f x < y - f x). + apply Rle_lt_trans with (r2:=Rabs (y - f x)). apply RRle_abs. fourier. + apply (Rlt_irrefl (y - f x)) ; assumption. + split ; intuition. + assert (x'_ub : x' < x + eps). + apply Sublemma3. + split. intuition. apply Rlt_not_eq. + apply Rlt_le_trans with (r2:=x2) ; [ |rewrite Hx2 ; apply Rmin_l] ; intuition. + apply Rabs_def1 ; fourier. + assumption. + split. apply Rle_trans with (r2:=x1) ; intuition. + apply Rle_trans with (r2:=x2) ; intuition. +Qed. + +Lemma continuity_pt_recip_interv : forall (f g:R->R) (lb ub : R) (Pr1:lb < ub), + (forall x y, lb <= x -> x < y -> y <= ub -> f x < f y) -> + (forall x, f lb <= x -> x <= f ub -> (comp f g) x = id x) -> + (forall x, f lb <= x -> x <= f ub -> lb <= g x <= ub) -> + (forall a, lb <= a <= ub -> continuity_pt f a) -> + forall b, + f lb < b < f ub -> + continuity_pt g b. +Proof. +intros f g lb ub lb_lt_ub f_incr_interv f_eq_g g_wf. +assert (g_eq_f_prelim := leftinv_is_rightinv_interv f g lb ub f_incr_interv f_eq_g). +assert (g_eq_f : forall x, lb <= x <= ub -> (comp g f) x = id x). +intro x ; apply g_eq_f_prelim ; assumption. +apply (continuity_pt_recip_prelim f g lb ub lb_lt_ub f_incr_interv g_eq_f). +Qed. + +(** * Derivability of the reciprocal function *) + +Lemma derivable_pt_lim_recip_interv : forall (f g:R->R) (lb ub x:R) + (Prf:forall a : R, g lb <= a <= g ub -> derivable_pt f a) (Prg : continuity_pt g x), + lb < ub -> + lb < x < ub -> + forall (Prg_incr:g lb <= g x <= g ub), + (forall x, lb <= x <= ub -> (comp f g) x = id x) -> + derive_pt f (g x) (Prf (g x) Prg_incr) <> 0 -> + derivable_pt_lim g x (1 / derive_pt f (g x) (Prf (g x) Prg_incr)). +Proof. +intros f g lb ub x Prf g_cont_pur lb_lt_ub x_encad Prg_incr f_eq_g df_neq. + assert (x_encad2 : lb <= x <= ub). + split ; apply Rlt_le ; intuition. + elim (Prf (g x)); simpl; intros l Hl. + unfold derivable_pt_lim. + intros eps eps_pos. + pose (y := g x). + assert (Hlinv := limit_inv). + assert (Hf_deriv : forall eps:R, + 0 < eps -> + exists delta : posreal, + (forall h:R, + h <> 0 -> Rabs h < delta -> Rabs ((f (g x + h) - f (g x)) / h - l) < eps)). + intros eps0 eps0_pos. + red in Hl ; red in Hl. elim (Hl eps0 eps0_pos). + intros deltatemp Htemp. + exists deltatemp ; exact Htemp. + elim (Hf_deriv eps eps_pos). + intros deltatemp Htemp. + red in Hlinv ; red in Hlinv ; simpl dist in Hlinv ; unfold R_dist in Hlinv. + assert (Hlinv' := Hlinv (fun h => (f (y+h) - f y)/h) (fun h => h <>0) l 0). + unfold limit1_in, limit_in, dist in Hlinv' ; simpl in Hlinv'. unfold R_dist in Hlinv'. + assert (Premisse : (forall eps : R, + eps > 0 -> + exists alp : R, + alp > 0 /\ + (forall x : R, + (fun h => h <>0) x /\ Rabs (x - 0) < alp -> + Rabs ((f (y + x) - f y) / x - l) < eps))). + intros eps0 eps0_pos. + elim (Hf_deriv eps0 eps0_pos). + intros deltatemp' Htemp'. + exists deltatemp'. + split. + exact deltatemp'.(cond_pos). + intros htemp cond. + apply (Htemp' htemp). + exact (proj1 cond). + replace (htemp) with (htemp - 0). + exact (proj2 cond). + intuition. + assert (Premisse2 : l <> 0). + intro l_null. + rewrite l_null in Hl. + apply df_neq. + rewrite derive_pt_eq. + exact Hl. + elim (Hlinv' Premisse Premisse2 eps eps_pos). + intros alpha cond. + assert (alpha_pos := proj1 cond) ; assert (inv_cont := proj2 cond) ; clear cond. + unfold derivable, derivable_pt, derivable_pt_abs, derivable_pt_lim in Prf. + elim (Hl eps eps_pos). + intros delta f_deriv. + assert (g_cont := g_cont_pur). + unfold continuity_pt, continue_in, limit1_in, limit_in in g_cont. + pose (mydelta := Rmin delta alpha). + assert (mydelta_pos : mydelta > 0). + unfold mydelta, Rmin. + case (Rle_dec delta alpha). + intro ; exact (delta.(cond_pos)). + intro ; exact alpha_pos. + elim (g_cont mydelta mydelta_pos). + intros delta' new_g_cont. + assert(delta'_pos := proj1 (new_g_cont)). + clear g_cont ; assert (g_cont := proj2 (new_g_cont)) ; clear new_g_cont. + pose (mydelta'' := Rmin delta' (Rmin (x - lb) (ub - x))). + assert(mydelta''_pos : mydelta'' > 0). + unfold mydelta''. + apply Rmin_pos ; [intuition | apply Rmin_pos] ; apply Rgt_minus ; intuition. + pose (delta'' := mkposreal mydelta'' mydelta''_pos: posreal). + exists delta''. + intros h h_neq h_le_delta'. + assert (lb <= x +h <= ub). + assert (Sublemma2 : forall x y, Rabs x < Rabs y -> y > 0 -> x < y). + intros m n Hyp_abs y_pos. apply Rlt_le_trans with (r2:=Rabs n). + apply Rle_lt_trans with (r2:=Rabs m) ; [ | assumption] ; apply RRle_abs. + apply Req_le ; apply Rabs_right ; apply Rgt_ge ; assumption. + assert (lb <= x + h <= ub). + split. + assert (Sublemma : forall x y z, -z <= y - x -> x <= y + z). + intros ; fourier. + apply Sublemma. + apply Rlt_le ; apply Sublemma2. rewrite Rabs_Ropp. + apply Rlt_le_trans with (r2:=x-lb) ; [| apply RRle_abs] ; + apply Rlt_le_trans with (r2:=Rmin (x - lb) (ub - x)) ; [| apply Rmin_l] ; + apply Rlt_le_trans with (r2:=Rmin delta' (Rmin (x - lb) (ub - x))). + apply Rlt_le_trans with (r2:=delta''). assumption. intuition. apply Rmin_r. + apply Rgt_minus. intuition. + assert (Sublemma : forall x y z, y <= z - x -> x + y <= z). + intros ; fourier. + apply Sublemma. + apply Rlt_le ; apply Sublemma2. + apply Rlt_le_trans with (r2:=ub-x) ; [| apply RRle_abs] ; + apply Rlt_le_trans with (r2:=Rmin (x - lb) (ub - x)) ; [| apply Rmin_r] ; + apply Rlt_le_trans with (r2:=Rmin delta' (Rmin (x - lb) (ub - x))) ; [| apply Rmin_r] ; assumption. + apply Rlt_le_trans with (r2:=delta''). assumption. + apply Rle_trans with (r2:=Rmin delta' (Rmin (x - lb) (ub - x))). intuition. + apply Rle_trans with (r2:=Rmin (x - lb) (ub - x)). apply Rmin_r. apply Rmin_r. + replace ((g (x + h) - g x) / h) with (1/ (h / (g (x + h) - g x))). + assert (Hrewr : h = (comp f g ) (x+h) - (comp f g) x). + rewrite f_eq_g. rewrite f_eq_g ; unfold id. rewrite Rplus_comm ; + unfold Rminus ; rewrite Rplus_assoc ; rewrite Rplus_opp_r. intuition. intuition. + assumption. + split ; [|intuition]. + assert (Sublemma : forall x y z, - z <= y - x -> x <= y + z). + intros ; fourier. + apply Sublemma ; apply Rlt_le ; apply Sublemma2. rewrite Rabs_Ropp. + apply Rlt_le_trans with (r2:=x-lb) ; [| apply RRle_abs] ; + apply Rlt_le_trans with (r2:=Rmin (x - lb) (ub - x)) ; [| apply Rmin_l] ; + apply Rlt_le_trans with (r2:=Rmin delta' (Rmin (x - lb) (ub - x))) ; [| apply Rmin_r] ; assumption. + apply Rgt_minus. intuition. + field. + split. assumption. + intro Hfalse. assert (Hf : g (x+h) = g x) by intuition. + assert ((comp f g) (x+h) = (comp f g) x). + unfold comp ; rewrite Hf ; intuition. + assert (Main : x+h = x). + replace (x +h) with (id (x+h)) by intuition. + assert (Temp : x = id x) by intuition ; rewrite Temp at 2 ; clear Temp. + rewrite <- f_eq_g. rewrite <- f_eq_g. assumption. + intuition. assumption. + assert (h = 0). + apply Rplus_0_r_uniq with (r:=x) ; assumption. + apply h_neq ; assumption. + replace ((g (x + h) - g x) / h) with (1/ (h / (g (x + h) - g x))). + assert (Hrewr : h = (comp f g ) (x+h) - (comp f g) x). + rewrite f_eq_g. rewrite f_eq_g. unfold id ; rewrite Rplus_comm ; + unfold Rminus ; rewrite Rplus_assoc ; rewrite Rplus_opp_r ; intuition. + assumption. assumption. + rewrite Hrewr at 1. + unfold comp. + replace (g(x+h)) with (g x + (g (x+h) - g(x))) by field. + pose (h':=g (x+h) - g x). + replace (g (x+h) - g x) with h' by intuition. + replace (g x + h' - g x) with h' by field. + assert (h'_neq : h' <> 0). + unfold h'. + intro Hfalse. + unfold Rminus in Hfalse ; apply Rminus_diag_uniq in Hfalse. + assert (Hfalse' : (comp f g) (x+h) = (comp f g) x). + intros ; unfold comp ; rewrite Hfalse ; trivial. + rewrite f_eq_g in Hfalse' ; rewrite f_eq_g in Hfalse'. + unfold id in Hfalse'. + apply Rplus_0_r_uniq in Hfalse'. + apply h_neq ; exact Hfalse'. assumption. assumption. assumption. + unfold Rdiv at 1 3; rewrite Rmult_1_l ; rewrite Rmult_1_l. + apply inv_cont. + split. + exact h'_neq. + rewrite Rminus_0_r. + unfold continuity_pt, continue_in, limit1_in, limit_in in g_cont_pur. + elim (g_cont_pur mydelta mydelta_pos). + intros delta3 cond3. + unfold dist in cond3 ; simpl in cond3 ; unfold R_dist in cond3. + unfold h'. + assert (mydelta_le_alpha : mydelta <= alpha). + unfold mydelta, Rmin ; case (Rle_dec delta alpha). + trivial. + intro ; intuition. + apply Rlt_le_trans with (r2:=mydelta). + unfold dist in g_cont ; simpl in g_cont ; unfold R_dist in g_cont ; apply g_cont. + split. + unfold D_x ; simpl. + split. + unfold no_cond ; trivial. + intro Hfalse ; apply h_neq. + apply (Rplus_0_r_uniq x). + symmetry ; assumption. + replace (x + h - x) with h by field. + apply Rlt_le_trans with (r2:=delta''). + assumption ; unfold delta''. intuition. + apply Rle_trans with (r2:=mydelta''). apply Req_le. unfold delta''. intuition. + apply Rmin_l. assumption. + field ; split. + assumption. + intro Hfalse ; apply h_neq. + apply (Rplus_0_r_uniq x). + assert (Hfin : (comp f g) (x+h) = (comp f g) x). + apply Rminus_diag_uniq in Hfalse. + unfold comp. + rewrite Hfalse ; reflexivity. + rewrite f_eq_g in Hfin. rewrite f_eq_g in Hfin. unfold id in Hfin. exact Hfin. + assumption. assumption. +Qed. + +Lemma derivable_pt_recip_interv_prelim0 : forall (f g : R -> R) (lb ub x : R) + (Prf : forall a : R, g lb <= a <= g ub -> derivable_pt f a), + continuity_pt g x -> + lb < ub -> + lb < x < ub -> + forall Prg_incr : g lb <= g x <= g ub, + (forall x0 : R, lb <= x0 <= ub -> comp f g x0 = id x0) -> + derive_pt f (g x) (Prf (g x) Prg_incr) <> 0 -> + derivable_pt g x. +Proof. +intros f g lb ub x Prf g_cont_pt lb_lt_ub x_encad Prg_incr f_eq_g Df_neq. +unfold derivable_pt, derivable_pt_abs. +exists (1 / derive_pt f (g x) (Prf (g x) Prg_incr)). +apply derivable_pt_lim_recip_interv ; assumption. +Qed. + +Lemma derivable_pt_recip_interv_prelim1 :forall (f g:R->R) (lb ub x : R), + lb < ub -> + f lb < x < f ub -> + (forall x : R, f lb <= x -> x <= f ub -> comp f g x = id x) -> + (forall x : R, f lb <= x -> x <= f ub -> lb <= g x <= ub) -> + (forall x y : R, lb <= x -> x < y -> y <= ub -> f x < f y) -> + (forall a : R, lb <= a <= ub -> derivable_pt f a) -> + derivable_pt f (g x). +Proof. +intros f g lb ub x lb_lt_ub x_encad f_eq_g g_ok f_incr f_derivable. + apply f_derivable. + assert (Left_inv := leftinv_is_rightinv_interv f g lb ub f_incr f_eq_g g_ok). + replace lb with ((comp g f) lb). + replace ub with ((comp g f) ub). + unfold comp. + assert (Temp:= f_incr_implies_g_incr_interv f g lb ub lb_lt_ub f_incr f_eq_g g_ok). + split ; apply Rlt_le ; apply Temp ; intuition. + apply Left_inv ; intuition. + apply Left_inv ; intuition. +Qed. + +Lemma derivable_pt_recip_interv : forall (f g:R->R) (lb ub x : R) + (lb_lt_ub:lb < ub) (x_encad:f lb < x < f ub) + (f_eq_g:forall x : R, f lb <= x -> x <= f ub -> comp f g x = id x) + (g_wf:forall x : R, f lb <= x -> x <= f ub -> lb <= g x <= ub) + (f_incr:forall x y : R, lb <= x -> x < y -> y <= ub -> f x < f y) + (f_derivable:forall a : R, lb <= a <= ub -> derivable_pt f a), + derive_pt f (g x) + (derivable_pt_recip_interv_prelim1 f g lb ub x lb_lt_ub + x_encad f_eq_g g_wf f_incr f_derivable) + <> 0 -> + derivable_pt g x. +Proof. +intros f g lb ub x lb_lt_ub x_encad f_eq_g g_wf f_incr f_derivable Df_neq. + assert(g_incr : g (f lb) < g x < g (f ub)). + assert (Temp:= f_incr_implies_g_incr_interv f g lb ub lb_lt_ub f_incr f_eq_g g_wf). + split ; apply Temp ; intuition. + exact (proj1 x_encad). apply Rlt_le ; exact (proj2 x_encad). + apply Rlt_le ; exact (proj1 x_encad). exact (proj2 x_encad). + assert(g_incr2 : g (f lb) <= g x <= g (f ub)). + split ; apply Rlt_le ; intuition. + assert (g_eq_f := leftinv_is_rightinv_interv f g lb ub f_incr f_eq_g g_wf). + unfold comp, id in g_eq_f. + assert (f_derivable2 : forall a : R, g (f lb) <= a <= g (f ub) -> derivable_pt f a). + intros a a_encad ; apply f_derivable. + rewrite g_eq_f in a_encad ; rewrite g_eq_f in a_encad ; intuition. + apply derivable_pt_recip_interv_prelim0 with (f:=f) (lb:=f lb) (ub:=f ub) + (Prf:=f_derivable2) (Prg_incr:=g_incr2). + apply continuity_pt_recip_interv with (f:=f) (lb:=lb) (ub:=ub) ; intuition. + apply derivable_continuous_pt ; apply f_derivable ; intuition. + exact (proj1 x_encad). exact (proj2 x_encad). apply f_incr ; intuition. + assumption. + intros x0 x0_encad ; apply f_eq_g ; intuition. + rewrite pr_nu_var2_interv with (g:=f) (lb:=lb) (ub:=ub) (pr2:=derivable_pt_recip_interv_prelim1 f g lb ub x lb_lt_ub x_encad + f_eq_g g_wf f_incr f_derivable) ; [| |rewrite g_eq_f in g_incr ; rewrite g_eq_f in g_incr| ] ; intuition. +Qed. + +(****************************************************) +(** * Value of the derivative of the reciprocal function *) +(****************************************************) + +Lemma derive_pt_recip_interv_prelim0 : forall (f g:R->R) (lb ub x:R) + (Prf:derivable_pt f (g x)) (Prg:derivable_pt g x), + lb < ub -> + lb < x < ub -> + (forall x, lb < x < ub -> (comp f g) x = id x) -> + derive_pt f (g x) Prf <> 0 -> + derive_pt g x Prg = 1 / (derive_pt f (g x) Prf). +Proof. +intros f g lb ub x Prf Prg lb_lt_ub x_encad local_recip Df_neq. + replace (derive_pt g x Prg) with + ((derive_pt g x Prg) * (derive_pt f (g x) Prf) * / (derive_pt f (g x) Prf)). + unfold Rdiv. + rewrite (Rmult_comm _ (/ derive_pt f (g x) Prf)). + rewrite (Rmult_comm _ (/ derive_pt f (g x) Prf)). + apply Rmult_eq_compat_l. + rewrite Rmult_comm. + rewrite <- derive_pt_comp. + assert (x_encad2 : lb <= x <= ub) by intuition. + rewrite pr_nu_var2_interv with (g:=id) (pr2:= derivable_pt_id_interv lb ub x x_encad2) (lb:=lb) (ub:=ub) ; [reg| | |] ; assumption. + rewrite Rmult_assoc, Rinv_r. + intuition. + assumption. +Qed. + +Lemma derive_pt_recip_interv_prelim1_0 : forall (f g:R->R) (lb ub x:R), + lb < ub -> + f lb < x < f ub -> + (forall x y : R, lb <= x -> x < y -> y <= ub -> f x < f y) -> + (forall x : R, f lb <= x -> x <= f ub -> lb <= g x <= ub) -> + (forall x, f lb <= x -> x <= f ub -> (comp f g) x = id x) -> + lb < g x < ub. +Proof. +intros f g lb ub x lb_lt_ub x_encad f_incr g_wf f_eq_g. + assert (Temp:= f_incr_implies_g_incr_interv f g lb ub lb_lt_ub f_incr f_eq_g g_wf). + assert (Left_inv := leftinv_is_rightinv_interv f g lb ub f_incr f_eq_g g_wf). + unfold comp, id in Left_inv. + split ; [rewrite <- Left_inv with (x:=lb) | rewrite <- Left_inv ]. + apply Temp ; intuition. + intuition. + apply Temp ; intuition. + intuition. +Qed. + +Lemma derive_pt_recip_interv_prelim1_1 : forall (f g:R->R) (lb ub x:R), + lb < ub -> + f lb < x < f ub -> + (forall x y : R, lb <= x -> x < y -> y <= ub -> f x < f y) -> + (forall x : R, f lb <= x -> x <= f ub -> lb <= g x <= ub) -> + (forall x, f lb <= x -> x <= f ub -> (comp f g) x = id x) -> + lb <= g x <= ub. +Proof. +intros f g lb ub x lb_lt_ub x_encad f_incr g_wf f_eq_g. + assert (Temp := derive_pt_recip_interv_prelim1_0 f g lb ub x lb_lt_ub x_encad f_incr g_wf f_eq_g). + split ; apply Rlt_le ; intuition. +Qed. + +Lemma derive_pt_recip_interv : forall (f g:R->R) (lb ub x:R) + (lb_lt_ub:lb < ub) (x_encad:f lb < x < f ub) + (f_incr:forall x y : R, lb <= x -> x < y -> y <= ub -> f x < f y) + (g_wf:forall x : R, f lb <= x -> x <= f ub -> lb <= g x <= ub) + (Prf:forall a : R, lb <= a <= ub -> derivable_pt f a) + (f_eq_g:forall x, f lb <= x -> x <= f ub -> (comp f g) x = id x) + (Df_neq:derive_pt f (g x) (derivable_pt_recip_interv_prelim1 f g lb ub x + lb_lt_ub x_encad f_eq_g g_wf f_incr Prf) <> 0), + derive_pt g x (derivable_pt_recip_interv f g lb ub x lb_lt_ub x_encad f_eq_g + g_wf f_incr Prf Df_neq) + = + 1 / (derive_pt f (g x) (Prf (g x) (derive_pt_recip_interv_prelim1_1 f g lb ub x + lb_lt_ub x_encad f_incr g_wf f_eq_g))). +Proof. +intros. + assert(g_incr := (derive_pt_recip_interv_prelim1_1 f g lb ub x lb_lt_ub + x_encad f_incr g_wf f_eq_g)). + apply derive_pt_recip_interv_prelim0 with (lb:=f lb) (ub:=f ub) ; + [intuition |assumption | intuition |]. + intro Hfalse ; apply Df_neq. rewrite pr_nu_var2_interv with (g:=f) (lb:=lb) (ub:=ub) + (pr2:= (Prf (g x) (derive_pt_recip_interv_prelim1_1 f g lb ub x lb_lt_ub x_encad + f_incr g_wf f_eq_g))) ; + [intuition | intuition | | intuition]. + exact (derive_pt_recip_interv_prelim1_0 f g lb ub x lb_lt_ub x_encad f_incr g_wf f_eq_g). +Qed. + +(****************************************************) +(** * Existence of the derivative of a function which is the limit of a sequence of functions *) +(****************************************************) + +(* begin hide *) +Lemma ub_lt_2_pos : forall x ub lb, lb < x -> x < ub -> 0 < (ub-lb)/2. +Proof. +intros x ub lb lb_lt_x x_lt_ub. + assert (T : 0 < ub - lb). + fourier. + unfold Rdiv ; apply Rlt_mult_inv_pos ; intuition. +Qed. + +Definition mkposreal_lb_ub (x lb ub:R) (lb_lt_x:lb<x) (x_lt_ub:x<ub) : posreal. + apply (mkposreal ((ub-lb)/2) (ub_lt_2_pos x ub lb lb_lt_x x_lt_ub)). +Defined. +(* end hide *) + +Definition boule_of_interval x y (h : x < y) : + {c :R & {r : posreal | c - r = x /\ c + r = y}}. +exists ((x + y)/2). +assert (radius : 0 < (y - x)/2). + unfold Rdiv; apply Rmult_lt_0_compat; fourier. + exists (mkposreal _ radius). + simpl; split; unfold Rdiv; field. +Qed. + +Definition boule_in_interval x y z (h : x < z < y) : + {c : R & {r | Boule c r z /\ x < c - r /\ c + r < y}}. +Proof. +assert (cmp : x * /2 + z * /2 < z * /2 + y * /2). +destruct h as [h1 h2]; fourier. +destruct (boule_of_interval _ _ cmp) as [c [r [P1 P2]]]. +exists c, r; split. + destruct h; unfold Boule; simpl; apply Rabs_def1; fourier. +destruct h; split; fourier. +Qed. + +Lemma Ball_in_inter : forall c1 c2 r1 r2 x, + Boule c1 r1 x -> Boule c2 r2 x -> + {r3 : posreal | forall y, Boule x r3 y -> Boule c1 r1 y /\ Boule c2 r2 y}. +intros c1 c2 [r1 r1p] [r2 r2p] x; unfold Boule; simpl; intros in1 in2. +assert (Rmax (c1 - r1)(c2 - r2) < x). + apply Rmax_lub_lt;[revert in1 | revert in2]; intros h; + apply Rabs_def2 in h; destruct h; fourier. +assert (x < Rmin (c1 + r1) (c2 + r2)). + apply Rmin_glb_lt;[revert in1 | revert in2]; intros h; + apply Rabs_def2 in h; destruct h; fourier. +assert (t: 0 < Rmin (x - Rmax (c1 - r1) (c2 - r2)) + (Rmin (c1 + r1) (c2 + r2) - x)). + apply Rmin_glb_lt; fourier. +exists (mkposreal _ t). +apply Rabs_def2 in in1; destruct in1. +apply Rabs_def2 in in2; destruct in2. +assert (c1 - r1 <= Rmax (c1 - r1) (c2 - r2)) by apply Rmax_l. +assert (c2 - r2 <= Rmax (c1 - r1) (c2 - r2)) by apply Rmax_r. +assert (Rmin (c1 + r1) (c2 + r2) <= c1 + r1) by apply Rmin_l. +assert (Rmin (c1 + r1) (c2 + r2) <= c2 + r2) by apply Rmin_r. +assert (Rmin (x - Rmax (c1 - r1) (c2 - r2)) + (Rmin (c1 + r1) (c2 + r2) - x) <= x - Rmax (c1 - r1) (c2 - r2)) + by apply Rmin_l. +assert (Rmin (x - Rmax (c1 - r1) (c2 - r2)) + (Rmin (c1 + r1) (c2 + r2) - x) <= Rmin (c1 + r1) (c2 + r2) - x) + by apply Rmin_r. +simpl. +intros y h; apply Rabs_def2 in h; destruct h;split; apply Rabs_def1; fourier. +Qed. + +Lemma Boule_center : forall x r, Boule x r x. +Proof. +intros x [r rpos]; unfold Boule, Rminus; simpl; rewrite Rplus_opp_r. +rewrite Rabs_pos_eq;[assumption | apply Rle_refl]. +Qed. + +Lemma derivable_pt_lim_CVU : forall (fn fn':nat -> R -> R) (f g:R->R) + (x:R) c r, Boule c r x -> + (forall y n, Boule c r y -> derivable_pt_lim (fn n) y (fn' n y)) -> + (forall y, Boule c r y -> Un_cv (fun n => fn n y) (f y)) -> + (CVU fn' g c r) -> + (forall y, Boule c r y -> continuity_pt g y) -> + derivable_pt_lim f x (g x). +Proof. +intros fn fn' f g x c' r xinb Dfn_eq_fn' fn_CV_f fn'_CVU_g g_cont eps eps_pos. +assert (eps_8_pos : 0 < eps / 8) by fourier. +elim (g_cont x xinb _ eps_8_pos) ; clear g_cont ; +intros delta1 (delta1_pos, g_cont). +destruct (Ball_in_inter _ _ _ _ _ xinb + (Boule_center x (mkposreal _ delta1_pos))) + as [delta Pdelta]. +exists delta; intros h hpos hinbdelta. +assert (eps'_pos : 0 < (Rabs h) * eps / 4). + unfold Rdiv ; rewrite Rmult_assoc ; apply Rmult_lt_0_compat. + apply Rabs_pos_lt ; assumption. +fourier. +destruct (fn_CV_f x xinb ((Rabs h) * eps / 4) eps'_pos) as [N2 fnx_CV_fx]. +assert (xhinbxdelta : Boule x delta (x + h)). + clear -hinbdelta; apply Rabs_def2 in hinbdelta; unfold Boule; simpl. + destruct hinbdelta; apply Rabs_def1; fourier. +assert (t : Boule c' r (x + h)). + apply Pdelta in xhinbxdelta; tauto. +destruct (fn_CV_f (x+h) t ((Rabs h) * eps / 4) eps'_pos) as [N1 fnxh_CV_fxh]. +clear fn_CV_f t. +destruct (fn'_CVU_g (eps/8) eps_8_pos) as [N3 fn'c_CVU_gc]. +pose (N := ((N1 + N2) + N3)%nat). +assert (Main : Rabs ((f (x+h) - fn N (x+h)) - (f x - fn N x) + (fn N (x+h) - fn N x - h * (g x))) < (Rabs h)*eps). + apply Rle_lt_trans with (Rabs (f (x + h) - fn N (x + h) - (f x - fn N x)) + Rabs ((fn N (x + h) - fn N x - h * g x))). + solve[apply Rabs_triang]. + apply Rle_lt_trans with (Rabs (f (x + h) - fn N (x + h)) + Rabs (- (f x - fn N x)) + Rabs (fn N (x + h) - fn N x - h * g x)). + solve[apply Rplus_le_compat_r ; apply Rabs_triang]. + rewrite Rabs_Ropp. + case (Rlt_le_dec h 0) ; intro sgn_h. + assert (pr1 : forall c : R, x + h < c < x -> derivable_pt (fn N) c). + intros c c_encad ; unfold derivable_pt. + exists (fn' N c) ; apply Dfn_eq_fn'. + assert (t : Boule x delta c). + apply Rabs_def2 in xhinbxdelta; destruct xhinbxdelta; destruct c_encad. + apply Rabs_def2 in xinb; apply Rabs_def1; fourier. + apply Pdelta in t; tauto. + assert (pr2 : forall c : R, x + h < c < x -> derivable_pt id c). + solve[intros; apply derivable_id]. + assert (xh_x : x+h < x) by fourier. + assert (pr3 : forall c : R, x + h <= c <= x -> continuity_pt (fn N) c). + intros c c_encad ; apply derivable_continuous_pt. + exists (fn' N c) ; apply Dfn_eq_fn' ; intuition. + assert (t : Boule x delta c). + apply Rabs_def2 in xhinbxdelta; destruct xhinbxdelta. + apply Rabs_def2 in xinb; apply Rabs_def1; fourier. + apply Pdelta in t; tauto. + assert (pr4 : forall c : R, x + h <= c <= x -> continuity_pt id c). + solve[intros; apply derivable_continuous ; apply derivable_id]. + destruct (MVT (fn N) id (x+h) x pr1 pr2 xh_x pr3 pr4) as [c [P Hc]]. + assert (Hc' : h * derive_pt (fn N) c (pr1 c P) = (fn N (x+h) - fn N x)). + apply Rmult_eq_reg_l with (-1). + replace (-1 * (h * derive_pt (fn N) c (pr1 c P))) with (-h * derive_pt (fn N) c (pr1 c P)) by field. + replace (-1 * (fn N (x + h) - fn N x)) with (- (fn N (x + h) - fn N x)) by field. + replace (-h) with (id x - id (x + h)) by (unfold id; field). + rewrite <- Rmult_1_r ; replace 1 with (derive_pt id c (pr2 c P)) by reg. + replace (- (fn N (x + h) - fn N x)) with (fn N x - fn N (x + h)) by field. + assumption. + solve[apply Rlt_not_eq ; intuition]. + rewrite <- Hc'; clear Hc Hc'. + replace (derive_pt (fn N) c (pr1 c P)) with (fn' N c). + replace (h * fn' N c - h * g x) with (h * (fn' N c - g x)) by field. + rewrite Rabs_mult. + apply Rlt_trans with (Rabs h * eps / 4 + Rabs (f x - fn N x) + Rabs h * Rabs (fn' N c - g x)). + apply Rplus_lt_compat_r ; apply Rplus_lt_compat_r ; unfold R_dist in fnxh_CV_fxh ; + rewrite Rabs_minus_sym ; apply fnxh_CV_fxh. + unfold N; omega. + apply Rlt_trans with (Rabs h * eps / 4 + Rabs h * eps / 4 + Rabs h * Rabs (fn' N c - g x)). + apply Rplus_lt_compat_r ; apply Rplus_lt_compat_l. + unfold R_dist in fnx_CV_fx ; rewrite Rabs_minus_sym ; apply fnx_CV_fx. + unfold N ; omega. + replace (fn' N c - g x) with ((fn' N c - g c) + (g c - g x)) by field. + apply Rle_lt_trans with (Rabs h * eps / 4 + Rabs h * eps / 4 + + Rabs h * Rabs (fn' N c - g c) + Rabs h * Rabs (g c - g x)). + rewrite Rplus_assoc ; rewrite Rplus_assoc ; rewrite Rplus_assoc ; + apply Rplus_le_compat_l ; apply Rplus_le_compat_l ; + rewrite <- Rmult_plus_distr_l ; apply Rmult_le_compat_l. + solve[apply Rabs_pos]. + solve[apply Rabs_triang]. + apply Rlt_trans with (Rabs h * eps / 4 + Rabs h * eps / 4 + + Rabs h * (eps / 8) + Rabs h * Rabs (g c - g x)). + apply Rplus_lt_compat_r; apply Rplus_lt_compat_l; apply Rmult_lt_compat_l. + apply Rabs_pos_lt ; assumption. + rewrite Rabs_minus_sym ; apply fn'c_CVU_gc. + unfold N ; omega. + assert (t : Boule x delta c). + destruct P. + apply Rabs_def2 in xhinbxdelta; destruct xhinbxdelta. + apply Rabs_def2 in xinb; apply Rabs_def1; fourier. + apply Pdelta in t; tauto. + apply Rlt_trans with (Rabs h * eps / 4 + Rabs h * eps / 4 + Rabs h * (eps / 8) + + Rabs h * (eps / 8)). + rewrite Rplus_assoc ; rewrite Rplus_assoc ; rewrite Rplus_assoc ; rewrite Rplus_assoc ; + apply Rplus_lt_compat_l ; apply Rplus_lt_compat_l ; rewrite <- Rmult_plus_distr_l ; + rewrite <- Rmult_plus_distr_l ; apply Rmult_lt_compat_l. + apply Rabs_pos_lt ; assumption. + apply Rplus_lt_compat_l ; simpl in g_cont ; apply g_cont ; split ; [unfold D_x ; split |]. + solve[unfold no_cond ; intuition]. + apply Rgt_not_eq ; exact (proj2 P). + apply Rlt_trans with (Rabs h). + apply Rabs_def1. + apply Rlt_trans with 0. + destruct P; fourier. + apply Rabs_pos_lt ; assumption. + rewrite <- Rabs_Ropp, Rabs_pos_eq, Ropp_involutive;[ | fourier]. + destruct P; fourier. + clear -Pdelta xhinbxdelta. + apply Pdelta in xhinbxdelta; destruct xhinbxdelta as [_ P']. + apply Rabs_def2 in P'; simpl in P'; destruct P'; + apply Rabs_def1; fourier. + rewrite Rplus_assoc ; rewrite Rplus_assoc ; rewrite <- Rmult_plus_distr_l. + replace (Rabs h * eps / 4 + (Rabs h * eps / 4 + Rabs h * (eps / 8 + eps / 8))) with + (Rabs h * (eps / 4 + eps / 4 + eps / 8 + eps / 8)) by field. + apply Rmult_lt_compat_l. + apply Rabs_pos_lt ; assumption. + fourier. + assert (H := pr1 c P) ; elim H ; clear H ; intros l Hl. + assert (Temp : l = fn' N c). + assert (bc'rc : Boule c' r c). + assert (t : Boule x delta c). + clear - xhinbxdelta P. + destruct P; apply Rabs_def2 in xhinbxdelta; destruct xhinbxdelta. + apply Rabs_def1; fourier. + apply Pdelta in t; tauto. + assert (Hl' := Dfn_eq_fn' c N bc'rc). + unfold derivable_pt_abs in Hl; clear -Hl Hl'. + apply uniqueness_limite with (f:= fn N) (x:=c) ; assumption. + rewrite <- Temp. + assert (Hl' : derivable_pt (fn N) c). + exists l ; apply Hl. + rewrite pr_nu_var with (g:= fn N) (pr2:=Hl'). + elim Hl' ; clear Hl' ; intros l' Hl'. + assert (Main : l = l'). + apply uniqueness_limite with (f:= fn N) (x:=c) ; assumption. + rewrite Main ; reflexivity. + reflexivity. + assert (h_pos : h > 0). + case sgn_h ; intro Hyp. + assumption. + apply False_ind ; apply hpos ; symmetry ; assumption. + clear sgn_h. + assert (pr1 : forall c : R, x < c < x + h -> derivable_pt (fn N) c). + intros c c_encad ; unfold derivable_pt. + exists (fn' N c) ; apply Dfn_eq_fn'. + assert (t : Boule x delta c). + apply Rabs_def2 in xhinbxdelta; destruct xhinbxdelta; destruct c_encad. + apply Rabs_def2 in xinb; apply Rabs_def1; fourier. + apply Pdelta in t; tauto. + assert (pr2 : forall c : R, x < c < x + h -> derivable_pt id c). + solve[intros; apply derivable_id]. + assert (xh_x : x < x + h) by fourier. + assert (pr3 : forall c : R, x <= c <= x + h -> continuity_pt (fn N) c). + intros c c_encad ; apply derivable_continuous_pt. + exists (fn' N c) ; apply Dfn_eq_fn' ; intuition. + assert (t : Boule x delta c). + apply Rabs_def2 in xhinbxdelta; destruct xhinbxdelta. + apply Rabs_def2 in xinb; apply Rabs_def1; fourier. + apply Pdelta in t; tauto. + assert (pr4 : forall c : R, x <= c <= x + h -> continuity_pt id c). + solve[intros; apply derivable_continuous ; apply derivable_id]. + destruct (MVT (fn N) id x (x+h) pr1 pr2 xh_x pr3 pr4) as [c [P Hc]]. + assert (Hc' : h * derive_pt (fn N) c (pr1 c P) = fn N (x+h) - fn N x). + pattern h at 1; replace h with (id (x + h) - id x) by (unfold id; field). + rewrite <- Rmult_1_r ; replace 1 with (derive_pt id c (pr2 c P)) by reg. + assumption. + rewrite <- Hc'; clear Hc Hc'. + replace (derive_pt (fn N) c (pr1 c P)) with (fn' N c). + replace (h * fn' N c - h * g x) with (h * (fn' N c - g x)) by field. + rewrite Rabs_mult. + apply Rlt_trans with (Rabs h * eps / 4 + Rabs (f x - fn N x) + Rabs h * Rabs (fn' N c - g x)). + apply Rplus_lt_compat_r ; apply Rplus_lt_compat_r ; unfold R_dist in fnxh_CV_fxh ; + rewrite Rabs_minus_sym ; apply fnxh_CV_fxh. + unfold N; omega. + apply Rlt_trans with (Rabs h * eps / 4 + Rabs h * eps / 4 + Rabs h * Rabs (fn' N c - g x)). + apply Rplus_lt_compat_r ; apply Rplus_lt_compat_l. + unfold R_dist in fnx_CV_fx ; rewrite Rabs_minus_sym ; apply fnx_CV_fx. + unfold N ; omega. + replace (fn' N c - g x) with ((fn' N c - g c) + (g c - g x)) by field. + apply Rle_lt_trans with (Rabs h * eps / 4 + Rabs h * eps / 4 + + Rabs h * Rabs (fn' N c - g c) + Rabs h * Rabs (g c - g x)). + rewrite Rplus_assoc ; rewrite Rplus_assoc ; rewrite Rplus_assoc ; + apply Rplus_le_compat_l ; apply Rplus_le_compat_l ; + rewrite <- Rmult_plus_distr_l ; apply Rmult_le_compat_l. + solve[apply Rabs_pos]. + solve[apply Rabs_triang]. + apply Rlt_trans with (Rabs h * eps / 4 + Rabs h * eps / 4 + + Rabs h * (eps / 8) + Rabs h * Rabs (g c - g x)). + apply Rplus_lt_compat_r; apply Rplus_lt_compat_l; apply Rmult_lt_compat_l. + apply Rabs_pos_lt ; assumption. + rewrite Rabs_minus_sym ; apply fn'c_CVU_gc. + unfold N ; omega. + assert (t : Boule x delta c). + destruct P. + apply Rabs_def2 in xhinbxdelta; destruct xhinbxdelta. + apply Rabs_def2 in xinb; apply Rabs_def1; fourier. + apply Pdelta in t; tauto. + apply Rlt_trans with (Rabs h * eps / 4 + Rabs h * eps / 4 + Rabs h * (eps / 8) + + Rabs h * (eps / 8)). + rewrite Rplus_assoc ; rewrite Rplus_assoc ; rewrite Rplus_assoc ; rewrite Rplus_assoc ; + apply Rplus_lt_compat_l ; apply Rplus_lt_compat_l ; rewrite <- Rmult_plus_distr_l ; + rewrite <- Rmult_plus_distr_l ; apply Rmult_lt_compat_l. + apply Rabs_pos_lt ; assumption. + apply Rplus_lt_compat_l ; simpl in g_cont ; apply g_cont ; split ; [unfold D_x ; split |]. + solve[unfold no_cond ; intuition]. + apply Rlt_not_eq ; exact (proj1 P). + apply Rlt_trans with (Rabs h). + apply Rabs_def1. + destruct P; rewrite Rabs_pos_eq;fourier. + apply Rle_lt_trans with 0. + assert (t := Rabs_pos h); clear -t; fourier. + clear -P; destruct P; fourier. + clear -Pdelta xhinbxdelta. + apply Pdelta in xhinbxdelta; destruct xhinbxdelta as [_ P']. + apply Rabs_def2 in P'; simpl in P'; destruct P'; + apply Rabs_def1; fourier. + rewrite Rplus_assoc ; rewrite Rplus_assoc ; rewrite <- Rmult_plus_distr_l. + replace (Rabs h * eps / 4 + (Rabs h * eps / 4 + Rabs h * (eps / 8 + eps / 8))) with + (Rabs h * (eps / 4 + eps / 4 + eps / 8 + eps / 8)) by field. + apply Rmult_lt_compat_l. + apply Rabs_pos_lt ; assumption. + fourier. + assert (H := pr1 c P) ; elim H ; clear H ; intros l Hl. + assert (Temp : l = fn' N c). + assert (bc'rc : Boule c' r c). + assert (t : Boule x delta c). + clear - xhinbxdelta P. + destruct P; apply Rabs_def2 in xhinbxdelta; destruct xhinbxdelta. + apply Rabs_def1; fourier. + apply Pdelta in t; tauto. + assert (Hl' := Dfn_eq_fn' c N bc'rc). + unfold derivable_pt_abs in Hl; clear -Hl Hl'. + apply uniqueness_limite with (f:= fn N) (x:=c) ; assumption. + rewrite <- Temp. + assert (Hl' : derivable_pt (fn N) c). + exists l ; apply Hl. + rewrite pr_nu_var with (g:= fn N) (pr2:=Hl'). + elim Hl' ; clear Hl' ; intros l' Hl'. + assert (Main : l = l'). + apply uniqueness_limite with (f:= fn N) (x:=c) ; assumption. + rewrite Main ; reflexivity. + reflexivity. + replace ((f (x + h) - f x) / h - g x) with ((/h) * ((f (x + h) - f x) - h * g x)). + rewrite Rabs_mult ; rewrite Rabs_Rinv. + replace eps with (/ Rabs h * (Rabs h * eps)). + apply Rmult_lt_compat_l. + apply Rinv_0_lt_compat ; apply Rabs_pos_lt ; assumption. + replace (f (x + h) - f x - h * g x) with (f (x + h) - fn N (x + h) - (f x - fn N x) + + (fn N (x + h) - fn N x - h * g x)) by field. + assumption. + field ; apply Rgt_not_eq ; apply Rabs_pos_lt ; assumption. + assumption. + field. assumption. +Qed.
\ No newline at end of file diff --git a/theories/Reals/Ranalysis_reg.v b/theories/Reals/Ranalysis_reg.v new file mode 100644 index 00000000..a4b18288 --- /dev/null +++ b/theories/Reals/Ranalysis_reg.v @@ -0,0 +1,800 @@ +(************************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) +(* \VV/ **************************************************************) +(* // * This file is distributed under the terms of the *) +(* * GNU Lesser General Public License Version 2.1 *) +(************************************************************************) + +Require Import Rbase. +Require Import Rfunctions. +Require Import Rtrigo1. +Require Import SeqSeries. +Require Export Ranalysis1. +Require Export Ranalysis2. +Require Export Ranalysis3. +Require Export Rtopology. +Require Export MVT. +Require Export PSeries_reg. +Require Export Exp_prop. +Require Export Rtrigo_reg. +Require Export Rsqrt_def. +Require Export R_sqrt. +Require Export Rtrigo_calc. +Require Export Rgeom. +Require Export RList. +Require Export Sqrt_reg. +Require Export Ranalysis4. +Require Export Rpower. +Local Open Scope R_scope. + +Axiom AppVar : R. + +(**********) +Ltac intro_hyp_glob trm := + match constr:trm with + | (?X1 + ?X2)%F => + match goal with + | |- (derivable _) => intro_hyp_glob X1; intro_hyp_glob X2 + | |- (continuity _) => intro_hyp_glob X1; intro_hyp_glob X2 + | _ => idtac + end + | (?X1 - ?X2)%F => + match goal with + | |- (derivable _) => intro_hyp_glob X1; intro_hyp_glob X2 + | |- (continuity _) => intro_hyp_glob X1; intro_hyp_glob X2 + | _ => idtac + end + | (?X1 * ?X2)%F => + match goal with + | |- (derivable _) => intro_hyp_glob X1; intro_hyp_glob X2 + | |- (continuity _) => intro_hyp_glob X1; intro_hyp_glob X2 + | _ => idtac + end + | (?X1 / ?X2)%F => + let aux := constr:X2 in + match goal with + | _:(forall x0:R, aux x0 <> 0) |- (derivable _) => + intro_hyp_glob X1; intro_hyp_glob X2 + | _:(forall x0:R, aux x0 <> 0) |- (continuity _) => + intro_hyp_glob X1; intro_hyp_glob X2 + | |- (derivable _) => + cut (forall x0:R, aux x0 <> 0); + [ intro; intro_hyp_glob X1; intro_hyp_glob X2 | try assumption ] + | |- (continuity _) => + cut (forall x0:R, aux x0 <> 0); + [ intro; intro_hyp_glob X1; intro_hyp_glob X2 | try assumption ] + | _ => idtac + end + | (comp ?X1 ?X2) => + match goal with + | |- (derivable _) => intro_hyp_glob X1; intro_hyp_glob X2 + | |- (continuity _) => intro_hyp_glob X1; intro_hyp_glob X2 + | _ => idtac + end + | (- ?X1)%F => + match goal with + | |- (derivable _) => intro_hyp_glob X1 + | |- (continuity _) => intro_hyp_glob X1 + | _ => idtac + end + | (/ ?X1)%F => + let aux := constr:X1 in + match goal with + | _:(forall x0:R, aux x0 <> 0) |- (derivable _) => + intro_hyp_glob X1 + | _:(forall x0:R, aux x0 <> 0) |- (continuity _) => + intro_hyp_glob X1 + | |- (derivable _) => + cut (forall x0:R, aux x0 <> 0); + [ intro; intro_hyp_glob X1 | try assumption ] + | |- (continuity _) => + cut (forall x0:R, aux x0 <> 0); + [ intro; intro_hyp_glob X1 | try assumption ] + | _ => idtac + end + | cos => idtac + | sin => idtac + | cosh => idtac + | sinh => idtac + | exp => idtac + | Rsqr => idtac + | sqrt => idtac + | id => idtac + | (fct_cte _) => idtac + | (pow_fct _) => idtac + | Rabs => idtac + | ?X1 => + let p := constr:X1 in + match goal with + | _:(derivable p) |- _ => idtac + | |- (derivable p) => idtac + | |- (derivable _) => + cut (True -> derivable p); + [ intro HYPPD; cut (derivable p); + [ intro; clear HYPPD | apply HYPPD; clear HYPPD; trivial ] + | idtac ] + | _:(continuity p) |- _ => idtac + | |- (continuity p) => idtac + | |- (continuity _) => + cut (True -> continuity p); + [ intro HYPPD; cut (continuity p); + [ intro; clear HYPPD | apply HYPPD; clear HYPPD; trivial ] + | idtac ] + | _ => idtac + end + end. + +(**********) +Ltac intro_hyp_pt trm pt := + match constr:trm with + | (?X1 + ?X2)%F => + match goal with + | |- (derivable_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | |- (continuity_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | |- (derive_pt _ _ _ = _) => + intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | _ => idtac + end + | (?X1 - ?X2)%F => + match goal with + | |- (derivable_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | |- (continuity_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | |- (derive_pt _ _ _ = _) => + intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | _ => idtac + end + | (?X1 * ?X2)%F => + match goal with + | |- (derivable_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | |- (continuity_pt _ _) => intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | |- (derive_pt _ _ _ = _) => + intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | _ => idtac + end + | (?X1 / ?X2)%F => + let aux := constr:X2 in + match goal with + | _:(aux pt <> 0) |- (derivable_pt _ _) => + intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | _:(aux pt <> 0) |- (continuity_pt _ _) => + intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | _:(aux pt <> 0) |- (derive_pt _ _ _ = _) => + intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | id:(forall x0:R, aux x0 <> 0) |- (derivable_pt _ _) => + generalize (id pt); intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | id:(forall x0:R, aux x0 <> 0) |- (continuity_pt _ _) => + generalize (id pt); intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | id:(forall x0:R, aux x0 <> 0) |- (derive_pt _ _ _ = _) => + generalize (id pt); intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt + | |- (derivable_pt _ _) => + cut (aux pt <> 0); + [ intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt | try assumption ] + | |- (continuity_pt _ _) => + cut (aux pt <> 0); + [ intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt | try assumption ] + | |- (derive_pt _ _ _ = _) => + cut (aux pt <> 0); + [ intro; intro_hyp_pt X1 pt; intro_hyp_pt X2 pt | try assumption ] + | _ => idtac + end + | (comp ?X1 ?X2) => + match goal with + | |- (derivable_pt _ _) => + let pt_f1 := eval cbv beta in (X2 pt) in + (intro_hyp_pt X1 pt_f1; intro_hyp_pt X2 pt) + | |- (continuity_pt _ _) => + let pt_f1 := eval cbv beta in (X2 pt) in + (intro_hyp_pt X1 pt_f1; intro_hyp_pt X2 pt) + | |- (derive_pt _ _ _ = _) => + let pt_f1 := eval cbv beta in (X2 pt) in + (intro_hyp_pt X1 pt_f1; intro_hyp_pt X2 pt) + | _ => idtac + end + | (- ?X1)%F => + match goal with + | |- (derivable_pt _ _) => intro_hyp_pt X1 pt + | |- (continuity_pt _ _) => intro_hyp_pt X1 pt + | |- (derive_pt _ _ _ = _) => intro_hyp_pt X1 pt + | _ => idtac + end + | (/ ?X1)%F => + let aux := constr:X1 in + match goal with + | _:(aux pt <> 0) |- (derivable_pt _ _) => + intro_hyp_pt X1 pt + | _:(aux pt <> 0) |- (continuity_pt _ _) => + intro_hyp_pt X1 pt + | _:(aux pt <> 0) |- (derive_pt _ _ _ = _) => + intro_hyp_pt X1 pt + | id:(forall x0:R, aux x0 <> 0) |- (derivable_pt _ _) => + generalize (id pt); intro; intro_hyp_pt X1 pt + | id:(forall x0:R, aux x0 <> 0) |- (continuity_pt _ _) => + generalize (id pt); intro; intro_hyp_pt X1 pt + | id:(forall x0:R, aux x0 <> 0) |- (derive_pt _ _ _ = _) => + generalize (id pt); intro; intro_hyp_pt X1 pt + | |- (derivable_pt _ _) => + cut (aux pt <> 0); [ intro; intro_hyp_pt X1 pt | try assumption ] + | |- (continuity_pt _ _) => + cut (aux pt <> 0); [ intro; intro_hyp_pt X1 pt | try assumption ] + | |- (derive_pt _ _ _ = _) => + cut (aux pt <> 0); [ intro; intro_hyp_pt X1 pt | try assumption ] + | _ => idtac + end + | cos => idtac + | sin => idtac + | cosh => idtac + | sinh => idtac + | exp => idtac + | Rsqr => idtac + | id => idtac + | (fct_cte _) => idtac + | (pow_fct _) => idtac + | sqrt => + match goal with + | |- (derivable_pt _ _) => cut (0 < pt); [ intro | try assumption ] + | |- (continuity_pt _ _) => + cut (0 <= pt); [ intro | try assumption ] + | |- (derive_pt _ _ _ = _) => + cut (0 < pt); [ intro | try assumption ] + | _ => idtac + end + | Rabs => + match goal with + | |- (derivable_pt _ _) => + cut (pt <> 0); [ intro | try assumption ] + | _ => idtac + end + | ?X1 => + let p := constr:X1 in + match goal with + | _:(derivable_pt p pt) |- _ => idtac + | |- (derivable_pt p pt) => idtac + | |- (derivable_pt _ _) => + cut (True -> derivable_pt p pt); + [ intro HYPPD; cut (derivable_pt p pt); + [ intro; clear HYPPD | apply HYPPD; clear HYPPD; trivial ] + | idtac ] + | _:(continuity_pt p pt) |- _ => idtac + | |- (continuity_pt p pt) => idtac + | |- (continuity_pt _ _) => + cut (True -> continuity_pt p pt); + [ intro HYPPD; cut (continuity_pt p pt); + [ intro; clear HYPPD | apply HYPPD; clear HYPPD; trivial ] + | idtac ] + | |- (derive_pt _ _ _ = _) => + cut (True -> derivable_pt p pt); + [ intro HYPPD; cut (derivable_pt p pt); + [ intro; clear HYPPD | apply HYPPD; clear HYPPD; trivial ] + | idtac ] + | _ => idtac + end + end. + +(**********) +Ltac is_diff_pt := + match goal with + | |- (derivable_pt Rsqr _) => + + (* fonctions de base *) + apply derivable_pt_Rsqr + | |- (derivable_pt id ?X1) => apply (derivable_pt_id X1) + | |- (derivable_pt (fct_cte _) _) => apply derivable_pt_const + | |- (derivable_pt sin _) => apply derivable_pt_sin + | |- (derivable_pt cos _) => apply derivable_pt_cos + | |- (derivable_pt sinh _) => apply derivable_pt_sinh + | |- (derivable_pt cosh _) => apply derivable_pt_cosh + | |- (derivable_pt exp _) => apply derivable_pt_exp + | |- (derivable_pt (pow_fct _) _) => + unfold pow_fct in |- *; apply derivable_pt_pow + | |- (derivable_pt sqrt ?X1) => + apply (derivable_pt_sqrt X1); + assumption || + unfold plus_fct, minus_fct, opp_fct, mult_fct, div_fct, inv_fct, + comp, id, fct_cte, pow_fct in |- * + | |- (derivable_pt Rabs ?X1) => + apply (Rderivable_pt_abs X1); + assumption || + unfold plus_fct, minus_fct, opp_fct, mult_fct, div_fct, inv_fct, + comp, id, fct_cte, pow_fct in |- * + (* regles de differentiabilite *) + (* PLUS *) + | |- (derivable_pt (?X1 + ?X2) ?X3) => + apply (derivable_pt_plus X1 X2 X3); is_diff_pt + (* MOINS *) + | |- (derivable_pt (?X1 - ?X2) ?X3) => + apply (derivable_pt_minus X1 X2 X3); is_diff_pt + (* OPPOSE *) + | |- (derivable_pt (- ?X1) ?X2) => + apply (derivable_pt_opp X1 X2); + is_diff_pt + (* MULTIPLICATION PAR UN SCALAIRE *) + | |- (derivable_pt (mult_real_fct ?X1 ?X2) ?X3) => + apply (derivable_pt_scal X2 X1 X3); is_diff_pt + (* MULTIPLICATION *) + | |- (derivable_pt (?X1 * ?X2) ?X3) => + apply (derivable_pt_mult X1 X2 X3); is_diff_pt + (* DIVISION *) + | |- (derivable_pt (?X1 / ?X2) ?X3) => + apply (derivable_pt_div X1 X2 X3); + [ is_diff_pt + | is_diff_pt + | try + assumption || + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, + comp, pow_fct, id, fct_cte in |- * ] + | |- (derivable_pt (/ ?X1) ?X2) => + + (* INVERSION *) + apply (derivable_pt_inv X1 X2); + [ assumption || + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, + comp, pow_fct, id, fct_cte in |- * + | is_diff_pt ] + | |- (derivable_pt (comp ?X1 ?X2) ?X3) => + + (* COMPOSITION *) + apply (derivable_pt_comp X2 X1 X3); is_diff_pt + | _:(derivable_pt ?X1 ?X2) |- (derivable_pt ?X1 ?X2) => + assumption + | _:(derivable ?X1) |- (derivable_pt ?X1 ?X2) => + cut (derivable X1); [ intro HypDDPT; apply HypDDPT | assumption ] + | |- (True -> derivable_pt _ _) => + intro HypTruE; clear HypTruE; is_diff_pt + | _ => + try + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, id, + fct_cte, comp, pow_fct in |- * + end. + +(**********) +Ltac is_diff_glob := + match goal with + | |- (derivable Rsqr) => + (* fonctions de base *) + apply derivable_Rsqr + | |- (derivable id) => apply derivable_id + | |- (derivable (fct_cte _)) => apply derivable_const + | |- (derivable sin) => apply derivable_sin + | |- (derivable cos) => apply derivable_cos + | |- (derivable cosh) => apply derivable_cosh + | |- (derivable sinh) => apply derivable_sinh + | |- (derivable exp) => apply derivable_exp + | |- (derivable (pow_fct _)) => + unfold pow_fct in |- *; + apply derivable_pow + (* regles de differentiabilite *) + (* PLUS *) + | |- (derivable (?X1 + ?X2)) => + apply (derivable_plus X1 X2); is_diff_glob + (* MOINS *) + | |- (derivable (?X1 - ?X2)) => + apply (derivable_minus X1 X2); is_diff_glob + (* OPPOSE *) + | |- (derivable (- ?X1)) => + apply (derivable_opp X1); + is_diff_glob + (* MULTIPLICATION PAR UN SCALAIRE *) + | |- (derivable (mult_real_fct ?X1 ?X2)) => + apply (derivable_scal X2 X1); is_diff_glob + (* MULTIPLICATION *) + | |- (derivable (?X1 * ?X2)) => + apply (derivable_mult X1 X2); is_diff_glob + (* DIVISION *) + | |- (derivable (?X1 / ?X2)) => + apply (derivable_div X1 X2); + [ is_diff_glob + | is_diff_glob + | try + assumption || + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, + id, fct_cte, comp, pow_fct in |- * ] + | |- (derivable (/ ?X1)) => + + (* INVERSION *) + apply (derivable_inv X1); + [ try + assumption || + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, + id, fct_cte, comp, pow_fct in |- * + | is_diff_glob ] + | |- (derivable (comp sqrt _)) => + + (* COMPOSITION *) + unfold derivable in |- *; intro; try is_diff_pt + | |- (derivable (comp Rabs _)) => + unfold derivable in |- *; intro; try is_diff_pt + | |- (derivable (comp ?X1 ?X2)) => + apply (derivable_comp X2 X1); is_diff_glob + | _:(derivable ?X1) |- (derivable ?X1) => assumption + | |- (True -> derivable _) => + intro HypTruE; clear HypTruE; is_diff_glob + | _ => + try + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, id, + fct_cte, comp, pow_fct in |- * + end. + +(**********) +Ltac is_cont_pt := + match goal with + | |- (continuity_pt Rsqr _) => + + (* fonctions de base *) + apply derivable_continuous_pt; apply derivable_pt_Rsqr + | |- (continuity_pt id ?X1) => + apply derivable_continuous_pt; apply (derivable_pt_id X1) + | |- (continuity_pt (fct_cte _) _) => + apply derivable_continuous_pt; apply derivable_pt_const + | |- (continuity_pt sin _) => + apply derivable_continuous_pt; apply derivable_pt_sin + | |- (continuity_pt cos _) => + apply derivable_continuous_pt; apply derivable_pt_cos + | |- (continuity_pt sinh _) => + apply derivable_continuous_pt; apply derivable_pt_sinh + | |- (continuity_pt cosh _) => + apply derivable_continuous_pt; apply derivable_pt_cosh + | |- (continuity_pt exp _) => + apply derivable_continuous_pt; apply derivable_pt_exp + | |- (continuity_pt (pow_fct _) _) => + unfold pow_fct in |- *; apply derivable_continuous_pt; + apply derivable_pt_pow + | |- (continuity_pt sqrt ?X1) => + apply continuity_pt_sqrt; + assumption || + unfold plus_fct, minus_fct, opp_fct, mult_fct, div_fct, inv_fct, + comp, id, fct_cte, pow_fct in |- * + | |- (continuity_pt Rabs ?X1) => + apply (Rcontinuity_abs X1) + (* regles de differentiabilite *) + (* PLUS *) + | |- (continuity_pt (?X1 + ?X2) ?X3) => + apply (continuity_pt_plus X1 X2 X3); is_cont_pt + (* MOINS *) + | |- (continuity_pt (?X1 - ?X2) ?X3) => + apply (continuity_pt_minus X1 X2 X3); is_cont_pt + (* OPPOSE *) + | |- (continuity_pt (- ?X1) ?X2) => + apply (continuity_pt_opp X1 X2); + is_cont_pt + (* MULTIPLICATION PAR UN SCALAIRE *) + | |- (continuity_pt (mult_real_fct ?X1 ?X2) ?X3) => + apply (continuity_pt_scal X2 X1 X3); is_cont_pt + (* MULTIPLICATION *) + | |- (continuity_pt (?X1 * ?X2) ?X3) => + apply (continuity_pt_mult X1 X2 X3); is_cont_pt + (* DIVISION *) + | |- (continuity_pt (?X1 / ?X2) ?X3) => + apply (continuity_pt_div X1 X2 X3); + [ is_cont_pt + | is_cont_pt + | try + assumption || + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, + comp, id, fct_cte, pow_fct in |- * ] + | |- (continuity_pt (/ ?X1) ?X2) => + + (* INVERSION *) + apply (continuity_pt_inv X1 X2); + [ is_cont_pt + | assumption || + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, + comp, id, fct_cte, pow_fct in |- * ] + | |- (continuity_pt (comp ?X1 ?X2) ?X3) => + + (* COMPOSITION *) + apply (continuity_pt_comp X2 X1 X3); is_cont_pt + | _:(continuity_pt ?X1 ?X2) |- (continuity_pt ?X1 ?X2) => + assumption + | _:(continuity ?X1) |- (continuity_pt ?X1 ?X2) => + cut (continuity X1); [ intro HypDDPT; apply HypDDPT | assumption ] + | _:(derivable_pt ?X1 ?X2) |- (continuity_pt ?X1 ?X2) => + apply derivable_continuous_pt; assumption + | _:(derivable ?X1) |- (continuity_pt ?X1 ?X2) => + cut (continuity X1); + [ intro HypDDPT; apply HypDDPT + | apply derivable_continuous; assumption ] + | |- (True -> continuity_pt _ _) => + intro HypTruE; clear HypTruE; is_cont_pt + | _ => + try + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, id, + fct_cte, comp, pow_fct in |- * + end. + +(**********) +Ltac is_cont_glob := + match goal with + | |- (continuity Rsqr) => + + (* fonctions de base *) + apply derivable_continuous; apply derivable_Rsqr + | |- (continuity id) => apply derivable_continuous; apply derivable_id + | |- (continuity (fct_cte _)) => + apply derivable_continuous; apply derivable_const + | |- (continuity sin) => apply derivable_continuous; apply derivable_sin + | |- (continuity cos) => apply derivable_continuous; apply derivable_cos + | |- (continuity exp) => apply derivable_continuous; apply derivable_exp + | |- (continuity (pow_fct _)) => + unfold pow_fct in |- *; apply derivable_continuous; apply derivable_pow + | |- (continuity sinh) => + apply derivable_continuous; apply derivable_sinh + | |- (continuity cosh) => + apply derivable_continuous; apply derivable_cosh + | |- (continuity Rabs) => + apply Rcontinuity_abs + (* regles de continuite *) + (* PLUS *) + | |- (continuity (?X1 + ?X2)) => + apply (continuity_plus X1 X2); + try is_cont_glob || assumption + (* MOINS *) + | |- (continuity (?X1 - ?X2)) => + apply (continuity_minus X1 X2); + try is_cont_glob || assumption + (* OPPOSE *) + | |- (continuity (- ?X1)) => + apply (continuity_opp X1); try is_cont_glob || assumption + (* INVERSE *) + | |- (continuity (/ ?X1)) => + apply (continuity_inv X1); + try is_cont_glob || assumption + (* MULTIPLICATION PAR UN SCALAIRE *) + | |- (continuity (mult_real_fct ?X1 ?X2)) => + apply (continuity_scal X2 X1); + try is_cont_glob || assumption + (* MULTIPLICATION *) + | |- (continuity (?X1 * ?X2)) => + apply (continuity_mult X1 X2); + try is_cont_glob || assumption + (* DIVISION *) + | |- (continuity (?X1 / ?X2)) => + apply (continuity_div X1 X2); + [ try is_cont_glob || assumption + | try is_cont_glob || assumption + | try + assumption || + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, + id, fct_cte, pow_fct in |- * ] + | |- (continuity (comp sqrt _)) => + + (* COMPOSITION *) + unfold continuity_pt in |- *; intro; try is_cont_pt + | |- (continuity (comp ?X1 ?X2)) => + apply (continuity_comp X2 X1); try is_cont_glob || assumption + | _:(continuity ?X1) |- (continuity ?X1) => assumption + | |- (True -> continuity _) => + intro HypTruE; clear HypTruE; is_cont_glob + | _:(derivable ?X1) |- (continuity ?X1) => + apply derivable_continuous; assumption + | _ => + try + unfold plus_fct, mult_fct, div_fct, minus_fct, opp_fct, inv_fct, id, + fct_cte, comp, pow_fct in |- * + end. + +(**********) +Ltac rew_term trm := + match constr:trm with + | (?X1 + ?X2) => + let p1 := rew_term X1 with p2 := rew_term X2 in + match constr:p1 with + | (fct_cte ?X3) => + match constr:p2 with + | (fct_cte ?X4) => constr:(fct_cte (X3 + X4)) + | _ => constr:(p1 + p2)%F + end + | _ => constr:(p1 + p2)%F + end + | (?X1 - ?X2) => + let p1 := rew_term X1 with p2 := rew_term X2 in + match constr:p1 with + | (fct_cte ?X3) => + match constr:p2 with + | (fct_cte ?X4) => constr:(fct_cte (X3 - X4)) + | _ => constr:(p1 - p2)%F + end + | _ => constr:(p1 - p2)%F + end + | (?X1 / ?X2) => + let p1 := rew_term X1 with p2 := rew_term X2 in + match constr:p1 with + | (fct_cte ?X3) => + match constr:p2 with + | (fct_cte ?X4) => constr:(fct_cte (X3 / X4)) + | _ => constr:(p1 / p2)%F + end + | _ => + match constr:p2 with + | (fct_cte ?X4) => constr:(p1 * fct_cte (/ X4))%F + | _ => constr:(p1 / p2)%F + end + end + | (?X1 * / ?X2) => + let p1 := rew_term X1 with p2 := rew_term X2 in + match constr:p1 with + | (fct_cte ?X3) => + match constr:p2 with + | (fct_cte ?X4) => constr:(fct_cte (X3 / X4)) + | _ => constr:(p1 / p2)%F + end + | _ => + match constr:p2 with + | (fct_cte ?X4) => constr:(p1 * fct_cte (/ X4))%F + | _ => constr:(p1 / p2)%F + end + end + | (?X1 * ?X2) => + let p1 := rew_term X1 with p2 := rew_term X2 in + match constr:p1 with + | (fct_cte ?X3) => + match constr:p2 with + | (fct_cte ?X4) => constr:(fct_cte (X3 * X4)) + | _ => constr:(p1 * p2)%F + end + | _ => constr:(p1 * p2)%F + end + | (- ?X1) => + let p := rew_term X1 in + match constr:p with + | (fct_cte ?X2) => constr:(fct_cte (- X2)) + | _ => constr:(- p)%F + end + | (/ ?X1) => + let p := rew_term X1 in + match constr:p with + | (fct_cte ?X2) => constr:(fct_cte (/ X2)) + | _ => constr:(/ p)%F + end + | (?X1 AppVar) => constr:X1 + | (?X1 ?X2) => + let p := rew_term X2 in + match constr:p with + | (fct_cte ?X3) => constr:(fct_cte (X1 X3)) + | _ => constr:(comp X1 p) + end + | AppVar => constr:id + | (AppVar ^ ?X1) => constr:(pow_fct X1) + | (?X1 ^ ?X2) => + let p := rew_term X1 in + match constr:p with + | (fct_cte ?X3) => constr:(fct_cte (pow_fct X2 X3)) + | _ => constr:(comp (pow_fct X2) p) + end + | ?X1 => constr:(fct_cte X1) + end. + +(**********) +Ltac deriv_proof trm pt := + match constr:trm with + | (?X1 + ?X2)%F => + let p1 := deriv_proof X1 pt with p2 := deriv_proof X2 pt in + constr:(derivable_pt_plus X1 X2 pt p1 p2) + | (?X1 - ?X2)%F => + let p1 := deriv_proof X1 pt with p2 := deriv_proof X2 pt in + constr:(derivable_pt_minus X1 X2 pt p1 p2) + | (?X1 * ?X2)%F => + let p1 := deriv_proof X1 pt with p2 := deriv_proof X2 pt in + constr:(derivable_pt_mult X1 X2 pt p1 p2) + | (?X1 / ?X2)%F => + match goal with + | id:(?X2 pt <> 0) |- _ => + let p1 := deriv_proof X1 pt with p2 := deriv_proof X2 pt in + constr:(derivable_pt_div X1 X2 pt p1 p2 id) + | _ => constr:False + end + | (/ ?X1)%F => + match goal with + | id:(?X1 pt <> 0) |- _ => + let p1 := deriv_proof X1 pt in + constr:(derivable_pt_inv X1 pt p1 id) + | _ => constr:False + end + | (comp ?X1 ?X2) => + let pt_f1 := eval cbv beta in (X2 pt) in + let p1 := deriv_proof X1 pt_f1 with p2 := deriv_proof X2 pt in + constr:(derivable_pt_comp X2 X1 pt p2 p1) + | (- ?X1)%F => + let p1 := deriv_proof X1 pt in + constr:(derivable_pt_opp X1 pt p1) + | sin => constr:(derivable_pt_sin pt) + | cos => constr:(derivable_pt_cos pt) + | sinh => constr:(derivable_pt_sinh pt) + | cosh => constr:(derivable_pt_cosh pt) + | exp => constr:(derivable_pt_exp pt) + | id => constr:(derivable_pt_id pt) + | Rsqr => constr:(derivable_pt_Rsqr pt) + | sqrt => + match goal with + | id:(0 < pt) |- _ => constr:(derivable_pt_sqrt pt id) + | _ => constr:False + end + | (fct_cte ?X1) => constr:(derivable_pt_const X1 pt) + | ?X1 => + let aux := constr:X1 in + match goal with + | id:(derivable_pt aux pt) |- _ => constr:id + | id:(derivable aux) |- _ => constr:(id pt) + | _ => constr:False + end + end. + +(**********) +Ltac simplify_derive trm pt := + match constr:trm with + | (?X1 + ?X2)%F => + try rewrite derive_pt_plus; simplify_derive X1 pt; + simplify_derive X2 pt + | (?X1 - ?X2)%F => + try rewrite derive_pt_minus; simplify_derive X1 pt; + simplify_derive X2 pt + | (?X1 * ?X2)%F => + try rewrite derive_pt_mult; simplify_derive X1 pt; + simplify_derive X2 pt + | (?X1 / ?X2)%F => + try rewrite derive_pt_div; simplify_derive X1 pt; simplify_derive X2 pt + | (comp ?X1 ?X2) => + let pt_f1 := eval cbv beta in (X2 pt) in + (try rewrite derive_pt_comp; simplify_derive X1 pt_f1; + simplify_derive X2 pt) + | (- ?X1)%F => try rewrite derive_pt_opp; simplify_derive X1 pt + | (/ ?X1)%F => + try rewrite derive_pt_inv; simplify_derive X1 pt + | (fct_cte ?X1) => try rewrite derive_pt_const + | id => try rewrite derive_pt_id + | sin => try rewrite derive_pt_sin + | cos => try rewrite derive_pt_cos + | sinh => try rewrite derive_pt_sinh + | cosh => try rewrite derive_pt_cosh + | exp => try rewrite derive_pt_exp + | Rsqr => try rewrite derive_pt_Rsqr + | sqrt => try rewrite derive_pt_sqrt + | ?X1 => + let aux := constr:X1 in + match goal with + | id:(derive_pt aux pt ?X2 = _),H:(derivable aux) |- _ => + try replace (derive_pt aux pt (H pt)) with (derive_pt aux pt X2); + [ rewrite id | apply pr_nu ] + | id:(derive_pt aux pt ?X2 = _),H:(derivable_pt aux pt) |- _ => + try replace (derive_pt aux pt H) with (derive_pt aux pt X2); + [ rewrite id | apply pr_nu ] + | _ => idtac + end + | _ => idtac + end. + +(**********) +Ltac reg := + match goal with + | |- (derivable_pt ?X1 ?X2) => + let trm := eval cbv beta in (X1 AppVar) in + let aux := rew_term trm in + (intro_hyp_pt aux X2; + try (change (derivable_pt aux X2) in |- *; is_diff_pt) || is_diff_pt) + | |- (derivable ?X1) => + let trm := eval cbv beta in (X1 AppVar) in + let aux := rew_term trm in + (intro_hyp_glob aux; + try (change (derivable aux) in |- *; is_diff_glob) || is_diff_glob) + | |- (continuity ?X1) => + let trm := eval cbv beta in (X1 AppVar) in + let aux := rew_term trm in + (intro_hyp_glob aux; + try (change (continuity aux) in |- *; is_cont_glob) || is_cont_glob) + | |- (continuity_pt ?X1 ?X2) => + let trm := eval cbv beta in (X1 AppVar) in + let aux := rew_term trm in + (intro_hyp_pt aux X2; + try (change (continuity_pt aux X2) in |- *; is_cont_pt) || is_cont_pt) + | |- (derive_pt ?X1 ?X2 ?X3 = ?X4) => + let trm := eval cbv beta in (X1 AppVar) in + let aux := rew_term trm in + intro_hyp_pt aux X2; + (let aux2 := deriv_proof aux X2 in + try + (replace (derive_pt X1 X2 X3) with (derive_pt aux X2 aux2); + [ simplify_derive aux X2; + try unfold plus_fct, minus_fct, mult_fct, div_fct, id, fct_cte, + inv_fct, opp_fct in |- *; ring || ring_simplify + | try apply pr_nu ]) || is_diff_pt) + end. diff --git a/theories/Reals/Ratan.v b/theories/Reals/Ratan.v new file mode 100644 index 00000000..1a0ea969 --- /dev/null +++ b/theories/Reals/Ratan.v @@ -0,0 +1,1602 @@ +Require Import Fourier. +Require Import Rbase. +Require Import PSeries_reg. +Require Import Rtrigo1. +Require Import Ranalysis_reg. +Require Import Rfunctions. +Require Import AltSeries. +Require Import Rseries. +Require Import SeqProp. +Require Import Ranalysis5. +Require Import SeqSeries. +Require Import PartSum. + +Local Open Scope R_scope. + +(** Tools *) + +Lemma Ropp_div : forall x y, -x/y = -(x/y). +Proof. +intros x y; unfold Rdiv; rewrite <-Ropp_mult_distr_l_reverse; reflexivity. +Qed. + +Definition pos_half_prf : 0 < /2. +Proof. fourier. Qed. + +Definition pos_half := mkposreal (/2) pos_half_prf. + +Lemma Boule_half_to_interval : + forall x , Boule (/2) pos_half x -> 0 <= x <= 1. +Proof. +unfold Boule, pos_half; simpl. +intros x b; apply Rabs_def2 in b; destruct b; split; fourier. +Qed. + +Lemma Boule_lt : forall c r x, Boule c r x -> Rabs x < Rabs c + r. +Proof. +unfold Boule; intros c r x h. +apply Rabs_def2 in h; destruct h; apply Rabs_def1; + (destruct (Rle_lt_dec 0 c);[rewrite Rabs_pos_eq; fourier | + rewrite <- Rabs_Ropp, Rabs_pos_eq; fourier]). +Qed. + +(* The following lemma does not belong here. *) +Lemma Un_cv_ext : + forall un vn, (forall n, un n = vn n) -> + forall l, Un_cv un l -> Un_cv vn l. +Proof. +intros un vn quv l P eps ep; destruct (P eps ep) as [N Pn]; exists N. +intro n; rewrite <- quv; apply Pn. +Qed. + +(* The following two lemmas are general purposes about alternated series. + They do not belong here. *) +Lemma Alt_first_term_bound :forall f l N n, + Un_decreasing f -> Un_cv f 0 -> + Un_cv (sum_f_R0 (tg_alt f)) l -> + (N <= n)%nat -> + R_dist (sum_f_R0 (tg_alt f) n) l <= f N. +Proof. +intros f l. +assert (WLOG : + forall n P, (forall k, (0 < k)%nat -> P k) -> + ((forall k, (0 < k)%nat -> P k) -> P 0%nat) -> P n). +clear. +intros [ | n] P Hs Ho;[solve[apply Ho, Hs] | apply Hs; auto with arith]. +intros N; pattern N; apply WLOG; clear N. +intros [ | N] Npos n decr to0 cv nN. + clear -Npos; elimtype False; omega. + assert (decr' : Un_decreasing (fun i => f (S N + i)%nat)). + intros k; replace (S N+S k)%nat with (S (S N+k)) by ring. + apply (decr (S N + k)%nat). + assert (to' : Un_cv (fun i => f (S N + i)%nat) 0). + intros eps ep; destruct (to0 eps ep) as [M PM]. + exists M; intros k kM; apply PM; omega. + assert (cv' : Un_cv + (sum_f_R0 (tg_alt (fun i => ((-1) ^ S N * f(S N + i)%nat)))) + (l - sum_f_R0 (tg_alt f) N)). + intros eps ep; destruct (cv eps ep) as [M PM]; exists M. + intros n' nM. + match goal with |- ?C => set (U := C) end. + assert (nM' : (n' + S N >= M)%nat) by omega. + generalize (PM _ nM'); unfold R_dist. + rewrite (tech2 (tg_alt f) N (n' + S N)). + assert (t : forall a b c, (a + b) - c = b - (c - a)) by (intros; ring). + rewrite t; clear t; unfold U, R_dist; clear U. + replace (n' + S N - S N)%nat with n' by omega. + rewrite <- (sum_eq (tg_alt (fun i => (-1) ^ S N * f(S N + i)%nat))). + tauto. + intros i _; unfold tg_alt. + rewrite <- Rmult_assoc, <- pow_add, !(plus_comm i); reflexivity. + omega. + assert (cv'' : Un_cv (sum_f_R0 (tg_alt (fun i => f (S N + i)%nat))) + ((-1) ^ S N * (l - sum_f_R0 (tg_alt f) N))). + apply (Un_cv_ext (fun n => (-1) ^ S N * + sum_f_R0 (tg_alt (fun i : nat => (-1) ^ S N * f (S N + i)%nat)) n)). + intros n0; rewrite scal_sum; apply sum_eq; intros i _. + unfold tg_alt; ring_simplify; replace (((-1) ^ S N) ^ 2) with 1. + ring. + rewrite <- pow_mult, mult_comm, pow_mult; replace ((-1) ^2) with 1 by ring. + rewrite pow1; reflexivity. + apply CV_mult. + solve[intros eps ep; exists 0%nat; intros; rewrite R_dist_eq; auto]. + assumption. + destruct (even_odd_cor N) as [p [Neven | Nodd]]. + rewrite Neven; destruct (alternated_series_ineq _ _ p decr to0 cv) as [B C]. + case (even_odd_cor n) as [p' [neven | nodd]]. + rewrite neven. + destruct (alternated_series_ineq _ _ p' decr to0 cv) as [D E]. + unfold R_dist; rewrite Rabs_pos_eq;[ | fourier]. + assert (dist : (p <= p')%nat) by omega. + assert (t := decreasing_prop _ _ _ (CV_ALT_step1 f decr) dist). + apply Rle_trans with (sum_f_R0 (tg_alt f) (2 * p) - l). + unfold Rminus; apply Rplus_le_compat_r; exact t. + match goal with _ : ?a <= l, _ : l <= ?b |- _ => + replace (f (S (2 * p))) with (b - a) by + (rewrite tech5; unfold tg_alt; rewrite pow_1_odd; ring); fourier + end. + rewrite nodd; destruct (alternated_series_ineq _ _ p' decr to0 cv) as [D E]. + unfold R_dist; rewrite <- Rabs_Ropp, Rabs_pos_eq, Ropp_minus_distr; + [ | fourier]. + assert (dist : (p <= p')%nat) by omega. + apply Rle_trans with (l - sum_f_R0 (tg_alt f) (S (2 * p))). + unfold Rminus; apply Rplus_le_compat_l, Ropp_le_contravar. + solve[apply Rge_le, (growing_prop _ _ _ (CV_ALT_step0 f decr) dist)]. + unfold Rminus; rewrite tech5, Ropp_plus_distr, <- Rplus_assoc. + unfold tg_alt at 2; rewrite pow_1_odd, Ropp_mult_distr_l_reverse; fourier. + rewrite Nodd; destruct (alternated_series_ineq _ _ p decr to0 cv) as [B _]. + destruct (alternated_series_ineq _ _ (S p) decr to0 cv) as [_ C]. + assert (keep : (2 * S p = S (S ( 2 * p)))%nat) by ring. + case (even_odd_cor n) as [p' [neven | nodd]]. + rewrite neven; + destruct (alternated_series_ineq _ _ p' decr to0 cv) as [D E]. + unfold R_dist; rewrite Rabs_pos_eq;[ | fourier]. + assert (dist : (S p < S p')%nat) by omega. + apply Rle_trans with (sum_f_R0 (tg_alt f) (2 * S p) - l). + unfold Rminus; apply Rplus_le_compat_r, + (decreasing_prop _ _ _ (CV_ALT_step1 f decr)). + omega. + rewrite keep, tech5; unfold tg_alt at 2; rewrite <- keep, pow_1_even. + fourier. + rewrite nodd; destruct (alternated_series_ineq _ _ p' decr to0 cv) as [D E]. + unfold R_dist; rewrite <- Rabs_Ropp, Rabs_pos_eq;[ | fourier]. + rewrite Ropp_minus_distr. + apply Rle_trans with (l - sum_f_R0 (tg_alt f) (S (2 * p))). + unfold Rminus; apply Rplus_le_compat_l, Ropp_le_contravar, Rge_le, + (growing_prop _ _ _ (CV_ALT_step0 f decr)); omega. + generalize C; rewrite keep, tech5; unfold tg_alt. + rewrite <- keep, pow_1_even. + assert (t : forall a b c, a <= b + 1 * c -> a - b <= c) by (intros; fourier). + solve[apply t]. +clear WLOG; intros Hyp [ | n] decr to0 cv _. + generalize (alternated_series_ineq f l 0 decr to0 cv). + unfold R_dist, tg_alt; simpl; rewrite !Rmult_1_l, !Rmult_1_r. + assert (f 1%nat <= f 0%nat) by apply decr. + rewrite Ropp_mult_distr_l_reverse. + intros [A B]; rewrite Rabs_pos_eq; fourier. +apply Rle_trans with (f 1%nat). + apply (Hyp 1%nat (le_n 1) (S n) decr to0 cv). + omega. +solve[apply decr]. +Qed. + +Lemma Alt_CVU : forall (f : nat -> R -> R) g h c r, + (forall x, Boule c r x ->Un_decreasing (fun n => f n x)) -> + (forall x, Boule c r x -> Un_cv (fun n => f n x) 0) -> + (forall x, Boule c r x -> + Un_cv (sum_f_R0 (tg_alt (fun i => f i x))) (g x)) -> + (forall x n, Boule c r x -> f n x <= h n) -> + (Un_cv h 0) -> + CVU (fun N x => sum_f_R0 (tg_alt (fun i => f i x)) N) g c r. +Proof. +intros f g h c r decr to0 to_g bound bound0 eps ep. +assert (ep' : 0 <eps/2) by fourier. +destruct (bound0 _ ep) as [N Pn]; exists N. +intros n y nN dy. +rewrite <- Rabs_Ropp, Ropp_minus_distr; apply Rle_lt_trans with (f n y). + solve[apply (Alt_first_term_bound (fun i => f i y) (g y) n n); auto]. +apply Rle_lt_trans with (h n). + apply bound; assumption. +clear - nN Pn. +generalize (Pn _ nN); unfold R_dist; rewrite Rminus_0_r; intros t. +apply Rabs_def2 in t; tauto. +Qed. + +(* The following lemmas are general purpose lemmas about squares. + They do not belong here *) + +Lemma pow2_ge_0 : forall x, 0 <= x ^ 2. +Proof. +intros x; destruct (Rle_lt_dec 0 x). + replace (x ^ 2) with (x * x) by field. + apply Rmult_le_pos; assumption. + replace (x ^ 2) with ((-x) * (-x)) by field. +apply Rmult_le_pos; fourier. +Qed. + +Lemma pow2_abs : forall x, Rabs x ^ 2 = x ^ 2. +Proof. +intros x; destruct (Rle_lt_dec 0 x). + rewrite Rabs_pos_eq;[field | assumption]. +rewrite <- Rabs_Ropp, Rabs_pos_eq;[field | fourier]. +Qed. + +(** * Properties of tangent *) + +Lemma derivable_pt_tan : forall x, -PI/2 < x < PI/2 -> derivable_pt tan x. +Proof. +intros x xint. + unfold derivable_pt, tan. + apply derivable_pt_div ; [reg | reg | ]. + apply Rgt_not_eq. + unfold Rgt ; apply cos_gt_0; + [unfold Rdiv; rewrite <- Ropp_mult_distr_l_reverse; fold (-PI/2) |];tauto. +Qed. + +Lemma derive_pt_tan : forall (x:R), + forall (Pr1: -PI/2 < x < PI/2), + derive_pt tan x (derivable_pt_tan x Pr1) = 1 + (tan x)^2. +Proof. +intros x pr. +assert (cos x <> 0). + apply Rgt_not_eq, cos_gt_0; rewrite <- ?Ropp_div; tauto. +unfold tan; reg; unfold pow, Rsqr; field; assumption. +Qed. + +(** Proof that tangent is a bijection *) +(* to be removed? *) + +Lemma derive_increasing_interv : + forall (a b:R) (f:R -> R), + a < b -> + forall (pr:forall x, a < x < b -> derivable_pt f x), + (forall t:R, forall (t_encad : a < t < b), 0 < derive_pt f t (pr t t_encad)) -> + forall x y:R, a < x < b -> a < y < b -> x < y -> f x < f y. +Proof. +intros a b f a_lt_b pr Df_gt_0 x y x_encad y_encad x_lt_y. + assert (derivable_id_interv : forall c : R, x < c < y -> derivable_pt id c). + intros ; apply derivable_pt_id. + assert (derivable_f_interv : forall c : R, x < c < y -> derivable_pt f c). + intros c c_encad. apply pr. split. + apply Rlt_trans with (r2:=x) ; [exact (proj1 x_encad) | exact (proj1 c_encad)]. + apply Rlt_trans with (r2:=y) ; [exact (proj2 c_encad) | exact (proj2 y_encad)]. + assert (f_cont_interv : forall c : R, x <= c <= y -> continuity_pt f c). + intros c c_encad; apply derivable_continuous_pt ; apply pr. split. + apply Rlt_le_trans with (r2:=x) ; [exact (proj1 x_encad) | exact (proj1 c_encad)]. + apply Rle_lt_trans with (r2:=y) ; [ exact (proj2 c_encad) | exact (proj2 y_encad)]. + assert (id_cont_interv : forall c : R, x <= c <= y -> continuity_pt id c). + intros ; apply derivable_continuous_pt ; apply derivable_pt_id. + elim (MVT f id x y derivable_f_interv derivable_id_interv x_lt_y f_cont_interv id_cont_interv). + intros c Temp ; elim Temp ; clear Temp ; intros Pr eq. + replace (id y - id x) with (y - x) in eq by intuition. + replace (derive_pt id c (derivable_id_interv c Pr)) with 1 in eq. + assert (Hyp : f y - f x > 0). + rewrite Rmult_1_r in eq. rewrite <- eq. + apply Rmult_gt_0_compat. + apply Rgt_minus ; assumption. + assert (c_encad2 : a <= c < b). + split. + apply Rlt_le ; apply Rlt_trans with (r2:=x) ; [exact (proj1 x_encad) | exact (proj1 Pr)]. + apply Rle_lt_trans with (r2:=y) ; [apply Rlt_le ; exact (proj2 Pr) | exact (proj2 y_encad)]. + assert (c_encad : a < c < b). + split. + apply Rlt_trans with (r2:=x) ; [exact (proj1 x_encad) | exact (proj1 Pr)]. + apply Rle_lt_trans with (r2:=y) ; [apply Rlt_le ; exact (proj2 Pr) | exact (proj2 y_encad)]. + assert (Temp := Df_gt_0 c c_encad). + assert (Temp2 := pr_nu f c (derivable_f_interv c Pr) (pr c c_encad)). + rewrite Temp2 ; apply Temp. + apply Rminus_gt ; exact Hyp. + symmetry ; rewrite derive_pt_eq ; apply derivable_pt_lim_id. +Qed. + +(* begin hide *) +Lemma plus_Rsqr_gt_0 : forall x, 1 + x ^ 2 > 0. +Proof. +intro m. replace 0 with (0+0) by intuition. + apply Rplus_gt_ge_compat. intuition. + elim (total_order_T m 0) ; intro s'. case s'. + intros m_cond. replace 0 with (0*0) by intuition. + replace (m ^ 2) with ((-m)^2). + apply Rle_ge ; apply Rmult_le_compat ; intuition ; apply Rlt_le ; rewrite Rmult_1_r ; intuition. + field. + intro H' ; rewrite H' ; right ; field. + left. intuition. +Qed. +(* end hide *) + +(* The following lemmas about PI should probably be in Rtrigo. *) + +Lemma PI2_lower_bound : + forall x, 0 < x < 2 -> 0 < cos x -> x < PI/2. +Proof. +intros x [xp xlt2] cx. +destruct (Rtotal_order x (PI/2)) as [xltpi2 | [xeqpi2 | xgtpi2]]. + assumption. + now case (Rgt_not_eq _ _ cx); rewrite xeqpi2, cos_PI2. +destruct (MVT_cor1 cos (PI/2) x derivable_cos xgtpi2) as + [c [Pc [cint1 cint2]]]. +revert Pc; rewrite cos_PI2, Rminus_0_r. +rewrite <- (pr_nu cos c (derivable_pt_cos c)), derive_pt_cos. +assert (0 < c < 2) by (split; assert (t := PI2_RGT_0); fourier). +assert (0 < sin c) by now apply sin_pos_tech. +intros Pc. +case (Rlt_not_le _ _ cx). +rewrite <- (Rplus_0_l (cos x)), Pc, Ropp_mult_distr_l_reverse. +apply Rle_minus, Rmult_le_pos;[apply Rlt_le; assumption | fourier ]. +Qed. + +Lemma PI2_3_2 : 3/2 < PI/2. +Proof. +apply PI2_lower_bound;[split; fourier | ]. +destruct (pre_cos_bound (3/2) 1) as [t _]; [fourier | fourier | ]. +apply Rlt_le_trans with (2 := t); clear t. +unfold cos_approx; simpl; unfold cos_term. +simpl mult; replace ((-1)^ 0) with 1 by ring; replace ((-1)^2) with 1 by ring; + replace ((-1)^4) with 1 by ring; replace ((-1)^1) with (-1) by ring; + replace ((-1)^3) with (-1) by ring; replace 3 with (IZR 3) by (simpl; ring); + replace 2 with (IZR 2) by (simpl; ring); simpl Z.of_nat; + rewrite !INR_IZR_INZ, Ropp_mult_distr_l_reverse, Rmult_1_l. +match goal with |- _ < ?a => +replace a with ((- IZR 3 ^ 6 * IZR (Z.of_nat (fact 0)) * IZR (Z.of_nat (fact 2)) * + IZR (Z.of_nat (fact 4)) + + IZR 3 ^ 4 * IZR 2 ^ 2 * IZR (Z.of_nat (fact 0)) * IZR (Z.of_nat (fact 2)) * + IZR (Z.of_nat (fact 6)) - + IZR 3 ^ 2 * IZR 2 ^ 4 * IZR (Z.of_nat (fact 0)) * IZR (Z.of_nat (fact 4)) * + IZR (Z.of_nat (fact 6)) + + IZR 2 ^ 6 * IZR (Z.of_nat (fact 2)) * IZR (Z.of_nat (fact 4)) * + IZR (Z.of_nat (fact 6))) / + (IZR 2 ^ 6 * IZR (Z.of_nat (fact 0)) * IZR (Z.of_nat (fact 2)) * + IZR (Z.of_nat (fact 4)) * IZR (Z.of_nat (fact 6))));[ | field; + repeat apply conj;((rewrite <- INR_IZR_INZ; apply INR_fact_neq_0) || + (apply Rgt_not_eq; apply (IZR_lt 0); reflexivity)) ] +end. +rewrite !fact_simpl, !Nat2Z.inj_mul; simpl Z.of_nat. +unfold Rdiv; apply Rmult_lt_0_compat. +unfold Rminus; rewrite !pow_IZR, <- !opp_IZR, <- !mult_IZR, <- !opp_IZR, + <- !plus_IZR; apply (IZR_lt 0); reflexivity. +apply Rinv_0_lt_compat; rewrite !pow_IZR, <- !mult_IZR; apply (IZR_lt 0). +reflexivity. +Qed. + +Lemma PI2_1 : 1 < PI/2. +Proof. assert (t := PI2_3_2); fourier. Qed. + +Lemma tan_increasing : + forall x y:R, + -PI/2 < x -> + x < y -> + y < PI/2 -> tan x < tan y. +Proof. +intros x y Z_le_x x_lt_y y_le_1. + assert (x_encad : -PI/2 < x < PI/2). + split ; [assumption | apply Rlt_trans with (r2:=y) ; assumption]. + assert (y_encad : -PI/2 < y < PI/2). + split ; [apply Rlt_trans with (r2:=x) ; intuition | intuition ]. + assert (local_derivable_pt_tan : forall x : R, -PI/2 < x < PI/2 -> + derivable_pt tan x). + intros ; apply derivable_pt_tan ; intuition. + apply derive_increasing_interv with (a:=-PI/2) (b:=PI/2) (pr:=local_derivable_pt_tan) ; intuition. + fourier. + assert (Temp := pr_nu tan t (derivable_pt_tan t t_encad) (local_derivable_pt_tan t t_encad)) ; + rewrite <- Temp ; clear Temp. + assert (Temp := derive_pt_tan t t_encad) ; rewrite Temp ; clear Temp. + apply plus_Rsqr_gt_0. +Qed. + +Lemma tan_is_inj : forall x y, -PI/2 < x < PI/2 -> -PI/2 < y < PI/2 -> + tan x = tan y -> x = y. +Proof. + intros a b a_encad b_encad fa_eq_fb. + case(total_order_T a b). + intro s ; case s ; clear s. + intro Hf. + assert (Hfalse := tan_increasing a b (proj1 a_encad) Hf (proj2 b_encad)). + case (Rlt_not_eq (tan a) (tan b)) ; assumption. + intuition. + intro Hf. assert (Hfalse := tan_increasing b a (proj1 b_encad) Hf (proj2 a_encad)). + case (Rlt_not_eq (tan b) (tan a)) ; [|symmetry] ; assumption. +Qed. + +Lemma exists_atan_in_frame : + forall lb ub y, lb < ub -> -PI/2 < lb -> ub < PI/2 -> + tan lb < y < tan ub -> {x | lb < x < ub /\ tan x = y}. +Proof. +intros lb ub y lb_lt_ub lb_cond ub_cond y_encad. + case y_encad ; intros y_encad1 y_encad2. + assert (f_cont : forall a : R, lb <= a <= ub -> continuity_pt tan a). + intros a a_encad. apply derivable_continuous_pt ; apply derivable_pt_tan. + split. apply Rlt_le_trans with (r2:=lb) ; intuition. + apply Rle_lt_trans with (r2:=ub) ; intuition. + assert (Cont : forall a : R, lb <= a <= ub -> continuity_pt (fun x => tan x - y) a). + intros a a_encad. unfold continuity_pt, continue_in, limit1_in, limit_in ; simpl ; unfold R_dist. + intros eps eps_pos. elim (f_cont a a_encad eps eps_pos). + intros alpha alpha_pos. destruct alpha_pos as (alpha_pos,Temp). + exists alpha. split. + assumption. intros x x_cond. + replace (tan x - y - (tan a - y)) with (tan x - tan a) by field. + exact (Temp x x_cond). + assert (H1 : (fun x : R => tan x - y) lb < 0). + apply Rlt_minus. assumption. + assert (H2 : 0 < (fun x : R => tan x - y) ub). + apply Rgt_minus. assumption. + destruct (IVT_interv (fun x => tan x - y) lb ub Cont lb_lt_ub H1 H2) as (x,Hx). + exists x. + destruct Hx as (Hyp,Result). + intuition. + assert (Temp2 : x <> lb). + intro Hfalse. rewrite Hfalse in Result. + assert (Temp2 : y <> tan lb). + apply Rgt_not_eq ; assumption. + clear - Temp2 Result. apply Temp2. + intuition. + clear -Temp2 H3. + case H3 ; intuition. apply False_ind ; apply Temp2 ; symmetry ; assumption. + assert (Temp : x <> ub). + intro Hfalse. rewrite Hfalse in Result. + assert (Temp2 : y <> tan ub). + apply Rlt_not_eq ; assumption. + clear - Temp2 Result. apply Temp2. + intuition. + case H4 ; intuition. +Qed. + +(** * Definition of arctangent as the reciprocal function of tangent and proof of this status *) +Lemma tan_1_gt_1 : tan 1 > 1. +Proof. +assert (0 < cos 1) by (apply cos_gt_0; assert (t:=PI2_1); fourier). +assert (t1 : cos 1 <= 1 - 1/2 + 1/24). + destruct (pre_cos_bound 1 0) as [_ t]; try fourier; revert t. + unfold cos_approx, cos_term; simpl; intros t; apply Rle_trans with (1:=t). + clear t; apply Req_le; field. +assert (t2 : 1 - 1/6 <= sin 1). + destruct (pre_sin_bound 1 0) as [t _]; try fourier; revert t. + unfold sin_approx, sin_term; simpl; intros t; apply Rle_trans with (2:=t). + clear t; apply Req_le; field. +pattern 1 at 2; replace 1 with + (cos 1 / cos 1) by (field; apply Rgt_not_eq; fourier). +apply Rlt_gt; apply (Rmult_lt_compat_r (/ cos 1) (cos 1) (sin 1)). + apply Rinv_0_lt_compat; assumption. +apply Rle_lt_trans with (1 := t1); apply Rlt_le_trans with (2 := t2). +fourier. +Qed. + +Definition frame_tan y : {x | 0 < x < PI/2 /\ Rabs y < tan x}. +destruct (total_order_T (Rabs y) 1). + assert (yle1 : Rabs y <= 1) by (destruct s; fourier). + clear s; exists 1; split;[split; [exact Rlt_0_1 | exact PI2_1] | ]. + apply Rle_lt_trans with (1 := yle1); exact tan_1_gt_1. +assert (0 < / (Rabs y + 1)). + apply Rinv_0_lt_compat; fourier. +set (u := /2 * / (Rabs y + 1)). +assert (0 < u). + apply Rmult_lt_0_compat; [fourier | assumption]. +assert (vlt1 : / (Rabs y + 1) < 1). + apply Rmult_lt_reg_r with (Rabs y + 1). + assert (t := Rabs_pos y); fourier. + rewrite Rinv_l; [rewrite Rmult_1_l | apply Rgt_not_eq]; fourier. +assert (vlt2 : u < 1). + apply Rlt_trans with (/ (Rabs y + 1)). + rewrite double_var. + assert (t : forall x, 0 < x -> x < x + x) by (clear; intros; fourier). + unfold u; rewrite Rmult_comm; apply t. + unfold Rdiv; rewrite Rmult_comm; assumption. + assumption. +assert(int : 0 < PI / 2 - u < PI / 2). + split. + assert (t := PI2_1); apply Rlt_Rminus, Rlt_trans with (2 := t); assumption. + assert (dumb : forall x y, 0 < y -> x - y < x) by (clear; intros; fourier). + apply dumb; clear dumb; assumption. +exists (PI/2 - u). +assert (tmp : forall x y, 0 < x -> y < 1 -> x * y < x). + clear; intros x y x0 y1; pattern x at 2; rewrite <- (Rmult_1_r x). + apply Rmult_lt_compat_l; assumption. +assert (0 < sin u). + apply sin_gt_0;[ assumption | ]. + assert (t := PI2_Rlt_PI); assert (t' := PI2_1). + apply Rlt_trans with (2 := Rlt_trans _ _ _ t' t); assumption. +split. + assumption. + apply Rlt_trans with (/2 * / cos(PI / 2 - u)). + rewrite cos_shift. + assert (sin u < u). + assert (t1 : 0 <= u) by (apply Rlt_le; assumption). + assert (t2 : u <= 4) by + (apply Rle_trans with 1;[apply Rlt_le | fourier]; assumption). + destruct (pre_sin_bound u 0 t1 t2) as [_ t]. + apply Rle_lt_trans with (1 := t); clear t1 t2 t. + unfold sin_approx; simpl; unfold sin_term; simpl ((-1) ^ 0); + replace ((-1) ^ 2) with 1 by ring; simpl ((-1) ^ 1); + rewrite !Rmult_1_r, !Rmult_1_l; simpl plus; simpl (INR (fact 1)). + rewrite <- (fun x => tech_pow_Rmult x 0), <- (fun x => tech_pow_Rmult x 2), + <- (fun x => tech_pow_Rmult x 4). + rewrite (Rmult_comm (-1)); simpl ((/(Rabs y + 1)) ^ 0). + unfold Rdiv; rewrite Rinv_1, !Rmult_assoc, <- !Rmult_plus_distr_l. + apply tmp;[assumption | ]. + rewrite Rplus_assoc, Rmult_1_l; pattern 1 at 3; rewrite <- Rplus_0_r. + apply Rplus_lt_compat_l. + rewrite <- Rmult_assoc. + match goal with |- (?a * (-1)) + _ < 0 => + rewrite <- (Rplus_opp_l a), Ropp_mult_distr_r_reverse, Rmult_1_r + end. + apply Rplus_lt_compat_l. + assert (0 < u ^ 2) by (apply pow_lt; assumption). + replace (u ^ 4) with (u ^ 2 * u ^ 2) by ring. + rewrite Rmult_assoc; apply Rmult_lt_compat_l; auto. + apply Rlt_trans with (u ^ 2 * /INR (fact 3)). + apply Rmult_lt_compat_l; auto. + apply Rinv_lt_contravar. + solve[apply Rmult_lt_0_compat; apply INR_fact_lt_0]. + rewrite !INR_IZR_INZ; apply IZR_lt; reflexivity. + rewrite Rmult_comm; apply tmp. + solve[apply Rinv_0_lt_compat, INR_fact_lt_0]. + apply Rlt_trans with (2 := vlt2). + simpl; unfold u; apply tmp; auto; rewrite Rmult_1_r; assumption. + apply Rlt_trans with (Rabs y + 1);[fourier | ]. + pattern (Rabs y + 1) at 1; rewrite <- (Rinv_involutive (Rabs y + 1)); + [ | apply Rgt_not_eq; fourier]. + rewrite <- Rinv_mult_distr. + apply Rinv_lt_contravar. + apply Rmult_lt_0_compat. + apply Rmult_lt_0_compat;[fourier | assumption]. + assumption. + replace (/(Rabs y + 1)) with (2 * u). + fourier. + unfold u; field; apply Rgt_not_eq; clear -r; fourier. + solve[discrR]. + apply Rgt_not_eq; assumption. +unfold tan. +set (u' := PI / 2); unfold Rdiv; apply Rmult_lt_compat_r; unfold u'. + apply Rinv_0_lt_compat. + rewrite cos_shift; assumption. +assert (vlt3 : u < /4). + replace (/4) with (/2 * /2) by field. + unfold u; apply Rmult_lt_compat_l;[fourier | ]. + apply Rinv_lt_contravar. + apply Rmult_lt_0_compat; fourier. + fourier. +assert (1 < PI / 2 - u) by (assert (t := PI2_3_2); fourier). +apply Rlt_trans with (sin 1). + assert (t' : 1 <= 4) by fourier. + destruct (pre_sin_bound 1 0 (Rlt_le _ _ Rlt_0_1) t') as [t _]. + apply Rlt_le_trans with (2 := t); clear t. + simpl plus; replace (sin_approx 1 1) with (5/6);[fourier | ]. + unfold sin_approx, sin_term; simpl; field. +apply sin_increasing_1. + assert (t := PI2_1); fourier. + apply Rlt_le, PI2_1. + assert (t := PI2_1); fourier. + fourier. +assumption. +Qed. + +Lemma ub_opp : forall x, x < PI/2 -> -PI/2 < -x. +Proof. +intros x h; rewrite Ropp_div; apply Ropp_lt_contravar; assumption. +Qed. + +Lemma pos_opp_lt : forall x, 0 < x -> -x < x. +Proof. intros; fourier. Qed. + +Lemma tech_opp_tan : forall x y, -tan x < y -> tan (-x) < y. +intros; rewrite tan_neg; assumption. +Qed. + +Definition pre_atan (y : R) : {x : R | -PI/2 < x < PI/2 /\ tan x = y}. +destruct (frame_tan y) as [ub [[ub0 ubpi2] Ptan_ub]]. +set (pr := (conj (tech_opp_tan _ _ (proj2 (Rabs_def2 _ _ Ptan_ub))) + (proj1 (Rabs_def2 _ _ Ptan_ub)))). +destruct (exists_atan_in_frame (-ub) ub y (pos_opp_lt _ ub0) (ub_opp _ ubpi2) + ubpi2 pr) as [v [[vl vu] vq]]. +exists v; clear pr. +split;[rewrite Ropp_div; split; fourier | assumption]. +Qed. + +Definition atan x := let (v, _) := pre_atan x in v. + +Lemma atan_bound : forall x, -PI/2 < atan x < PI/2. +Proof. +intros x; unfold atan; destruct (pre_atan x) as [v [int _]]; exact int. +Qed. + +Lemma atan_right_inv : forall x, tan (atan x) = x. +Proof. +intros x; unfold atan; destruct (pre_atan x) as [v [_ q]]; exact q. +Qed. + +Lemma atan_opp : forall x, atan (- x) = - atan x. +Proof. +intros x; generalize (atan_bound (-x)); rewrite Ropp_div;intros [a b]. +generalize (atan_bound x); rewrite Ropp_div; intros [c d]. +apply tan_is_inj; try rewrite Ropp_div; try split; try fourier. +rewrite tan_neg, !atan_right_inv; reflexivity. +Qed. + +Lemma derivable_pt_atan : forall x, derivable_pt atan x. +Proof. +intros x. +destruct (frame_tan x) as [ub [[ub0 ubpi] P]]. +assert (lb_lt_ub : -ub < ub) by apply pos_opp_lt, ub0. +assert (xint : tan(-ub) < x < tan ub). + assert (xint' : x < tan ub /\ -(tan ub) < x) by apply Rabs_def2, P. + rewrite tan_neg; tauto. +assert (inv_p : forall x, tan(-ub) <= x -> x <= tan ub -> + comp tan atan x = id x). + intros; apply atan_right_inv. +assert (int_tan : forall y, tan (- ub) <= y -> y <= tan ub -> + -ub <= atan y <= ub). + clear -ub0 ubpi; intros y lo up; split. + destruct (Rle_lt_dec (-ub) (atan y)) as [h | abs]; auto. + assert (y < tan (-ub)). + rewrite <- (atan_right_inv y); apply tan_increasing. + destruct (atan_bound y); assumption. + assumption. + fourier. + fourier. + destruct (Rle_lt_dec (atan y) ub) as [h | abs]; auto. + assert (tan ub < y). + rewrite <- (atan_right_inv y); apply tan_increasing. + rewrite Ropp_div; fourier. + assumption. + destruct (atan_bound y); assumption. + fourier. +assert (incr : forall x y, -ub <= x -> x < y -> y <= ub -> tan x < tan y). + intros y z l yz u; apply tan_increasing. + rewrite Ropp_div; fourier. + assumption. + fourier. +assert (der : forall a, -ub <= a <= ub -> derivable_pt tan a). + intros a [la ua]; apply derivable_pt_tan. + rewrite Ropp_div; split; fourier. +assert (df_neq : derive_pt tan (atan x) + (derivable_pt_recip_interv_prelim1 tan atan + (- ub) ub x lb_lt_ub xint inv_p int_tan incr der) <> 0). + rewrite <- (pr_nu tan (atan x) + (derivable_pt_tan (atan x) (atan_bound x))). + rewrite derive_pt_tan. + solve[apply Rgt_not_eq, plus_Rsqr_gt_0]. +apply (derivable_pt_recip_interv tan atan (-ub) ub x + lb_lt_ub xint inv_p int_tan incr der). +exact df_neq. +Qed. + +Lemma atan_increasing : forall x y, x < y -> atan x < atan y. +intros x y d. +assert (t1 := atan_bound x). +assert (t2 := atan_bound y). +destruct (Rlt_le_dec (atan x) (atan y)) as [lt | bad]. + assumption. +apply Rlt_not_le in d. +case d. +rewrite <- (atan_right_inv y), <- (atan_right_inv x). +destruct bad as [ylt | yx]. + apply Rlt_le, tan_increasing; try tauto. +solve[rewrite yx; apply Rle_refl]. +Qed. + +Lemma atan_0 : atan 0 = 0. +apply tan_is_inj; try (apply atan_bound). + assert (t := PI_RGT_0); rewrite Ropp_div; split; fourier. +rewrite atan_right_inv, tan_0. +reflexivity. +Qed. + +Lemma atan_1 : atan 1 = PI/4. +assert (ut := PI_RGT_0). +assert (-PI/2 < PI/4 < PI/2) by (rewrite Ropp_div; split; fourier). +assert (t := atan_bound 1). +apply tan_is_inj; auto. +rewrite tan_PI4, atan_right_inv; reflexivity. +Qed. + +(** atan's derivative value is the function 1 / (1+x²) *) + +Lemma derive_pt_atan : forall x, + derive_pt atan x (derivable_pt_atan x) = + 1 / (1 + x²). +Proof. +intros x. +destruct (frame_tan x) as [ub [[ub0 ubpi] Pub]]. +assert (lb_lt_ub : -ub < ub) by apply pos_opp_lt, ub0. +assert (xint : tan(-ub) < x < tan ub). + assert (xint' : x < tan ub /\ -(tan ub) < x) by apply Rabs_def2, Pub. + rewrite tan_neg; tauto. +assert (inv_p : forall x, tan(-ub) <= x -> x <= tan ub -> + comp tan atan x = id x). + intros; apply atan_right_inv. +assert (int_tan : forall y, tan (- ub) <= y -> y <= tan ub -> + -ub <= atan y <= ub). + clear -ub0 ubpi; intros y lo up; split. + destruct (Rle_lt_dec (-ub) (atan y)) as [h | abs]; auto. + assert (y < tan (-ub)). + rewrite <- (atan_right_inv y); apply tan_increasing. + destruct (atan_bound y); assumption. + assumption. + fourier. + fourier. + destruct (Rle_lt_dec (atan y) ub) as [h | abs]; auto. + assert (tan ub < y). + rewrite <- (atan_right_inv y); apply tan_increasing. + rewrite Ropp_div; fourier. + assumption. + destruct (atan_bound y); assumption. + fourier. +assert (incr : forall x y, -ub <= x -> x < y -> y <= ub -> tan x < tan y). + intros y z l yz u; apply tan_increasing. + rewrite Ropp_div; fourier. + assumption. + fourier. +assert (der : forall a, -ub <= a <= ub -> derivable_pt tan a). + intros a [la ua]; apply derivable_pt_tan. + rewrite Ropp_div; split; fourier. +assert (df_neq : derive_pt tan (atan x) + (derivable_pt_recip_interv_prelim1 tan atan + (- ub) ub x lb_lt_ub xint inv_p int_tan incr der) <> 0). + rewrite <- (pr_nu tan (atan x) + (derivable_pt_tan (atan x) (atan_bound x))). + rewrite derive_pt_tan. + solve[apply Rgt_not_eq, plus_Rsqr_gt_0]. +assert (t := derive_pt_recip_interv tan atan (-ub) ub x lb_lt_ub + xint incr int_tan der inv_p df_neq). +rewrite <- (pr_nu atan x (derivable_pt_recip_interv tan atan (- ub) ub + x lb_lt_ub xint inv_p int_tan incr der df_neq)). +rewrite t. +assert (t' := atan_bound x). +rewrite <- (pr_nu tan (atan x) (derivable_pt_tan _ t')). +rewrite derive_pt_tan, atan_right_inv. +replace (Rsqr x) with (x ^ 2) by (unfold Rsqr; ring). +reflexivity. +Qed. + +(** * Definition of the arctangent function as the sum of the arctan power series *) +(* Proof taken from Guillaume Melquiond's interval package for Coq *) + +Definition Ratan_seq x := fun n => (x ^ (2 * n + 1) / INR (2 * n + 1))%R. + +Lemma Ratan_seq_decreasing : forall x, (0 <= x <= 1)%R -> Un_decreasing (Ratan_seq x). +Proof. +intros x Hx n. + unfold Ratan_seq, Rdiv. + apply Rmult_le_compat. apply pow_le. + exact (proj1 Hx). + apply Rlt_le. + apply Rinv_0_lt_compat. + apply lt_INR_0. + omega. + destruct (proj1 Hx) as [Hx1|Hx1]. + destruct (proj2 Hx) as [Hx2|Hx2]. + (* . 0 < x < 1 *) + rewrite <- (Rinv_involutive x). + assert (/ x <> 0)%R by auto with real. + repeat rewrite <- Rinv_pow with (1 := H). + apply Rlt_le. + apply Rinv_lt_contravar. + apply Rmult_lt_0_compat ; apply pow_lt ; auto with real. + apply Rlt_pow. + rewrite <- Rinv_1. + apply Rinv_lt_contravar. + rewrite Rmult_1_r. + exact Hx1. + exact Hx2. + omega. + apply Rgt_not_eq. + exact Hx1. + (* . x = 1 *) + rewrite Hx2. + do 2 rewrite pow1. + apply Rle_refl. + (* . x = 0 *) + rewrite <- Hx1. + do 2 (rewrite pow_i ; [ idtac | omega ]). + apply Rle_refl. + apply Rlt_le. + apply Rinv_lt_contravar. + apply Rmult_lt_0_compat ; apply lt_INR_0 ; omega. + apply lt_INR. + omega. +Qed. + +Lemma Ratan_seq_converging : forall x, (0 <= x <= 1)%R -> Un_cv (Ratan_seq x) 0. +Proof. +intros x Hx eps Heps. + destruct (archimed (/ eps)) as (HN,_). + assert (0 < up (/ eps))%Z. + apply lt_IZR. + apply Rlt_trans with (2 := HN). + apply Rinv_0_lt_compat. + exact Heps. + case_eq (up (/ eps)) ; + intros ; rewrite H0 in H ; try discriminate H. + rewrite H0 in HN. + simpl in HN. + pose (N := Pos.to_nat p). + fold N in HN. + clear H H0. + exists N. + intros n Hn. + unfold R_dist. + rewrite Rminus_0_r. + unfold Ratan_seq. + rewrite Rabs_right. + apply Rle_lt_trans with (1 ^ (2 * n + 1) / INR (2 * n + 1))%R. + unfold Rdiv. + apply Rmult_le_compat_r. + apply Rlt_le. + apply Rinv_0_lt_compat. + apply lt_INR_0. + omega. + apply pow_incr. + exact Hx. + rewrite pow1. + apply Rle_lt_trans with (/ INR (2 * N + 1))%R. + unfold Rdiv. + rewrite Rmult_1_l. + apply Rle_Rinv. + apply lt_INR_0. + omega. + replace 0 with (INR 0) by intuition. + apply lt_INR. + omega. + intuition. + rewrite <- (Rinv_involutive eps). + apply Rinv_lt_contravar. + apply Rmult_lt_0_compat. + auto with real. + apply lt_INR_0. + omega. + apply Rlt_trans with (INR N). + destruct (archimed (/ eps)) as (H,_). + assert (0 < up (/ eps))%Z. + apply lt_IZR. + apply Rlt_trans with (2 := H). + apply Rinv_0_lt_compat. + exact Heps. + exact HN. + apply lt_INR. + omega. + apply Rgt_not_eq. + exact Heps. + apply Rle_ge. + unfold Rdiv. + apply Rmult_le_pos. + apply pow_le. + exact (proj1 Hx). + apply Rlt_le. + apply Rinv_0_lt_compat. + apply lt_INR_0. + omega. +Qed. + +Definition ps_atan_exists_01 (x : R) (Hx:0 <= x <= 1) : + {l : R | Un_cv (fun N : nat => sum_f_R0 (tg_alt (Ratan_seq x)) N) l}. +exact (alternated_series (Ratan_seq x) + (Ratan_seq_decreasing _ Hx) (Ratan_seq_converging _ Hx)). +Defined. + +Lemma Ratan_seq_opp : forall x n, Ratan_seq (-x) n = -Ratan_seq x n. +Proof. +intros x n; unfold Ratan_seq. +rewrite !pow_add, !pow_mult, !pow_1. +unfold Rdiv; replace ((-x) ^ 2) with (x ^ 2) by ring; ring. +Qed. + +Lemma sum_Ratan_seq_opp : + forall x n, sum_f_R0 (tg_alt (Ratan_seq (- x))) n = + - sum_f_R0 (tg_alt (Ratan_seq x)) n. +Proof. +intros x n; replace (-sum_f_R0 (tg_alt (Ratan_seq x)) n) with + (-1 * sum_f_R0 (tg_alt (Ratan_seq x)) n) by ring. +rewrite scal_sum; apply sum_eq; intros i _; unfold tg_alt. +rewrite Ratan_seq_opp; ring. +Qed. + +Definition ps_atan_exists_1 (x : R) (Hx : -1 <= x <= 1) : + {l : R | Un_cv (fun N : nat => sum_f_R0 (tg_alt (Ratan_seq x)) N) l}. +destruct (Rle_lt_dec 0 x). + assert (pr : 0 <= x <= 1) by tauto. + exact (ps_atan_exists_01 x pr). +assert (pr : 0 <= -x <= 1) by (destruct Hx; split; fourier). +destruct (ps_atan_exists_01 _ pr) as [v Pv]. +exists (-v). + apply (Un_cv_ext (fun n => (- 1) * sum_f_R0 (tg_alt (Ratan_seq (- x))) n)). + intros n; rewrite sum_Ratan_seq_opp; ring. +replace (-v) with (-1 * v) by ring. +apply CV_mult;[ | assumption]. +solve[intros; exists 0%nat; intros; rewrite R_dist_eq; auto]. +Qed. + +Definition in_int (x : R) : {-1 <= x <= 1}+{~ -1 <= x <= 1}. +destruct (Rle_lt_dec x 1). + destruct (Rle_lt_dec (-1) x). + left;split; auto. + right;intros [a1 a2]; fourier. +right;intros [a1 a2]; fourier. +Qed. + +Definition ps_atan (x : R) : R := + match in_int x with + left h => let (v, _) := ps_atan_exists_1 x h in v + | right h => atan x + end. + +(** * Proof of the equivalence of the two definitions between -1 and 1 *) + +Lemma ps_atan0_0 : ps_atan 0 = 0. +Proof. +unfold ps_atan. + destruct (in_int 0) as [h1 | h2]. + destruct (ps_atan_exists_1 0 h1) as [v P]. + apply (UL_sequence _ _ _ P). + apply (Un_cv_ext (fun n => 0)). + symmetry;apply sum_eq_R0. + intros i _; unfold tg_alt, Ratan_seq; rewrite plus_comm; simpl. + unfold Rdiv; rewrite !Rmult_0_l, Rmult_0_r; reflexivity. + intros eps ep; exists 0%nat; intros n _; unfold R_dist. + rewrite Rminus_0_r, Rabs_pos_eq; auto with real. +case h2; split; fourier. +Qed. + +Lemma ps_atan_exists_1_opp : + forall x h h', proj1_sig (ps_atan_exists_1 (-x) h) = + -(proj1_sig (ps_atan_exists_1 x h')). +Proof. +intros x h h'; destruct (ps_atan_exists_1 (-x) h) as [v Pv]. +destruct (ps_atan_exists_1 x h') as [u Pu]; simpl. +assert (Pu' : Un_cv (fun N => (-1) * sum_f_R0 (tg_alt (Ratan_seq x)) N) (-1 * u)). + apply CV_mult;[ | assumption]. + intros eps ep; exists 0%nat; intros; rewrite R_dist_eq; assumption. +assert (Pv' : Un_cv + (fun N : nat => -1 * sum_f_R0 (tg_alt (Ratan_seq x)) N) v). + apply Un_cv_ext with (2 := Pv); intros n; rewrite sum_Ratan_seq_opp; ring. +replace (-u) with (-1 * u) by ring. +apply UL_sequence with (1:=Pv') (2:= Pu'). +Qed. + +Lemma ps_atan_opp : forall x, ps_atan (-x) = -ps_atan x. +Proof. +intros x; unfold ps_atan. +destruct (in_int (- x)) as [inside | outside]. + destruct (in_int x) as [ins' | outs']. + generalize (ps_atan_exists_1_opp x inside ins'). + intros h; exact h. + destruct inside; case outs'; split; fourier. +destruct (in_int x) as [ins' | outs']. + destruct outside; case ins'; split; fourier. +apply atan_opp. +Qed. + +(** atan = ps_atan *) + +Lemma ps_atanSeq_continuity_pt_1 : forall (N:nat) (x:R), + 0 <= x -> + x <= 1 -> + continuity_pt (fun x => sum_f_R0 (tg_alt (Ratan_seq x)) N) x. +Proof. +assert (Sublemma : forall (x:R) (N:nat), sum_f_R0 (tg_alt (Ratan_seq x)) N = x * (comp (fun x => sum_f_R0 (fun n => (fun i : nat => (-1) ^ i / INR (2 * i + 1)) n * x ^ n) N) (fun x => x ^ 2) x)). + intros x N. + induction N. + unfold tg_alt, Ratan_seq, comp ; simpl ; field. + simpl sum_f_R0 at 1. + rewrite IHN. + replace (comp (fun x => sum_f_R0 (fun n : nat => (-1) ^ n / INR (2 * n + 1) * x ^ n) (S N)) (fun x => x ^ 2)) + with (comp (fun x => sum_f_R0 (fun n : nat => (-1) ^ n / INR (2 * n + 1) * x ^ n) N + (-1) ^ (S N) / INR (2 * (S N) + 1) * x ^ (S N)) (fun x => x ^ 2)). + unfold comp. + rewrite Rmult_plus_distr_l. + apply Rplus_eq_compat_l. + unfold tg_alt, Ratan_seq. + rewrite <- Rmult_assoc. + case (Req_dec x 0) ; intro Hyp. + rewrite Hyp ; rewrite pow_i. rewrite Rmult_0_l ; rewrite Rmult_0_l. + unfold Rdiv ; rewrite Rmult_0_l ; rewrite Rmult_0_r ; reflexivity. + intuition. + replace (x * ((-1) ^ S N / INR (2 * S N + 1)) * (x ^ 2) ^ S N) with (x ^ (2 * S N + 1) * ((-1) ^ S N / INR (2 * S N + 1))). + rewrite Rmult_comm ; unfold Rdiv at 1. + rewrite Rmult_assoc ; apply Rmult_eq_compat_l. + field. apply Rgt_not_eq ; intuition. + rewrite Rmult_assoc. + replace (x * ((-1) ^ S N / INR (2 * S N + 1) * (x ^ 2) ^ S N)) with (((-1) ^ S N / INR (2 * S N + 1) * (x ^ 2) ^ S N) * x). + rewrite Rmult_assoc. + replace ((x ^ 2) ^ S N * x) with (x ^ (2 * S N + 1)). + rewrite Rmult_comm at 1 ; reflexivity. + rewrite <- pow_mult. + assert (Temp : forall x n, x ^ n * x = x ^ (n+1)). + intros a n ; induction n. rewrite pow_O. simpl ; intuition. + simpl ; rewrite Rmult_assoc ; rewrite IHn ; intuition. + rewrite Temp ; reflexivity. + rewrite Rmult_comm ; reflexivity. + intuition. +intros N x x_lb x_ub. + intros eps eps_pos. + assert (continuity_id : continuity id). + apply derivable_continuous ; exact derivable_id. +assert (Temp := continuity_mult id (comp + (fun x1 : R => + sum_f_R0 (fun n : nat => (-1) ^ n / INR (2 * n + 1) * x1 ^ n) N) + (fun x1 : R => x1 ^ 2)) + continuity_id). +assert (Temp2 : continuity + (comp + (fun x1 : R => + sum_f_R0 (fun n : nat => (-1) ^ n / INR (2 * n + 1) * x1 ^ n) N) + (fun x1 : R => x1 ^ 2))). + apply continuity_comp. + reg. + apply continuity_finite_sum. + elim (Temp Temp2 x eps eps_pos) ; clear Temp Temp2 ; intros alpha T ; destruct T as (alpha_pos, T). + exists alpha ; split. + intuition. +intros x0 x0_cond. + rewrite Sublemma ; rewrite Sublemma. +apply T. +intuition. +Qed. + +(** Definition of ps_atan's derivative *) + +Definition Datan_seq := fun (x:R) (n:nat) => x ^ (2*n). + +Lemma pow_lt_1_compat : forall x n, 0 <= x < 1 -> (0 < n)%nat -> + 0 <= x ^ n < 1. +Proof. +intros x n hx; induction 1; simpl. + rewrite Rmult_1_r; tauto. +split. + apply Rmult_le_pos; tauto. +rewrite <- (Rmult_1_r 1); apply Rmult_le_0_lt_compat; intuition. +Qed. + +Lemma Datan_seq_Rabs : forall x n, Datan_seq (Rabs x) n = Datan_seq x n. +Proof. +intros x n; unfold Datan_seq; rewrite !pow_mult, pow2_abs; reflexivity. +Qed. + +Lemma Datan_seq_pos : forall x n, 0 < x -> 0 < Datan_seq x n. +Proof. +intros x n x_lb ; unfold Datan_seq ; induction n. + simpl ; intuition. + replace (x ^ (2 * S n)) with ((x ^ 2) * (x ^ (2 * n))). + apply Rmult_gt_0_compat. + replace (x^2) with (x*x) by field ; apply Rmult_gt_0_compat ; assumption. + assumption. + replace (2 * S n)%nat with (S (S (2 * n))) by intuition. + simpl ; field. +Qed. + +Lemma Datan_sum_eq :forall x n, + sum_f_R0 (tg_alt (Datan_seq x)) n = (1 - (- x ^ 2) ^ S n)/(1 + x ^ 2). +Proof. +intros x n. +assert (dif : - x ^ 2 <> 1). +apply Rlt_not_eq; apply Rle_lt_trans with 0;[ | apply Rlt_0_1]. +assert (t := pow2_ge_0 x); fourier. +replace (1 + x ^ 2) with (1 - - (x ^ 2)) by ring; rewrite <- (tech3 _ n dif). +apply sum_eq; unfold tg_alt, Datan_seq; intros i _. +rewrite pow_mult, <- Rpow_mult_distr, Ropp_mult_distr_l_reverse, Rmult_1_l. +reflexivity. +Qed. + +Lemma Datan_seq_increasing : forall x y n, (n > 0)%nat -> 0 <= x < y -> Datan_seq x n < Datan_seq y n. +Proof. +intros x y n n_lb x_encad ; assert (x_pos : x >= 0) by intuition. + assert (y_pos : y > 0). apply Rle_lt_trans with (r2:=x) ; intuition. + induction n. + apply False_ind ; intuition. + clear -x_encad x_pos y_pos ; induction n ; unfold Datan_seq. + case x_pos ; clear x_pos ; intro x_pos. + simpl ; apply Rmult_gt_0_lt_compat ; intuition. fourier. + rewrite x_pos ; rewrite pow_i. replace (y ^ (2*1)) with (y*y). + apply Rmult_gt_0_compat ; assumption. + simpl ; field. + intuition. + assert (Hrew : forall a, a^(2 * S (S n)) = (a ^ 2) * (a ^ (2 * S n))). + clear ; intro a ; replace (2 * S (S n))%nat with (S (S (2 * S n)))%nat by intuition. + simpl ; field. + case x_pos ; clear x_pos ; intro x_pos. + rewrite Hrew ; rewrite Hrew. + apply Rmult_gt_0_lt_compat ; intuition. + apply Rmult_gt_0_lt_compat ; intuition ; fourier. + rewrite x_pos. + rewrite pow_i ; intuition. +Qed. + +Lemma Datan_seq_decreasing : forall x, -1 < x -> x < 1 -> Un_decreasing (Datan_seq x). +Proof. +intros x x_lb x_ub n. +unfold Datan_seq. +replace (2 * S n)%nat with (2 + 2 * n)%nat by ring. +rewrite <- (Rmult_1_l (x ^ (2 * n))). +rewrite pow_add. +apply Rmult_le_compat_r. +rewrite pow_mult; apply pow_le, pow2_ge_0. +apply Rlt_le; rewrite <- pow2_abs. +assert (intabs : 0 <= Rabs x < 1). + split;[apply Rabs_pos | apply Rabs_def1]; tauto. +apply (pow_lt_1_compat (Rabs x) 2) in intabs. + tauto. +omega. +Qed. + +Lemma Datan_seq_CV_0 : forall x, -1 < x -> x < 1 -> Un_cv (Datan_seq x) 0. +Proof. +intros x x_lb x_ub eps eps_pos. +assert (x_ub2 : Rabs (x^2) < 1). + rewrite Rabs_pos_eq;[ | apply pow2_ge_0]. + rewrite <- pow2_abs. + assert (H: 0 <= Rabs x < 1) + by (split;[apply Rabs_pos | apply Rabs_def1; auto]). + apply (pow_lt_1_compat _ 2) in H;[tauto | omega]. +elim (pow_lt_1_zero (x^2) x_ub2 eps eps_pos) ; intros N HN ; exists N ; intros n Hn. +unfold R_dist, Datan_seq. +replace (x ^ (2 * n) - 0) with ((x ^ 2) ^ n). apply HN ; assumption. +rewrite pow_mult ; field. +Qed. + +Lemma Datan_lim : forall x, -1 < x -> x < 1 -> + Un_cv (fun N : nat => sum_f_R0 (tg_alt (Datan_seq x)) N) (/ (1 + x ^ 2)). +Proof. +intros x x_lb x_ub eps eps_pos. +assert (Tool0 : 0 <= x ^ 2) by apply pow2_ge_0. +assert (Tool1 : 0 < (1 + x ^ 2)). + solve[apply Rplus_lt_le_0_compat ; intuition]. +assert (Tool2 : / (1 + x ^ 2) > 0). + apply Rinv_0_lt_compat ; tauto. +assert (x_ub2' : 0<= Rabs (x^2) < 1). + rewrite Rabs_pos_eq, <- pow2_abs;[ | apply pow2_ge_0]. + apply pow_lt_1_compat;[split;[apply Rabs_pos | ] | omega]. + apply Rabs_def1; assumption. +assert (x_ub2 : Rabs (x^2) < 1) by tauto. +assert (eps'_pos : ((1+x^2)*eps) > 0). + apply Rmult_gt_0_compat ; assumption. +elim (pow_lt_1_zero _ x_ub2 _ eps'_pos) ; intros N HN ; exists N. +intros n Hn. +assert (H1 : - x^2 <> 1). + apply Rlt_not_eq; apply Rle_lt_trans with (2 := Rlt_0_1). +assert (t := pow2_ge_0 x); fourier. +rewrite Datan_sum_eq. +unfold R_dist. +assert (tool : forall a b, a / b - /b = (-1 + a) /b). + intros a b; rewrite <- (Rmult_1_l (/b)); unfold Rdiv, Rminus. + rewrite <- Ropp_mult_distr_l_reverse, Rmult_plus_distr_r, Rplus_comm. + reflexivity. +set (u := 1 + x ^ 2); rewrite tool; unfold Rminus; rewrite <- Rplus_assoc. +unfold Rdiv, u. +rewrite Rplus_opp_l, Rplus_0_l, Ropp_mult_distr_l_reverse, Rabs_Ropp. +rewrite Rabs_mult; clear tool u. +assert (tool : forall k, Rabs ((-x ^ 2) ^ k) = Rabs ((x ^ 2) ^ k)). + clear -Tool0; induction k;[simpl; rewrite Rabs_R1;tauto | ]. + rewrite <- !(tech_pow_Rmult _ k), !Rabs_mult, Rabs_Ropp, IHk, Rabs_pos_eq. + reflexivity. + exact Tool0. +rewrite tool, (Rabs_pos_eq (/ _)); clear tool;[ | apply Rlt_le; assumption]. +assert (tool : forall a b c, 0 < b -> a < b * c -> a * / b < c). + intros a b c bp h; replace c with (b * c * /b). + apply Rmult_lt_compat_r. + apply Rinv_0_lt_compat; assumption. + assumption. + field; apply Rgt_not_eq; exact bp. +apply tool;[exact Tool1 | ]. +apply HN; omega. +Qed. + +Lemma Datan_CVU_prelim : forall c (r : posreal), Rabs c + r < 1 -> + CVU (fun N x => sum_f_R0 (tg_alt (Datan_seq x)) N) + (fun y : R => / (1 + y ^ 2)) c r. +Proof. +intros c r ub_ub eps eps_pos. +apply (Alt_CVU (fun x n => Datan_seq n x) + (fun x => /(1 + x ^ 2)) + (Datan_seq (Rabs c + r)) c r). + intros x inb; apply Datan_seq_decreasing; + try (apply Boule_lt in inb; apply Rabs_def2 in inb; + destruct inb; fourier). + intros x inb; apply Datan_seq_CV_0; + try (apply Boule_lt in inb; apply Rabs_def2 in inb; + destruct inb; fourier). + intros x inb; apply (Datan_lim x); + try (apply Boule_lt in inb; apply Rabs_def2 in inb; + destruct inb; fourier). + intros x [ | n] inb. + solve[unfold Datan_seq; apply Rle_refl]. + rewrite <- (Datan_seq_Rabs x); apply Rlt_le, Datan_seq_increasing. + omega. + apply Boule_lt in inb; intuition. + solve[apply Rabs_pos]. + apply Datan_seq_CV_0. + apply Rlt_trans with 0;[fourier | ]. + apply Rplus_le_lt_0_compat. + solve[apply Rabs_pos]. + destruct r; assumption. + assumption. +assumption. +Qed. + +Lemma Datan_is_datan : forall (N:nat) (x:R), + -1 <= x -> + x < 1 -> +derivable_pt_lim (fun x => sum_f_R0 (tg_alt (Ratan_seq x)) N) x (sum_f_R0 (tg_alt (Datan_seq x)) N). +Proof. +assert (Tool : forall N, (-1) ^ (S (2 * N)) = - 1). + intro n ; induction n. + simpl ; field. + replace ((-1) ^ S (2 * S n)) with ((-1) ^ 2 * (-1) ^ S (2*n)). + rewrite IHn ; field. + rewrite <- pow_add. + replace (2 + S (2 * n))%nat with (S (2 * S n))%nat. + reflexivity. + intuition. +intros N x x_lb x_ub. + induction N. + unfold Datan_seq, Ratan_seq, tg_alt ; simpl. + intros eps eps_pos. + elim (derivable_pt_lim_id x eps eps_pos) ; intros delta Hdelta ; exists delta. + intros h hneq h_b. + replace (1 * ((x + h) * 1 / 1) - 1 * (x * 1 / 1)) with (id (x + h) - id x). + rewrite Rmult_1_r. + apply Hdelta ; assumption. + unfold id ; field ; assumption. + intros eps eps_pos. + assert (eps_3_pos : (eps/3) > 0) by fourier. + elim (IHN (eps/3) eps_3_pos) ; intros delta1 Hdelta1. + assert (Main : derivable_pt_lim (fun x : R =>tg_alt (Ratan_seq x) (S N)) x ((tg_alt (Datan_seq x)) (S N))). + clear -Tool ; intros eps' eps'_pos. + elim (derivable_pt_lim_pow x (2 * (S N) + 1) eps' eps'_pos) ; intros delta Hdelta ; exists delta. + intros h h_neq h_b ; unfold tg_alt, Ratan_seq, Datan_seq. + replace (((-1) ^ S N * ((x + h) ^ (2 * S N + 1) / INR (2 * S N + 1)) - + (-1) ^ S N * (x ^ (2 * S N + 1) / INR (2 * S N + 1))) / h - + (-1) ^ S N * x ^ (2 * S N)) + with (((-1)^(S N)) * ((((x + h) ^ (2 * S N + 1) / INR (2 * S N + 1)) - + (x ^ (2 * S N + 1) / INR (2 * S N + 1))) / h - x ^ (2 * S N))). + rewrite Rabs_mult ; rewrite pow_1_abs ; rewrite Rmult_1_l. + replace (((x + h) ^ (2 * S N + 1) / INR (2 * S N + 1) - + x ^ (2 * S N + 1) / INR (2 * S N + 1)) / h - x ^ (2 * S N)) + with ((/INR (2* S N + 1)) * (((x + h) ^ (2 * S N + 1) - x ^ (2 * S N + 1)) / h - + INR (2 * S N + 1) * x ^ pred (2 * S N + 1))). + rewrite Rabs_mult. + case (Req_dec (((x + h) ^ (2 * S N + 1) - x ^ (2 * S N + 1)) / h - + INR (2 * S N + 1) * x ^ pred (2 * S N + 1)) 0) ; intro Heq. + rewrite Heq ; rewrite Rabs_R0 ; rewrite Rmult_0_r ; assumption. + apply Rlt_trans with (r2:=Rabs + (((x + h) ^ (2 * S N + 1) - x ^ (2 * S N + 1)) / h - + INR (2 * S N + 1) * x ^ pred (2 * S N + 1))). + rewrite <- Rmult_1_l ; apply Rmult_lt_compat_r. + apply Rabs_pos_lt ; assumption. + rewrite Rabs_right. + replace 1 with (/1) by field. + apply Rinv_1_lt_contravar ; intuition. + apply Rgt_ge ; replace (INR (2 * S N + 1)) with (INR (2*S N) + 1) ; + [apply RiemannInt.RinvN_pos | ]. + replace (2 * S N + 1)%nat with (S (2 * S N))%nat by intuition ; + rewrite S_INR ; reflexivity. + apply Hdelta ; assumption. + rewrite Rmult_minus_distr_l. + replace (/ INR (2 * S N + 1) * (INR (2 * S N + 1) * x ^ pred (2 * S N + 1))) with (x ^ (2 * S N)). + unfold Rminus ; rewrite Rplus_comm. + replace (((x + h) ^ (2 * S N + 1) / INR (2 * S N + 1) + + - (x ^ (2 * S N + 1) / INR (2 * S N + 1))) / h + - x ^ (2 * S N)) + with (- x ^ (2 * S N) + (((x + h) ^ (2 * S N + 1) / INR (2 * S N + 1) + + - (x ^ (2 * S N + 1) / INR (2 * S N + 1))) / h)) by intuition. + apply Rplus_eq_compat_l. field. + split ; [apply Rgt_not_eq|] ; intuition. + clear ; replace (pred (2 * S N + 1)) with (2 * S N)%nat by intuition. + field ; apply Rgt_not_eq ; intuition. + field ; split ; [apply Rgt_not_eq |] ; intuition. + elim (Main (eps/3) eps_3_pos) ; intros delta2 Hdelta2. + destruct delta1 as (delta1, delta1_pos) ; destruct delta2 as (delta2, delta2_pos). + pose (mydelta := Rmin delta1 delta2). + assert (mydelta_pos : mydelta > 0). + unfold mydelta ; rewrite Rmin_Rgt ; split ; assumption. + pose (delta := mkposreal mydelta mydelta_pos) ; exists delta ; intros h h_neq h_b. + clear Main IHN. + unfold Rminus at 1. + apply Rle_lt_trans with (r2:=eps/3 + eps / 3). + assert (Temp : (sum_f_R0 (tg_alt (Ratan_seq (x + h))) (S N) - + sum_f_R0 (tg_alt (Ratan_seq x)) (S N)) / h + + - sum_f_R0 (tg_alt (Datan_seq x)) (S N) = ((sum_f_R0 (tg_alt (Ratan_seq (x + h))) N - + sum_f_R0 (tg_alt (Ratan_seq x)) N) / h) + (- + sum_f_R0 (tg_alt (Datan_seq x)) N) + ((tg_alt (Ratan_seq (x + h)) (S N) - tg_alt (Ratan_seq x) (S N)) / + h - tg_alt (Datan_seq x) (S N))). + simpl ; field ; intuition. + apply Rle_trans with (r2:= Rabs ((sum_f_R0 (tg_alt (Ratan_seq (x + h))) N - + sum_f_R0 (tg_alt (Ratan_seq x)) N) / h + + - sum_f_R0 (tg_alt (Datan_seq x)) N) + + Rabs ((tg_alt (Ratan_seq (x + h)) (S N) - tg_alt (Ratan_seq x) (S N)) / h - + tg_alt (Datan_seq x) (S N))). + rewrite Temp ; clear Temp ; apply Rabs_triang. + apply Rplus_le_compat ; apply Rlt_le ; [apply Hdelta1 | apply Hdelta2] ; + intuition ; apply Rlt_le_trans with (r2:=delta) ; intuition unfold delta, mydelta. + apply Rmin_l. + apply Rmin_r. + fourier. +Qed. + +Lemma Ratan_CVU' : + CVU (fun N x => sum_f_R0 (tg_alt (Ratan_seq x)) N) + ps_atan (/2) (mkposreal (/2) pos_half_prf). +Proof. +apply (Alt_CVU (fun i r => Ratan_seq r i) ps_atan PI_tg (/2) pos_half); + lazy beta. + now intros; apply Ratan_seq_decreasing, Boule_half_to_interval. + now intros; apply Ratan_seq_converging, Boule_half_to_interval. + intros x b; apply Boule_half_to_interval in b. + unfold ps_atan; destruct (in_int x) as [inside | outside]; + [ | destruct b; case outside; split; fourier]. + destruct (ps_atan_exists_1 x inside) as [v Pv]. + apply Un_cv_ext with (2 := Pv);[reflexivity]. + intros x n b; apply Boule_half_to_interval in b. + rewrite <- (Rmult_1_l (PI_tg n)); unfold Ratan_seq, PI_tg. + apply Rmult_le_compat_r. + apply Rlt_le, Rinv_0_lt_compat, (lt_INR 0); omega. + rewrite <- (pow1 (2 * n + 1)); apply pow_incr; assumption. +exact PI_tg_cv. +Qed. + +Lemma Ratan_CVU : + CVU (fun N x => sum_f_R0 (tg_alt (Ratan_seq x)) N) + ps_atan 0 (mkposreal 1 Rlt_0_1). +Proof. +intros eps ep; destruct (Ratan_CVU' eps ep) as [N Pn]. +exists N; intros n x nN b_y. +case (Rtotal_order 0 x) as [xgt0 | [x0 | x0]]. + assert (Boule (/2) {| pos := / 2; cond_pos := pos_half_prf|} x). + revert b_y; unfold Boule; simpl; intros b_y; apply Rabs_def2 in b_y. + destruct b_y; unfold Boule; simpl; apply Rabs_def1; fourier. + apply Pn; assumption. + rewrite <- x0, ps_atan0_0. + rewrite <- (sum_eq (fun _ => 0)), sum_cte, Rmult_0_l, Rminus_0_r, Rabs_pos_eq. + assumption. + apply Rle_refl. + intros i _; unfold tg_alt, Ratan_seq, Rdiv; rewrite plus_comm; simpl. + solve[rewrite !Rmult_0_l, Rmult_0_r; auto]. +replace (ps_atan x - sum_f_R0 (tg_alt (Ratan_seq x)) n) with + (-(ps_atan (-x) - sum_f_R0 (tg_alt (Ratan_seq (-x))) n)). + rewrite Rabs_Ropp. + assert (Boule (/2) {| pos := / 2; cond_pos := pos_half_prf|} (-x)). + revert b_y; unfold Boule; simpl; intros b_y; apply Rabs_def2 in b_y. + destruct b_y; unfold Boule; simpl; apply Rabs_def1; fourier. + apply Pn; assumption. +unfold Rminus; rewrite ps_atan_opp, Ropp_plus_distr, sum_Ratan_seq_opp. +rewrite !Ropp_involutive; reflexivity. +Qed. + +Lemma Alt_PI_tg : forall n, PI_tg n = Ratan_seq 1 n. +Proof. +intros n; unfold PI_tg, Ratan_seq, Rdiv; rewrite pow1, Rmult_1_l. +reflexivity. +Qed. + +Lemma Ratan_is_ps_atan : forall eps, eps > 0 -> + exists N, forall n, (n >= N)%nat -> forall x, -1 < x -> x < 1 -> + Rabs (sum_f_R0 (tg_alt (Ratan_seq x)) n - ps_atan x) < eps. +Proof. +intros eps ep. +destruct (Ratan_CVU _ ep) as [N1 PN1]. +exists N1; intros n nN x xm1 x1; rewrite <- Rabs_Ropp, Ropp_minus_distr. +apply PN1; [assumption | ]. +unfold Boule; simpl; rewrite Rminus_0_r; apply Rabs_def1; assumption. +Qed. + +Lemma Datan_continuity : continuity (fun x => /(1+x ^ 2)). +Proof. +apply continuity_inv. +apply continuity_plus. +apply continuity_const ; unfold constant ; intuition. +apply derivable_continuous ; apply derivable_pow. +intro x ; apply Rgt_not_eq ; apply Rge_gt_trans with (1+0) ; [|fourier] ; + apply Rplus_ge_compat_l. + replace (x^2) with (x²). + apply Rle_ge ; apply Rle_0_sqr. + unfold Rsqr ; field. +Qed. + +Lemma derivable_pt_lim_ps_atan : forall x, -1 < x < 1 -> + derivable_pt_lim ps_atan x ((fun y => /(1 + y ^ 2)) x). +Proof. +intros x x_encad. +destruct (boule_in_interval (-1) 1 x x_encad) as [c [r [Pcr1 [P1 P2]]]]. +change (/ (1 + x ^ 2)) with ((fun u => /(1 + u ^ 2)) x). +assert (t := derivable_pt_lim_CVU). +apply derivable_pt_lim_CVU with + (fn := (fun N x => sum_f_R0 (tg_alt (Ratan_seq x)) N)) + (fn' := (fun N x => sum_f_R0 (tg_alt (Datan_seq x)) N)) + (c := c) (r := r). + assumption. + intros y N inb; apply Rabs_def2 in inb; destruct inb. + apply Datan_is_datan. + fourier. + fourier. + intros y inb; apply Rabs_def2 in inb; destruct inb. + assert (y_gt_0 : -1 < y) by fourier. + assert (y_lt_1 : y < 1) by fourier. + intros eps eps_pos ; elim (Ratan_is_ps_atan eps eps_pos). + intros N HN ; exists N; intros n n_lb ; apply HN ; tauto. + apply Datan_CVU_prelim. + replace ((c - r + (c + r)) / 2) with c by field. + unfold mkposreal_lb_ub; simpl. + replace ((c + r - (c - r)) / 2) with (r :R) by field. + assert (Rabs c < 1 - r). + unfold Boule in Pcr1; destruct r; simpl in *; apply Rabs_def1; + apply Rabs_def2 in Pcr1; destruct Pcr1; fourier. + fourier. +intros; apply Datan_continuity. +Qed. + +Lemma derivable_pt_ps_atan : + forall x, -1 < x < 1 -> derivable_pt ps_atan x. +Proof. +intros x x_encad. +exists (/(1+x^2)) ; apply derivable_pt_lim_ps_atan; assumption. +Qed. + +Lemma ps_atan_continuity_pt_1 : forall eps : R, + eps > 0 -> + exists alp : R, + alp > 0 /\ + (forall x, x < 1 -> 0 < x -> R_dist x 1 < alp -> + dist R_met (ps_atan x) (Alt_PI/4) < eps). +Proof. +intros eps eps_pos. +assert (eps_3_pos : eps / 3 > 0) by fourier. +elim (Ratan_is_ps_atan (eps / 3) eps_3_pos) ; intros N1 HN1. +unfold Alt_PI. +destruct exist_PI as [v Pv]; replace ((4 * v)/4) with v by field. +assert (Pv' : Un_cv (sum_f_R0 (tg_alt (Ratan_seq 1))) v). + apply Un_cv_ext with (2:= Pv). + intros; apply sum_eq; intros; unfold tg_alt; rewrite Alt_PI_tg; tauto. +destruct (Pv' (eps / 3) eps_3_pos) as [N2 HN2]. +set (N := (N1 + N2)%nat). +assert (O_lb : 0 <= 1) by intuition ; assert (O_ub : 1 <= 1) by intuition ; + elim (ps_atanSeq_continuity_pt_1 N 1 O_lb O_ub (eps / 3) eps_3_pos) ; intros alpha Halpha ; + clear -HN1 HN2 Halpha eps_3_pos; destruct Halpha as (alpha_pos, Halpha). +exists alpha ; split;[assumption | ]. +intros x x_ub x_lb x_bounds. +simpl ; unfold R_dist. +replace (ps_atan x - v) with ((ps_atan x - sum_f_R0 (tg_alt (Ratan_seq x)) N) + + (sum_f_R0 (tg_alt (Ratan_seq x)) N - sum_f_R0 (tg_alt (Ratan_seq 1)) N) + + (sum_f_R0 (tg_alt (Ratan_seq 1)) N - v)). +apply Rle_lt_trans with (r2:=Rabs (ps_atan x - sum_f_R0 (tg_alt (Ratan_seq x)) N) + + Rabs ((sum_f_R0 (tg_alt (Ratan_seq x)) N - sum_f_R0 (tg_alt (Ratan_seq 1)) N) + + (sum_f_R0 (tg_alt (Ratan_seq 1)) N - v))). +rewrite Rplus_assoc ; apply Rabs_triang. + replace eps with (2 / 3 * eps + eps / 3). + rewrite Rplus_comm. + apply Rplus_lt_compat. + apply Rle_lt_trans with (r2 := Rabs (sum_f_R0 (tg_alt (Ratan_seq x)) N - sum_f_R0 (tg_alt (Ratan_seq 1)) N) + + Rabs (sum_f_R0 (tg_alt (Ratan_seq 1)) N - v)). + apply Rabs_triang. + apply Rlt_le_trans with (r2:= eps / 3 + eps / 3). + apply Rplus_lt_compat. + simpl in Halpha ; unfold R_dist in Halpha. + apply Halpha ; split. + unfold D_x, no_cond ; split ; [ | apply Rgt_not_eq ] ; intuition. + intuition. + apply HN2; unfold N; omega. + fourier. + rewrite <- Rabs_Ropp, Ropp_minus_distr; apply HN1. + unfold N; omega. + fourier. + assumption. + field. +ring. +Qed. + +Lemma Datan_eq_DatanSeq_interv : forall x, -1 < x < 1 -> + forall (Pratan:derivable_pt ps_atan x) (Prmymeta:derivable_pt atan x), + derive_pt ps_atan x Pratan = derive_pt atan x Prmymeta. +Proof. +assert (freq : 0 < tan 1) by apply (Rlt_trans _ _ _ Rlt_0_1 tan_1_gt_1). +intros x x_encad Pratan Prmymeta. + rewrite pr_nu_var2_interv with (g:=ps_atan) (lb:=-1) (ub:=tan 1) + (pr2 := derivable_pt_ps_atan x x_encad). + rewrite pr_nu_var2_interv with (f:=atan) (g:=atan) (lb:=-1) (ub:= 1) (pr2:=derivable_pt_atan x). + assert (Temp := derivable_pt_lim_ps_atan x x_encad). + assert (Hrew1 : derive_pt ps_atan x (derivable_pt_ps_atan x x_encad) = (/(1+x^2))). + apply derive_pt_eq_0 ; assumption. + rewrite derive_pt_atan. + rewrite Hrew1. + replace (Rsqr x) with (x ^ 2) by (unfold Rsqr; ring). + unfold Rdiv; rewrite Rmult_1_l; reflexivity. + fourier. + assumption. + intros; reflexivity. + fourier. + assert (t := tan_1_gt_1); split;destruct x_encad; fourier. +intros; reflexivity. +Qed. + +Lemma atan_eq_ps_atan : + forall x, 0 < x < 1 -> atan x = ps_atan x. +Proof. +intros x x_encad. +assert (pr1 : forall c : R, 0 < c < x -> derivable_pt (atan - ps_atan) c). + intros c c_encad. + apply derivable_pt_minus. + exact (derivable_pt_atan c). + apply derivable_pt_ps_atan. + destruct x_encad; destruct c_encad; split; fourier. +assert (pr2 : forall c : R, 0 < c < x -> derivable_pt id c). + intros ; apply derivable_pt_id; fourier. +assert (delta_cont : forall c : R, 0 <= c <= x -> continuity_pt (atan - ps_atan) c). + intros c [[c_encad1 | c_encad1 ] [c_encad2 | c_encad2]]; + apply continuity_pt_minus. + apply derivable_continuous_pt ; apply derivable_pt_atan. + apply derivable_continuous_pt ; apply derivable_pt_ps_atan. + split; destruct x_encad; fourier. + apply derivable_continuous_pt, derivable_pt_atan. + apply derivable_continuous_pt, derivable_pt_ps_atan. + subst c; destruct x_encad; split; fourier. + apply derivable_continuous_pt, derivable_pt_atan. + apply derivable_continuous_pt, derivable_pt_ps_atan. + subst c; split; fourier. + apply derivable_continuous_pt, derivable_pt_atan. + apply derivable_continuous_pt, derivable_pt_ps_atan. + subst c; destruct x_encad; split; fourier. +assert (id_cont : forall c : R, 0 <= c <= x -> continuity_pt id c). + intros ; apply derivable_continuous ; apply derivable_id. +assert (x_lb : 0 < x) by (destruct x_encad; fourier). +elim (MVT (atan - ps_atan)%F id 0 x pr1 pr2 x_lb delta_cont id_cont) ; intros d Temp ; elim Temp ; intros d_encad Main. +clear - Main x_encad. +assert (Temp : forall (pr: derivable_pt (atan - ps_atan) d), derive_pt (atan - ps_atan) d pr = 0). + intro pr. + assert (d_encad3 : -1 < d < 1). + destruct d_encad; destruct x_encad; split; fourier. + pose (pr3 := derivable_pt_minus atan ps_atan d (derivable_pt_atan d) (derivable_pt_ps_atan d d_encad3)). + rewrite <- pr_nu_var2_interv with (f:=(atan - ps_atan)%F) (g:=(atan - ps_atan)%F) (lb:=0) (ub:=x) (pr1:=pr3) (pr2:=pr). + unfold pr3. rewrite derive_pt_minus. + rewrite Datan_eq_DatanSeq_interv with (Prmymeta := derivable_pt_atan d). + intuition. + assumption. + destruct d_encad; fourier. + assumption. + reflexivity. +assert (iatan0 : atan 0 = 0). + apply tan_is_inj. + apply atan_bound. + rewrite Ropp_div; assert (t := PI2_RGT_0); split; fourier. + rewrite tan_0, atan_right_inv; reflexivity. +generalize Main; rewrite Temp, Rmult_0_r. +replace ((atan - ps_atan)%F x) with (atan x - ps_atan x) by intuition. +replace ((atan - ps_atan)%F 0) with (atan 0 - ps_atan 0) by intuition. +rewrite iatan0, ps_atan0_0, !Rminus_0_r. +replace (derive_pt id d (pr2 d d_encad)) with 1. + rewrite Rmult_1_r. + solve[intros M; apply Rminus_diag_uniq; auto]. +rewrite pr_nu_var with (g:=id) (pr2:=derivable_pt_id d). + symmetry ; apply derive_pt_id. +tauto. +Qed. + + +Theorem Alt_PI_eq : Alt_PI = PI. +apply Rmult_eq_reg_r with (/4); fold (Alt_PI/4); fold (PI/4); + [ | apply Rgt_not_eq; fourier]. +assert (0 < PI/6) by (apply PI6_RGT_0). +assert (t1:= PI2_1). +assert (t2 := PI_4). +assert (m := Alt_PI_RGT_0). +assert (-PI/2 < 1 < PI/2) by (rewrite Ropp_div; split; fourier). +apply cond_eq; intros eps ep. +change (R_dist (Alt_PI/4) (PI/4) < eps). +assert (ca : continuity_pt atan 1). + apply derivable_continuous_pt, derivable_pt_atan. +assert (Xe : exists eps', exists eps'', + eps' + eps'' <= eps /\ 0 < eps' /\ 0 < eps''). + exists (eps/2); exists (eps/2); repeat apply conj; fourier. +destruct Xe as [eps' [eps'' [eps_ineq [ep' ep'']]]]. +destruct (ps_atan_continuity_pt_1 _ ep') as [alpha [a0 Palpha]]. +destruct (ca _ ep'') as [beta [b0 Pbeta]]. +assert (Xa : exists a, 0 < a < 1 /\ R_dist a 1 < alpha /\ + R_dist a 1 < beta). + exists (Rmax (/2) (Rmax (1 - alpha /2) (1 - beta /2))). + assert (/2 <= Rmax (/2) (Rmax (1 - alpha /2) (1 - beta /2))) by apply Rmax_l. + assert (Rmax (1 - alpha /2) (1 - beta /2) <= + Rmax (/2) (Rmax (1 - alpha /2) (1 - beta /2))) by apply Rmax_r. + assert ((1 - alpha /2) <= Rmax (1 - alpha /2) (1 - beta /2)) by apply Rmax_l. + assert ((1 - beta /2) <= Rmax (1 - alpha /2) (1 - beta /2)) by apply Rmax_r. + assert (Rmax (1 - alpha /2) (1 - beta /2) < 1) + by (apply Rmax_lub_lt; fourier). + split;[split;[ | apply Rmax_lub_lt]; fourier | ]. + assert (0 <= 1 - Rmax (/ 2) (Rmax (1 - alpha / 2) (1 - beta / 2))). + assert (Rmax (/2) (Rmax (1 - alpha / 2) + (1 - beta /2)) <= 1) by (apply Rmax_lub; fourier). + fourier. + split; unfold R_dist; rewrite <-Rabs_Ropp, Ropp_minus_distr, + Rabs_pos_eq;fourier. +destruct Xa as [a [[Pa0 Pa1] [P1 P2]]]. +apply Rle_lt_trans with (1 := R_dist_tri _ _ (ps_atan a)). +apply Rlt_le_trans with (2 := eps_ineq). +apply Rplus_lt_compat. +rewrite R_dist_sym; apply Palpha; assumption. +rewrite <- atan_eq_ps_atan. + rewrite <- atan_1; apply (Pbeta a); auto. + split; [ | exact P2]. +split;[exact I | apply Rgt_not_eq; assumption]. +split; assumption. +Qed. + +Lemma PI_ineq : + forall N : nat, + sum_f_R0 (tg_alt PI_tg) (S (2 * N)) <= PI / 4 <= + sum_f_R0 (tg_alt PI_tg) (2 * N). +Proof. +intros; rewrite <- Alt_PI_eq; apply Alt_PI_ineq. +Qed. + diff --git a/theories/Reals/Raxioms.v b/theories/Reals/Raxioms.v index 8f01d7d0..200019a8 100644 --- a/theories/Reals/Raxioms.v +++ b/theories/Reals/Raxioms.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -12,7 +12,7 @@ Require Export ZArith_base. Require Export Rdefinitions. -Open Local Scope R_scope. +Local Open Scope R_scope. (*********************************************************) (** * Field axioms *) @@ -122,8 +122,8 @@ Arguments INR n%nat. Definition IZR (z:Z) : R := match z with | Z0 => 0 - | Zpos n => INR (nat_of_P n) - | Zneg n => - INR (nat_of_P n) + | Zpos n => INR (Pos.to_nat n) + | Zneg n => - INR (Pos.to_nat n) end. Arguments IZR z%Z. diff --git a/theories/Reals/Rbase.v b/theories/Reals/Rbase.v index dbf9ad71..29715ed9 100644 --- a/theories/Reals/Rbase.v +++ b/theories/Reals/Rbase.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) diff --git a/theories/Reals/Rbasic_fun.v b/theories/Reals/Rbasic_fun.v index 4bc7fd10..560f389b 100644 --- a/theories/Reals/Rbasic_fun.v +++ b/theories/Reals/Rbasic_fun.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -45,10 +45,10 @@ Qed. (*********) Lemma Rmin_Rgt_l : forall r1 r2 r, Rmin r1 r2 > r -> r1 > r /\ r2 > r. Proof. - intros r1 r2 r; unfold Rmin in |- *; case (Rle_dec r1 r2); intros. + intros r1 r2 r; unfold Rmin; case (Rle_dec r1 r2); intros. split. assumption. - unfold Rgt in |- *; unfold Rgt in H; exact (Rlt_le_trans r r1 r2 H r0). + unfold Rgt; unfold Rgt in H; exact (Rlt_le_trans r r1 r2 H r0). split. generalize (Rnot_le_lt r1 r2 n); intro; exact (Rgt_trans r1 r2 r H0 H). assumption. @@ -57,7 +57,7 @@ Qed. (*********) Lemma Rmin_Rgt_r : forall r1 r2 r, r1 > r /\ r2 > r -> Rmin r1 r2 > r. Proof. - intros; unfold Rmin in |- *; case (Rle_dec r1 r2); elim H; clear H; intros; + intros; unfold Rmin; case (Rle_dec r1 r2); elim H; clear H; intros; assumption. Qed. @@ -72,14 +72,14 @@ Qed. (*********) Lemma Rmin_l : forall x y:R, Rmin x y <= x. Proof. - intros; unfold Rmin in |- *; case (Rle_dec x y); intro H1; + intros; unfold Rmin; case (Rle_dec x y); intro H1; [ right; reflexivity | auto with real ]. Qed. (*********) Lemma Rmin_r : forall x y:R, Rmin x y <= y. Proof. - intros; unfold Rmin in |- *; case (Rle_dec x y); intro H1; + intros; unfold Rmin; case (Rle_dec x y); intro H1; [ assumption | auto with real ]. Qed. @@ -123,20 +123,20 @@ Qed. (*********) Lemma Rmin_pos : forall x y:R, 0 < x -> 0 < y -> 0 < Rmin x y. Proof. - intros; unfold Rmin in |- *. + intros; unfold Rmin. case (Rle_dec x y); intro; assumption. Qed. (*********) Lemma Rmin_glb : forall x y z:R, z <= x -> z <= y -> z <= Rmin x y. Proof. - intros; unfold Rmin in |- *; case (Rle_dec x y); intro; assumption. + intros; unfold Rmin; case (Rle_dec x y); intro; assumption. Qed. (*********) Lemma Rmin_glb_lt : forall x y z:R, z < x -> z < y -> z < Rmin x y. Proof. - intros; unfold Rmin in |- *; case (Rle_dec x y); intro; assumption. + intros; unfold Rmin; case (Rle_dec x y); intro; assumption. Qed. (*******************************) @@ -167,8 +167,8 @@ Qed. Lemma Rmax_Rle : forall r1 r2 r, r <= Rmax r1 r2 <-> r <= r1 \/ r <= r2. Proof. intros; split. - unfold Rmax in |- *; case (Rle_dec r1 r2); intros; auto. - intro; unfold Rmax in |- *; case (Rle_dec r1 r2); elim H; clear H; intros; + unfold Rmax; case (Rle_dec r1 r2); intros; auto. + intro; unfold Rmax; case (Rle_dec r1 r2); elim H; clear H; intros; auto. apply (Rle_trans r r1 r2); auto. generalize (Rnot_le_lt r1 r2 n); clear n; intro; unfold Rgt in H0; @@ -177,7 +177,7 @@ Qed. Lemma Rmax_comm : forall x y:R, Rmax x y = Rmax y x. Proof. - intros p q; unfold Rmax in |- *; case (Rle_dec p q); case (Rle_dec q p); auto; + intros p q; unfold Rmax; case (Rle_dec p q); case (Rle_dec q p); auto; intros H1 H2; apply Rle_antisym; auto with real. Qed. @@ -188,14 +188,14 @@ Notation RmaxSym := Rmax_comm (only parsing). (*********) Lemma Rmax_l : forall x y:R, x <= Rmax x y. Proof. - intros; unfold Rmax in |- *; case (Rle_dec x y); intro H1; + intros; unfold Rmax; case (Rle_dec x y); intro H1; [ assumption | auto with real ]. Qed. (*********) Lemma Rmax_r : forall x y:R, y <= Rmax x y. Proof. - intros; unfold Rmax in |- *; case (Rle_dec x y); intro H1; + intros; unfold Rmax; case (Rle_dec x y); intro H1; [ right; reflexivity | auto with real ]. Qed. @@ -232,7 +232,7 @@ Qed. Lemma RmaxRmult : forall (p q:R) r, 0 <= r -> Rmax (r * p) (r * q) = r * Rmax p q. Proof. - intros p q r H; unfold Rmax in |- *. + intros p q r H; unfold Rmax. case (Rle_dec p q); case (Rle_dec (r * p) (r * q)); auto; intros H1 H2; auto. case H; intros E1. case H1; auto with real. @@ -246,7 +246,7 @@ Qed. (*********) Lemma Rmax_stable_in_negreal : forall x y:negreal, Rmax x y < 0. Proof. - intros; unfold Rmax in |- *; case (Rle_dec x y); intro; + intros; unfold Rmax; case (Rle_dec x y); intro; [ apply (cond_neg y) | apply (cond_neg x) ]. Qed. @@ -265,7 +265,7 @@ Qed. (*********) Lemma Rmax_neg : forall x y:R, x < 0 -> y < 0 -> Rmax x y < 0. Proof. - intros; unfold Rmax in |- *. + intros; unfold Rmax. case (Rle_dec x y); intro; assumption. Qed. @@ -278,7 +278,7 @@ Lemma Rcase_abs : forall r, {r < 0} + {r >= 0}. Proof. intro; generalize (Rle_dec 0 r); intro X; elim X; intro; clear X. right; apply (Rle_ge 0 r a). - left; fold (0 > r) in |- *; apply (Rnot_le_lt 0 r b). + left; fold (0 > r); apply (Rnot_le_lt 0 r b). Qed. (*********) @@ -291,27 +291,27 @@ Definition Rabs r : R := (*********) Lemma Rabs_R0 : Rabs 0 = 0. Proof. - unfold Rabs in |- *; case (Rcase_abs 0); auto; intro. + unfold Rabs; case (Rcase_abs 0); auto; intro. generalize (Rlt_irrefl 0); intro; exfalso; auto. Qed. Lemma Rabs_R1 : Rabs 1 = 1. Proof. -unfold Rabs in |- *; case (Rcase_abs 1); auto with real. +unfold Rabs; case (Rcase_abs 1); auto with real. intros H; absurd (1 < 0); auto with real. Qed. (*********) Lemma Rabs_no_R0 : forall r, r <> 0 -> Rabs r <> 0. Proof. - intros; unfold Rabs in |- *; case (Rcase_abs r); intro; auto. + intros; unfold Rabs; case (Rcase_abs r); intro; auto. apply Ropp_neq_0_compat; auto. Qed. (*********) Lemma Rabs_left : forall r, r < 0 -> Rabs r = - r. Proof. - intros; unfold Rabs in |- *; case (Rcase_abs r); trivial; intro; + intros; unfold Rabs; case (Rcase_abs r); trivial; intro; absurd (r >= 0). exact (Rlt_not_ge r 0 H). assumption. @@ -320,7 +320,7 @@ Qed. (*********) Lemma Rabs_right : forall r, r >= 0 -> Rabs r = r. Proof. - intros; unfold Rabs in |- *; case (Rcase_abs r); intro. + intros; unfold Rabs; case (Rcase_abs r); intro. absurd (r >= 0). exact (Rlt_not_ge r 0 r0). assumption. @@ -331,21 +331,21 @@ Lemma Rabs_left1 : forall a:R, a <= 0 -> Rabs a = - a. Proof. intros a H; case H; intros H1. apply Rabs_left; auto. - rewrite H1; simpl in |- *; rewrite Rabs_right; auto with real. + rewrite H1; simpl; rewrite Rabs_right; auto with real. Qed. (*********) Lemma Rabs_pos : forall x:R, 0 <= Rabs x. Proof. - intros; unfold Rabs in |- *; case (Rcase_abs x); intro. + intros; unfold Rabs; case (Rcase_abs x); intro. generalize (Ropp_lt_gt_contravar x 0 r); intro; unfold Rgt in H; - rewrite Ropp_0 in H; unfold Rle in |- *; left; assumption. + rewrite Ropp_0 in H; unfold Rle; left; assumption. apply Rge_le; assumption. Qed. Lemma Rle_abs : forall x:R, x <= Rabs x. Proof. - intro; unfold Rabs in |- *; case (Rcase_abs x); intros; fourier. + intro; unfold Rabs; case (Rcase_abs x); intros; fourier. Qed. Definition RRle_abs := Rle_abs. @@ -353,7 +353,7 @@ Definition RRle_abs := Rle_abs. (*********) Lemma Rabs_pos_eq : forall x:R, 0 <= x -> Rabs x = x. Proof. - intros; unfold Rabs in |- *; case (Rcase_abs x); intro; + intros; unfold Rabs; case (Rcase_abs x); intro; [ generalize (Rgt_not_le 0 x r); intro; exfalso; auto | trivial ]. Qed. @@ -368,7 +368,7 @@ Lemma Rabs_pos_lt : forall x:R, x <> 0 -> 0 < Rabs x. Proof. intros; generalize (Rabs_pos x); intro; unfold Rle in H0; elim H0; intro; auto. - exfalso; clear H0; elim H; clear H; generalize H1; unfold Rabs in |- *; + exfalso; clear H0; elim H; clear H; generalize H1; unfold Rabs; case (Rcase_abs x); intros; auto. clear r H1; generalize (Rplus_eq_compat_l x 0 (- x) H0); rewrite (let (H1, H2) := Rplus_ne x in H1); rewrite (Rplus_opp_r x); @@ -378,7 +378,7 @@ Qed. (*********) Lemma Rabs_minus_sym : forall x y:R, Rabs (x - y) = Rabs (y - x). Proof. - intros; unfold Rabs in |- *; case (Rcase_abs (x - y)); + intros; unfold Rabs; case (Rcase_abs (x - y)); case (Rcase_abs (y - x)); intros. generalize (Rminus_lt y x r); generalize (Rminus_lt x y r0); intros; generalize (Rlt_asym x y H); intro; exfalso; @@ -397,7 +397,7 @@ Qed. (*********) Lemma Rabs_mult : forall x y:R, Rabs (x * y) = Rabs x * Rabs y. Proof. - intros; unfold Rabs in |- *; case (Rcase_abs (x * y)); case (Rcase_abs x); + intros; unfold Rabs; case (Rcase_abs (x * y)); case (Rcase_abs x); case (Rcase_abs y); intros; auto. generalize (Rmult_lt_gt_compat_neg_l y x 0 r r0); intro; rewrite (Rmult_0_r y) in H; generalize (Rlt_asym (x * y) 0 r1); @@ -448,7 +448,7 @@ Qed. (*********) Lemma Rabs_Rinv : forall r, r <> 0 -> Rabs (/ r) = / Rabs r. Proof. - intro; unfold Rabs in |- *; case (Rcase_abs r); case (Rcase_abs (/ r)); auto; + intro; unfold Rabs; case (Rcase_abs r); case (Rcase_abs (/ r)); auto; intros. apply Ropp_inv_permute; auto. generalize (Rinv_lt_0_compat r r1); intro; unfold Rge in r0; elim r0; intros. @@ -470,7 +470,7 @@ Proof. cut (Rabs (-1) = 1). intros; rewrite H0. ring. - unfold Rabs in |- *; case (Rcase_abs (-1)). + unfold Rabs; case (Rcase_abs (-1)). intro; ring. intro H0; generalize (Rge_le (-1) 0 H0); intros. generalize (Ropp_le_ge_contravar 0 (-1) H1). @@ -483,13 +483,13 @@ Qed. (*********) Lemma Rabs_triang : forall a b:R, Rabs (a + b) <= Rabs a + Rabs b. Proof. - intros a b; unfold Rabs in |- *; case (Rcase_abs (a + b)); case (Rcase_abs a); + intros a b; unfold Rabs; case (Rcase_abs (a + b)); case (Rcase_abs a); case (Rcase_abs b); intros. apply (Req_le (- (a + b)) (- a + - b)); rewrite (Ropp_plus_distr a b); reflexivity. (**) rewrite (Ropp_plus_distr a b); apply (Rplus_le_compat_l (- a) (- b) b); - unfold Rle in |- *; unfold Rge in r; elim r; intro. + unfold Rle; unfold Rge in r; elim r; intro. left; unfold Rgt in H; generalize (Rplus_lt_compat_l (- b) 0 b H); intro; elim (Rplus_ne (- b)); intros v w; rewrite v in H0; clear v w; rewrite (Rplus_opp_l b) in H0; apply (Rlt_trans (- b) 0 b H0 H). @@ -497,7 +497,7 @@ Proof. (**) rewrite (Ropp_plus_distr a b); rewrite (Rplus_comm (- a) (- b)); rewrite (Rplus_comm a (- b)); apply (Rplus_le_compat_l (- b) (- a) a); - unfold Rle in |- *; unfold Rge in r0; elim r0; intro. + unfold Rle; unfold Rge in r0; elim r0; intro. left; unfold Rgt in H; generalize (Rplus_lt_compat_l (- a) 0 a H); intro; elim (Rplus_ne (- a)); intros v w; rewrite v in H0; clear v w; rewrite (Rplus_opp_l a) in H0; apply (Rlt_trans (- a) 0 a H0 H). @@ -521,27 +521,27 @@ Proof. (**) rewrite (Rplus_comm a b); rewrite (Rplus_comm (- a) b); apply (Rplus_le_compat_l b a (- a)); apply (Rminus_le a (- a)); - unfold Rminus in |- *; rewrite (Ropp_involutive a); + unfold Rminus; rewrite (Ropp_involutive a); generalize (Rplus_lt_compat_l a a 0 r0); clear r r1; intro; elim (Rplus_ne a); intros v w; rewrite v in H; clear v w; generalize (Rlt_trans (a + a) a 0 H r0); intro; apply (Rlt_le (a + a) 0 H0). (**) apply (Rplus_le_compat_l a b (- b)); apply (Rminus_le b (- b)); - unfold Rminus in |- *; rewrite (Ropp_involutive b); + unfold Rminus; rewrite (Ropp_involutive b); generalize (Rplus_lt_compat_l b b 0 r); clear r0 r1; intro; elim (Rplus_ne b); intros v w; rewrite v in H; clear v w; generalize (Rlt_trans (b + b) b 0 H r); intro; apply (Rlt_le (b + b) 0 H0). (**) - unfold Rle in |- *; right; reflexivity. + unfold Rle; right; reflexivity. Qed. (*********) Lemma Rabs_triang_inv : forall a b:R, Rabs a - Rabs b <= Rabs (a - b). Proof. intros; apply (Rplus_le_reg_l (Rabs b) (Rabs a - Rabs b) (Rabs (a - b))); - unfold Rminus in |- *; rewrite <- (Rplus_assoc (Rabs b) (Rabs a) (- Rabs b)); + unfold Rminus; rewrite <- (Rplus_assoc (Rabs b) (Rabs a) (- Rabs b)); rewrite (Rplus_comm (Rabs b) (Rabs a)); rewrite (Rplus_assoc (Rabs a) (Rabs b) (- Rabs b)); rewrite (Rplus_opp_r (Rabs b)); rewrite (proj1 (Rplus_ne (Rabs a))); @@ -561,7 +561,7 @@ Proof. rewrite <- (Rabs_Ropp (Rabs a - Rabs b)); rewrite <- (Rabs_Ropp (a - b)); do 2 rewrite Ropp_minus_distr. apply H; left; assumption. - rewrite Heq; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + rewrite Heq; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply Rabs_pos. apply H; left; assumption. intros; replace (Rabs (Rabs a - Rabs b)) with (Rabs a - Rabs b). @@ -576,8 +576,8 @@ Qed. (*********) Lemma Rabs_def1 : forall x a:R, x < a -> - a < x -> Rabs x < a. Proof. - unfold Rabs in |- *; intros; case (Rcase_abs x); intro. - generalize (Ropp_lt_gt_contravar (- a) x H0); unfold Rgt in |- *; + unfold Rabs; intros; case (Rcase_abs x); intro. + generalize (Ropp_lt_gt_contravar (- a) x H0); unfold Rgt; rewrite Ropp_involutive; intro; assumption. assumption. Qed. @@ -585,15 +585,15 @@ Qed. (*********) Lemma Rabs_def2 : forall x a:R, Rabs x < a -> x < a /\ - a < x. Proof. - unfold Rabs in |- *; intro x; case (Rcase_abs x); intros. - generalize (Ropp_gt_lt_0_contravar x r); unfold Rgt in |- *; intro; + unfold Rabs; intro x; case (Rcase_abs x); intros. + generalize (Ropp_gt_lt_0_contravar x r); unfold Rgt; intro; generalize (Rlt_trans 0 (- x) a H0 H); intro; split. apply (Rlt_trans x 0 a r H1). generalize (Ropp_lt_gt_contravar (- x) a H); rewrite (Ropp_involutive x); - unfold Rgt in |- *; trivial. + unfold Rgt; trivial. fold (a > x) in H; generalize (Rgt_ge_trans a x 0 H r); intro; - generalize (Ropp_lt_gt_0_contravar a H0); intro; fold (0 > - a) in |- *; - generalize (Rge_gt_trans x 0 (- a) r H1); unfold Rgt in |- *; + generalize (Ropp_lt_gt_0_contravar a H0); intro; fold (0 > - a); + generalize (Rge_gt_trans x 0 (- a) r H1); unfold Rgt; intro; split; assumption. Qed. @@ -623,16 +623,16 @@ Proof. apply RmaxLess1; auto. Qed. -Lemma Rabs_Zabs : forall z:Z, Rabs (IZR z) = IZR (Zabs z). +Lemma Rabs_Zabs : forall z:Z, Rabs (IZR z) = IZR (Z.abs z). Proof. - intros z; case z; simpl in |- *; auto with real. + intros z; case z; simpl; auto with real. apply Rabs_right; auto with real. intros p0; apply Rabs_right; auto with real zarith. intros p0; rewrite Rabs_Ropp. apply Rabs_right; auto with real zarith. Qed. -Lemma abs_IZR : forall z, IZR (Zabs z) = Rabs (IZR z). +Lemma abs_IZR : forall z, IZR (Z.abs z) = Rabs (IZR z). Proof. intros. now rewrite Rabs_Zabs. diff --git a/theories/Reals/Rcomplete.v b/theories/Reals/Rcomplete.v index 77cb560c..8e0e0692 100644 --- a/theories/Reals/Rcomplete.v +++ b/theories/Reals/Rcomplete.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -11,7 +11,7 @@ Require Import Rfunctions. Require Import Rseries. Require Import SeqProp. Require Import Max. -Open Local Scope R_scope. +Local Open Scope R_scope. (****************************************************) (* R is complete : *) @@ -37,7 +37,7 @@ Proof. intros. exists x. rewrite <- H2 in p0. - unfold Un_cv in |- *. + unfold Un_cv. intros. unfold Un_cv in p; unfold Un_cv in p0. cut (0 < eps / 3). @@ -46,7 +46,7 @@ Proof. elim (p0 (eps / 3) H4); intros. exists (max x1 x2). intros. - unfold R_dist in |- *. + unfold R_dist. apply Rle_lt_trans with (Rabs (Un n - Vn n) + Rabs (Vn n - x)). replace (Un n - x) with (Un n - Vn n + (Vn n - x)); [ apply Rabs_triang | ring ]. @@ -54,14 +54,14 @@ Proof. do 2 rewrite <- (Rplus_comm (Rabs (Vn n - x))). apply Rplus_le_compat_l. repeat rewrite Rabs_right. - unfold Rminus in |- *; do 2 rewrite <- (Rplus_comm (- Vn n)); + unfold Rminus; do 2 rewrite <- (Rplus_comm (- Vn n)); apply Rplus_le_compat_l. assert (H8 := Vn_Un_Wn_order Un (cauchy_maj Un H) (cauchy_min Un H)). fold Vn Wn in H8. elim (H8 n); intros. assumption. apply Rle_ge. - unfold Rminus in |- *; apply Rplus_le_reg_l with (Vn n). + unfold Rminus; apply Rplus_le_reg_l with (Vn n). rewrite Rplus_0_r. replace (Vn n + (Wn n + - Vn n)) with (Wn n); [ idtac | ring ]. assert (H8 := Vn_Un_Wn_order Un (cauchy_maj Un H) (cauchy_min Un H)). @@ -69,7 +69,7 @@ Proof. elim (H8 n); intros. apply Rle_trans with (Un n); assumption. apply Rle_ge. - unfold Rminus in |- *; apply Rplus_le_reg_l with (Vn n). + unfold Rminus; apply Rplus_le_reg_l with (Vn n). rewrite Rplus_0_r. replace (Vn n + (Un n + - Vn n)) with (Un n); [ idtac | ring ]. assert (H8 := Vn_Un_Wn_order Un (cauchy_maj Un H) (cauchy_min Un H)). @@ -85,26 +85,26 @@ Proof. repeat apply Rplus_lt_compat. unfold R_dist in H5. apply H5. - unfold ge in |- *; apply le_trans with (max x1 x2). + unfold ge; apply le_trans with (max x1 x2). apply le_max_l. assumption. rewrite <- Rabs_Ropp. replace (- (x - Vn n)) with (Vn n - x); [ idtac | ring ]. unfold R_dist in H6. apply H6. - unfold ge in |- *; apply le_trans with (max x1 x2). + unfold ge; apply le_trans with (max x1 x2). apply le_max_r. assumption. unfold R_dist in H6. apply H6. - unfold ge in |- *; apply le_trans with (max x1 x2). + unfold ge; apply le_trans with (max x1 x2). apply le_max_r. assumption. right. - pattern eps at 4 in |- *; replace eps with (3 * (eps / 3)). + pattern eps at 4; replace eps with (3 * (eps / 3)). ring. - unfold Rdiv in |- *; rewrite <- Rmult_assoc; apply Rinv_r_simpl_m; discrR. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; rewrite <- Rmult_assoc; apply Rinv_r_simpl_m; discrR. + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. apply cond_eq. intros. @@ -130,10 +130,10 @@ Proof. repeat apply Rplus_lt_compat. rewrite <- Rabs_Ropp. replace (- (x - Wn N)) with (Wn N - x); [ apply H4 | ring ]. - unfold ge, N in |- *. + unfold ge, N. apply le_trans with (max N1 N2); apply le_max_l. - unfold Wn, Vn in |- *. - unfold sequence_majorant, sequence_minorant in |- *. + unfold Wn, Vn. + unfold sequence_majorant, sequence_minorant. assert (H7 := approx_maj (fun k:nat => Un (N + k)%nat) (maj_ss Un N (cauchy_maj Un H))). @@ -169,13 +169,13 @@ Proof. [ repeat apply Rplus_lt_compat | ring ]. assumption. apply H6. - unfold ge in |- *. + unfold ge. apply le_trans with N. - unfold N in |- *; apply le_max_r. + unfold N; apply le_max_r. apply le_plus_l. - unfold ge in |- *. + unfold ge. apply le_trans with N. - unfold N in |- *; apply le_max_r. + unfold N; apply le_max_r. apply le_plus_l. rewrite <- Rabs_Ropp. replace (- (Un (N + k1)%nat - Vn N)) with (Vn N - Un (N + k1)%nat); @@ -183,14 +183,14 @@ Proof. reflexivity. reflexivity. apply H5. - unfold ge in |- *; apply le_trans with (max N1 N2). + unfold ge; apply le_trans with (max N1 N2). apply le_max_r. - unfold N in |- *; apply le_max_l. - pattern eps at 4 in |- *; replace eps with (5 * (eps / 5)). + unfold N; apply le_max_l. + pattern eps at 4; replace eps with (5 * (eps / 5)). ring. - unfold Rdiv in |- *; rewrite <- Rmult_assoc; apply Rinv_r_simpl_m. + unfold Rdiv; rewrite <- Rmult_assoc; apply Rinv_r_simpl_m. discrR. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. assumption. apply Rinv_0_lt_compat. prove_sup0; try apply lt_O_Sn. diff --git a/theories/Reals/Rdefinitions.v b/theories/Reals/Rdefinitions.v index 83c6b82d..f7d03ed8 100644 --- a/theories/Reals/Rdefinitions.v +++ b/theories/Reals/Rdefinitions.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -21,7 +21,7 @@ Delimit Scope R_scope with R. (* Automatically open scope R_scope for arguments of type R *) Bind Scope R_scope with R. -Open Local Scope R_scope. +Local Open Scope R_scope. Parameter R0 : R. Parameter R1 : R. diff --git a/theories/Reals/Rderiv.v b/theories/Reals/Rderiv.v index 105d8347..e714f5f8 100644 --- a/theories/Reals/Rderiv.v +++ b/theories/Reals/Rderiv.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -16,7 +16,7 @@ Require Import Rfunctions. Require Import Rlimit. Require Import Fourier. Require Import Omega. -Open Local Scope R_scope. +Local Open Scope R_scope. (*********) Definition D_x (D:R -> Prop) (y x:R) : Prop := D x /\ y <> x. @@ -34,18 +34,18 @@ Lemma cont_deriv : forall (f d:R -> R) (D:R -> Prop) (x0:R), D_in f d D x0 -> continue_in f D x0. Proof. - unfold continue_in in |- *; unfold D_in in |- *; unfold limit1_in in |- *; - unfold limit_in in |- *; unfold Rdiv in |- *; simpl in |- *; + unfold continue_in; unfold D_in; unfold limit1_in; + unfold limit_in; unfold Rdiv; simpl; intros; elim (H eps H0); clear H; intros; elim H; clear H; intros; elim (Req_dec (d x0) 0); intro. split with (Rmin 1 x); split. elim (Rmin_Rgt 1 x 0); intros a b; apply (b (conj Rlt_0_1 H)). intros; elim H3; clear H3; intros; generalize (let (H1, H2) := Rmin_Rgt 1 x (R_dist x1 x0) in H1); - unfold Rgt in |- *; intro; elim (H5 H4); clear H5; + unfold Rgt; intro; elim (H5 H4); clear H5; intros; generalize (H1 x1 (conj H3 H6)); clear H1; intro; unfold D_x in H3; elim H3; intros. - rewrite H2 in H1; unfold R_dist in |- *; unfold R_dist in H1; + rewrite H2 in H1; unfold R_dist; unfold R_dist in H1; cut (Rabs (f x1 - f x0) < eps * Rabs (x1 - x0)). intro; unfold R_dist in H5; generalize (Rmult_lt_compat_l eps (Rabs (x1 - x0)) 1 H0 H5); @@ -68,7 +68,7 @@ Proof. intros; elim (Rmin_Rgt (Rmin (/ 2) x) (eps * / Rabs (2 * d x0)) 0); intros a b; apply (b (conj H4 H3)). apply Rmult_gt_0_compat; auto. - unfold Rgt in |- *; apply Rinv_0_lt_compat; apply Rabs_pos_lt; + unfold Rgt; apply Rinv_0_lt_compat; apply Rabs_pos_lt; apply Rmult_integral_contrapositive; split. discrR. assumption. @@ -80,17 +80,17 @@ Proof. generalize (let (H1, H2) := Rmin_Rgt (Rmin (/ 2) x) (eps * / Rabs (2 * d x0)) (R_dist x1 x0) in - H1); unfold Rgt in |- *; intro; elim (H5 H4); clear H5; + H1); unfold Rgt; intro; elim (H5 H4); clear H5; intros; generalize (let (H1, H2) := Rmin_Rgt (/ 2) x (R_dist x1 x0) in H1); - unfold Rgt in |- *; intro; elim (H7 H5); clear H7; + unfold Rgt; intro; elim (H7 H5); clear H7; intros; clear H4 H5; generalize (H1 x1 (conj H3 H8)); clear H1; intro; unfold D_x in H3; elim H3; intros; - generalize (sym_not_eq H5); clear H5; intro H5; + generalize (not_eq_sym H5); clear H5; intro H5; generalize (Rminus_eq_contra x1 x0 H5); intro; generalize H1; - pattern (d x0) at 1 in |- *; + pattern (d x0) at 1; rewrite <- (let (H1, H2) := Rmult_ne (d x0) in H2); - rewrite <- (Rinv_l (x1 - x0) H9); unfold R_dist in |- *; - unfold Rminus at 1 in |- *; rewrite (Rmult_comm (f x1 - f x0) (/ (x1 - x0))); + rewrite <- (Rinv_l (x1 - x0) H9); unfold R_dist; + unfold Rminus at 1; rewrite (Rmult_comm (f x1 - f x0) (/ (x1 - x0))); rewrite (Rmult_comm (/ (x1 - x0) * (x1 - x0)) (d x0)); rewrite <- (Ropp_mult_distr_l_reverse (d x0) (/ (x1 - x0) * (x1 - x0))); rewrite (Rmult_comm (- d x0) (/ (x1 - x0) * (x1 - x0))); @@ -113,7 +113,7 @@ Proof. ; generalize (Rabs_triang_inv (f x1 - f x0) ((x1 - x0) * d x0)); intro; rewrite (Rmult_comm (x1 - x0) (- d x0)); rewrite (Ropp_mult_distr_l_reverse (d x0) (x1 - x0)); - fold (f x1 - f x0 - d x0 * (x1 - x0)) in |- *; + fold (f x1 - f x0 - d x0 * (x1 - x0)); rewrite (Rmult_comm (x1 - x0) (d x0)) in H10; clear H1; intro; generalize @@ -123,7 +123,7 @@ Proof. generalize (Rplus_lt_compat_l (Rabs (d x0 * (x1 - x0))) (Rabs (f x1 - f x0) - Rabs (d x0 * (x1 - x0))) ( - Rabs (x1 - x0) * eps) H1); unfold Rminus at 2 in |- *; + Rabs (x1 - x0) * eps) H1); unfold Rminus at 2; rewrite (Rplus_comm (Rabs (f x1 - f x0)) (- Rabs (d x0 * (x1 - x0)))); rewrite <- (Rplus_assoc (Rabs (d x0 * (x1 - x0))) (- Rabs (d x0 * (x1 - x0))) @@ -162,7 +162,7 @@ Proof. (Rplus_lt_compat (Rabs (d x0 * (x1 - x0))) (eps * / 2) (Rabs (x1 - x0) * eps) (eps * / 2) H5 H3); intro; rewrite eps2 in H10; assumption. - unfold Rabs in |- *; case (Rcase_abs 2); auto. + unfold Rabs; case (Rcase_abs 2); auto. intro; cut (0 < 2). intro ; elim (Rlt_asym 0 2 H7 r). fourier. @@ -174,14 +174,14 @@ Qed. Lemma Dconst : forall (D:R -> Prop) (y x0:R), D_in (fun x:R => y) (fun x:R => 0) D x0. Proof. - unfold D_in in |- *; intros; unfold limit1_in in |- *; - unfold limit_in in |- *; unfold Rdiv in |- *; intros; - simpl in |- *; split with eps; split; auto. - intros; rewrite (Rminus_diag_eq y y (refl_equal y)); rewrite Rmult_0_l; - unfold R_dist in |- *; rewrite (Rminus_diag_eq 0 0 (refl_equal 0)); - unfold Rabs in |- *; case (Rcase_abs 0); intro. + unfold D_in; intros; unfold limit1_in; + unfold limit_in; unfold Rdiv; intros; + simpl; split with eps; split; auto. + intros; rewrite (Rminus_diag_eq y y (eq_refl y)); rewrite Rmult_0_l; + unfold R_dist; rewrite (Rminus_diag_eq 0 0 (eq_refl 0)); + unfold Rabs; case (Rcase_abs 0); intro. absurd (0 < 0); auto. - red in |- *; intro; apply (Rlt_irrefl 0 H1). + red; intro; apply (Rlt_irrefl 0 H1). unfold Rgt in H0; assumption. Qed. @@ -189,15 +189,15 @@ Qed. Lemma Dx : forall (D:R -> Prop) (x0:R), D_in (fun x:R => x) (fun x:R => 1) D x0. Proof. - unfold D_in in |- *; unfold Rdiv in |- *; intros; unfold limit1_in in |- *; - unfold limit_in in |- *; intros; simpl in |- *; split with eps; + unfold D_in; unfold Rdiv; intros; unfold limit1_in; + unfold limit_in; intros; simpl; split with eps; split; auto. intros; elim H0; clear H0; intros; unfold D_x in H0; elim H0; intros; - rewrite (Rinv_r (x - x0) (Rminus_eq_contra x x0 (sym_not_eq H3))); - unfold R_dist in |- *; rewrite (Rminus_diag_eq 1 1 (refl_equal 1)); - unfold Rabs in |- *; case (Rcase_abs 0); intro. + rewrite (Rinv_r (x - x0) (Rminus_eq_contra x x0 (not_eq_sym H3))); + unfold R_dist; rewrite (Rminus_diag_eq 1 1 (eq_refl 1)); + unfold Rabs; case (Rcase_abs 0); intro. absurd (0 < 0); auto. - red in |- *; intro; apply (Rlt_irrefl 0 r). + red; intro; apply (Rlt_irrefl 0 r). unfold Rgt in H; assumption. Qed. @@ -208,12 +208,12 @@ Lemma Dadd : D_in g dg D x0 -> D_in (fun x:R => f x + g x) (fun x:R => df x + dg x) D x0. Proof. - unfold D_in in |- *; intros; + unfold D_in; intros; generalize (limit_plus (fun x:R => (f x - f x0) * / (x - x0)) (fun x:R => (g x - g x0) * / (x - x0)) (D_x D x0) ( - df x0) (dg x0) x0 H H0); clear H H0; unfold limit1_in in |- *; - unfold limit_in in |- *; simpl in |- *; intros; elim (H eps H0); + df x0) (dg x0) x0 H H0); clear H H0; unfold limit1_in; + unfold limit_in; simpl; intros; elim (H eps H0); clear H; intros; elim H; clear H; intros; split with x; split; auto; intros; generalize (H1 x1 H2); clear H1; intro; rewrite (Rmult_comm (f x1 - f x0) (/ (x1 - x0))) in H1; @@ -233,8 +233,8 @@ Lemma Dmult : D_in g dg D x0 -> D_in (fun x:R => f x * g x) (fun x:R => df x * g x + f x * dg x) D x0. Proof. - intros; unfold D_in in |- *; generalize H H0; intros; unfold D_in in H, H0; - generalize (cont_deriv f df D x0 H1); unfold continue_in in |- *; + intros; unfold D_in; generalize H H0; intros; unfold D_in in H, H0; + generalize (cont_deriv f df D x0 H1); unfold continue_in; intro; generalize (limit_mul (fun x:R => (g x - g x0) * / (x - x0)) ( @@ -250,8 +250,8 @@ Proof. (fun x:R => (g x - g x0) * / (x - x0) * f x) ( D_x D x0) (df x0 * g x0) (dg x0 * f x0) x0 H H4); clear H4 H; intro; unfold limit1_in in H; unfold limit_in in H; - simpl in H; unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; intros; elim (H eps H0); clear H; intros; + simpl in H; unfold limit1_in; unfold limit_in; + simpl; intros; elim (H eps H0); clear H; intros; elim H; clear H; intros; split with x; split; auto; intros; generalize (H1 x1 H2); clear H1; intro; rewrite (Rmult_comm (f x1 - f x0) (/ (x1 - x0))) in H1; @@ -268,9 +268,9 @@ Proof. ((f x1 - f x0) * g x0 + (g x1 - g x0) * f x1 = f x1 * g x1 - f x0 * g x0). intro; rewrite H3 in H1; assumption. ring. - unfold limit1_in in |- *; unfold limit_in in |- *; simpl in |- *; intros; + unfold limit1_in; unfold limit_in; simpl; intros; split with eps; split; auto; intros; elim (R_dist_refl (g x0) (g x0)); - intros a b; rewrite (b (refl_equal (g x0))); unfold Rgt in H; + intros a b; rewrite (b (eq_refl (g x0))); unfold Rgt in H; assumption. Qed. @@ -281,7 +281,7 @@ Lemma Dmult_const : Proof. intros; generalize (Dmult D (fun _:R => 0) df (fun _:R => a) f x0 (Dconst D a x0) H); - unfold D_in in |- *; intros; rewrite (Rmult_0_l (f x0)) in H0; + unfold D_in; intros; rewrite (Rmult_0_l (f x0)) in H0; rewrite (let (H1, H2) := Rplus_ne (a * df x0) in H2) in H0; assumption. Qed. @@ -291,10 +291,10 @@ Lemma Dopp : forall (D:R -> Prop) (f df:R -> R) (x0:R), D_in f df D x0 -> D_in (fun x:R => - f x) (fun x:R => - df x) D x0. Proof. - intros; generalize (Dmult_const D f df x0 (-1) H); unfold D_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; + intros; generalize (Dmult_const D f df x0 (-1) H); unfold D_in; + unfold limit1_in; unfold limit_in; intros; generalize (H0 eps H1); clear H0; intro; elim H0; - clear H0; intros; elim H0; clear H0; simpl in |- *; + clear H0; intros; elim H0; clear H0; simpl; intros; split with x; split; auto. intros; generalize (H2 x1 H3); clear H2; intro; rewrite Ropp_mult_distr_l_reverse in H2; @@ -313,7 +313,7 @@ Lemma Dminus : D_in g dg D x0 -> D_in (fun x:R => f x - g x) (fun x:R => df x - dg x) D x0. Proof. - unfold Rminus in |- *; intros; generalize (Dopp D g dg x0 H0); intro; + unfold Rminus; intros; generalize (Dopp D g dg x0 H0); intro; apply (Dadd D df (fun x:R => - dg x) f (fun x:R => - g x) x0); assumption. Qed. @@ -324,14 +324,14 @@ Lemma Dx_pow_n : D_in (fun x:R => x ^ n) (fun x:R => INR n * x ^ (n - 1)) D x0. Proof. simple induction n; intros. - simpl in |- *; rewrite Rmult_0_l; apply Dconst. + simpl; rewrite Rmult_0_l; apply Dconst. intros; cut (n0 = (S n0 - 1)%nat); - [ intro a; rewrite <- a; clear a | simpl in |- *; apply minus_n_O ]. + [ intro a; rewrite <- a; clear a | simpl; apply minus_n_O ]. generalize (Dmult D (fun _:R => 1) (fun x:R => INR n0 * x ^ (n0 - 1)) ( fun x:R => x) (fun x:R => x ^ n0) x0 (Dx D x0) ( - H D x0)); unfold D_in in |- *; unfold limit1_in in |- *; - unfold limit_in in |- *; simpl in |- *; intros; elim (H0 eps H1); + H D x0)); unfold D_in; unfold limit1_in; + unfold limit_in; simpl; intros; elim (H0 eps H1); clear H0; intros; elim H0; clear H0; intros; split with x; split; auto. intros; generalize (H2 x1 H3); clear H2 H3; intro; @@ -340,7 +340,7 @@ Proof. rewrite (Rmult_comm (INR n0) (x0 ^ (n0 - 1))) in H2; rewrite <- (Rmult_assoc x0 (x0 ^ (n0 - 1)) (INR n0)) in H2; rewrite (tech_pow_Rmult x0 (n0 - 1)) in H2; elim (Peano_dec.eq_nat_dec n0 0) ; intros cond. - rewrite cond in H2; rewrite cond; simpl in H2; simpl in |- *; + rewrite cond in H2; rewrite cond; simpl in H2; simpl; cut (1 + x0 * 1 * 0 = 1 * 1); [ intro A; rewrite A in H2; assumption | ring ]. cut (n0 <> 0%nat -> S (n0 - 1) = n0); [ intro | omega ]; @@ -355,8 +355,8 @@ Lemma Dcomp : D_in g dg Dg (f x0) -> D_in (fun x:R => g (f x)) (fun x:R => df x * dg (f x)) (Dgf Df Dg f) x0. Proof. - intros Df Dg df dg f g x0 H H0; generalize H H0; unfold D_in in |- *; - unfold Rdiv in |- *; intros; + intros Df Dg df dg f g x0 H H0; generalize H H0; unfold D_in; + unfold Rdiv; intros; generalize (limit_comp f (fun x:R => (g x - g (f x0)) * / (x - f x0)) ( D_x Df x0) (D_x Dg (f x0)) (f x0) (dg (f x0)) x0); @@ -376,8 +376,8 @@ Proof. (limit_mul (fun x:R => (f x - f x0) * / (x - x0)) ( fun x:R => dg (f x0)) (D_x Df x0) (df x0) (dg (f x0)) x0 H1 (limit_free (fun x:R => dg (f x0)) (D_x Df x0) x0 x0)); - intro; unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold limit1_in in H5, H7; unfold limit_in in H5, H7; + intro; unfold limit1_in; unfold limit_in; + simpl; unfold limit1_in in H5, H7; unfold limit_in in H5, H7; simpl in H5, H7; intros; elim (H5 eps H8); elim (H7 eps H8); clear H5 H7; intros; elim H5; elim H7; clear H5 H7; intros; split with (Rmin x x1); split. @@ -391,7 +391,7 @@ Proof. rewrite (Rminus_diag_eq (f x2) (f x0) H12) in H16; rewrite (Rmult_0_l (/ (x2 - x0))) in H16; rewrite (Rmult_0_l (dg (f x0))) in H16; rewrite H12; - rewrite (Rminus_diag_eq (g (f x0)) (g (f x0)) (refl_equal (g (f x0)))); + rewrite (Rminus_diag_eq (g (f x0)) (g (f x0)) (eq_refl (g (f x0)))); rewrite (Rmult_0_l (/ (x2 - x0))); assumption. clear H10 H5; elim H11; clear H11; intros; elim H5; clear H5; intros; cut @@ -405,8 +405,8 @@ Proof. in H15; rewrite (Rinv_l (f x2 - f x0) H16) in H15; rewrite (let (H1, H2) := Rmult_ne (/ (x2 - x0)) in H2) in H15; rewrite (Rmult_comm (df x0) (dg (f x0))); assumption. - clear H5 H3 H4 H2; unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold limit1_in in H1; unfold limit_in in H1; + clear H5 H3 H4 H2; unfold limit1_in; unfold limit_in; + simpl; unfold limit1_in in H1; unfold limit_in in H1; simpl in H1; intros; elim (H1 eps H2); clear H1; intros; elim H1; clear H1; intros; split with x; split; auto; intros; unfold D_x, Dgf in H4, H3; elim H4; clear H4; @@ -425,8 +425,8 @@ Proof. generalize (Dcomp D D dexpr (fun x:R => INR n * x ^ (n - 1)) expr ( fun x:R => x ^ n) x0 H (Dx_pow_n n D (expr x0))); - intro; unfold D_in in |- *; unfold limit1_in in |- *; - unfold limit_in in |- *; simpl in |- *; intros; unfold D_in in H0; + intro; unfold D_in; unfold limit1_in; + unfold limit_in; simpl; intros; unfold D_in in H0; unfold limit1_in in H0; unfold limit_in in H0; simpl in H0; elim (H0 eps H1); clear H0; intros; elim H0; clear H0; intros; split with x; split; intros; auto. diff --git a/theories/Reals/Reals.v b/theories/Reals/Reals.v index a15e9949..03bf534d 100644 --- a/theories/Reals/Reals.v +++ b/theories/Reals/Reals.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) diff --git a/theories/Reals/Rfunctions.v b/theories/Reals/Rfunctions.v index c0cd7864..4724d0e5 100644 --- a/theories/Reals/Rfunctions.v +++ b/theories/Reals/Rfunctions.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -25,8 +25,8 @@ Require Export SplitRmult. Require Export ArithProp. Require Import Omega. Require Import Zpower. -Open Local Scope nat_scope. -Open Local Scope R_scope. +Local Open Scope nat_scope. +Local Open Scope R_scope. (*******************************) (** * Lemmas about factorial *) @@ -82,6 +82,15 @@ Proof. intros n0 H' m; rewrite H'; auto with real. Qed. +Lemma Rpow_mult_distr : forall (x y:R) (n:nat), (x * y) ^ n = x^n * y^n. +Proof. +intros x y n ; induction n. + field. + simpl. + repeat (rewrite Rmult_assoc) ; apply Rmult_eq_compat_l. + rewrite IHn ; field. +Qed. + Lemma pow_nonzero : forall (x:R) (n:nat), x <> 0 -> x ^ n <> 0. Proof. intro; simple induction n; simpl. @@ -212,8 +221,8 @@ Qed. Lemma RPow_abs : forall (x:R) (n:nat), Rabs x ^ n = Rabs (x ^ n). Proof. intro; simple induction n; simpl. - apply sym_eq; apply Rabs_pos_eq; apply Rlt_le; apply Rlt_0_1. - intros; rewrite H; apply sym_eq; apply Rabs_mult. + symmetry; apply Rabs_pos_eq; apply Rlt_le; apply Rlt_0_1. + intros; rewrite H; symmetry; apply Rabs_mult. Qed. @@ -517,16 +526,16 @@ Qed. (*i Due to L.Thery i*) Ltac case_eq name := - generalize (refl_equal name); pattern name at -1; case name. + generalize (eq_refl name); pattern name at -1; case name. Definition powerRZ (x:R) (n:Z) := match n with | Z0 => 1 - | Zpos p => x ^ nat_of_P p - | Zneg p => / x ^ nat_of_P p + | Zpos p => x ^ Pos.to_nat p + | Zneg p => / x ^ Pos.to_nat p end. -Infix Local "^Z" := powerRZ (at level 30, right associativity) : R_scope. +Local Infix "^Z" := powerRZ (at level 30, right associativity) : R_scope. Lemma Zpower_NR0 : forall (x:Z) (n:nat), (0 <= x)%Z -> (0 <= Zpower_nat x n)%Z. @@ -539,7 +548,7 @@ Proof. reflexivity. Qed. -Lemma powerRZ_1 : forall x:R, x ^Z Zsucc 0 = x. +Lemma powerRZ_1 : forall x:R, x ^Z Z.succ 0 = x. Proof. simpl; auto with real. Qed. @@ -549,67 +558,63 @@ Proof. destruct z; simpl; auto with real. Qed. +Lemma powerRZ_pos_sub (x:R) (n m:positive) : x <> 0 -> + x ^Z (Z.pos_sub n m) = x ^ Pos.to_nat n * / x ^ Pos.to_nat m. +Proof. + intro Hx. + rewrite Z.pos_sub_spec. + case Pos.compare_spec; intro H; simpl. + - subst; auto with real. + - rewrite Pos2Nat.inj_sub by trivial. + rewrite Pos2Nat.inj_lt in H. + rewrite (pow_RN_plus x _ (Pos.to_nat n)) by auto with real. + rewrite plus_comm, le_plus_minus_r by auto with real. + rewrite Rinv_mult_distr, Rinv_involutive; auto with real. + - rewrite Pos2Nat.inj_sub by trivial. + rewrite Pos2Nat.inj_lt in H. + rewrite (pow_RN_plus x _ (Pos.to_nat m)) by auto with real. + rewrite plus_comm, le_plus_minus_r by auto with real. + reflexivity. +Qed. + Lemma powerRZ_add : forall (x:R) (n m:Z), x <> 0 -> x ^Z (n + m) = x ^Z n * x ^Z m. Proof. - intro x; destruct n as [| n1| n1]; destruct m as [| m1| m1]; simpl; - auto with real. -(* POS/POS *) - rewrite Pplus_plus; auto with real. -(* POS/NEG *) - rewrite Z.pos_sub_spec. - case Pcompare_spec; intros; simpl. - subst; auto with real. - rewrite Pminus_minus by trivial. - rewrite (pow_RN_plus x _ (nat_of_P n1)) by auto with real. - rewrite plus_comm, le_plus_minus_r by (now apply lt_le_weak, Plt_lt). - rewrite Rinv_mult_distr, Rinv_involutive; auto with real. - rewrite Pminus_minus by trivial. - rewrite (pow_RN_plus x _ (nat_of_P m1)) by auto with real. - rewrite plus_comm, le_plus_minus_r by (now apply lt_le_weak, Plt_lt). - reflexivity. -(* NEG/POS *) - rewrite Z.pos_sub_spec. - case Pcompare_spec; intros; simpl. - subst; auto with real. - rewrite Pminus_minus by trivial. - rewrite (pow_RN_plus x _ (nat_of_P m1)) by auto with real. - rewrite plus_comm, le_plus_minus_r by (now apply lt_le_weak, Plt_lt). - rewrite Rinv_mult_distr, Rinv_involutive; auto with real. - rewrite Pminus_minus by trivial. - rewrite (pow_RN_plus x _ (nat_of_P n1)) by auto with real. - rewrite plus_comm, le_plus_minus_r by (now apply lt_le_weak, Plt_lt). - auto with real. -(* NEG/NEG *) - rewrite Pplus_plus; auto with real. - intros H'; rewrite pow_add; auto with real. - apply Rinv_mult_distr; auto. - apply pow_nonzero; auto. - apply pow_nonzero; auto. + intros x [|n|n] [|m|m]; simpl; intros; auto with real. + - (* + + *) + rewrite Pos2Nat.inj_add; auto with real. + - (* + - *) + now apply powerRZ_pos_sub. + - (* - + *) + rewrite Rmult_comm. now apply powerRZ_pos_sub. + - (* - - *) + rewrite Pos2Nat.inj_add; auto with real. + rewrite pow_add; auto with real. + apply Rinv_mult_distr; apply pow_nonzero; auto. Qed. Hint Resolve powerRZ_O powerRZ_1 powerRZ_NOR powerRZ_add: real. Lemma Zpower_nat_powerRZ : - forall n m:nat, IZR (Zpower_nat (Z_of_nat n) m) = INR n ^Z Z_of_nat m. + forall n m:nat, IZR (Zpower_nat (Z.of_nat n) m) = INR n ^Z Z.of_nat m. Proof. intros n m; elim m; simpl; auto with real. - intros m1 H'; rewrite nat_of_P_of_succ_nat; simpl. - replace (Zpower_nat (Z_of_nat n) (S m1)) with - (Z_of_nat n * Zpower_nat (Z_of_nat n) m1)%Z. + intros m1 H'; rewrite SuccNat2Pos.id_succ; simpl. + replace (Zpower_nat (Z.of_nat n) (S m1)) with + (Z.of_nat n * Zpower_nat (Z.of_nat n) m1)%Z. rewrite mult_IZR; auto with real. repeat rewrite <- INR_IZR_INZ; simpl. rewrite H'; simpl. case m1; simpl; auto with real. - intros m2; rewrite nat_of_P_of_succ_nat; auto. + intros m2; rewrite SuccNat2Pos.id_succ; auto. unfold Zpower_nat; auto. Qed. Lemma Zpower_pos_powerRZ : - forall n m, IZR (Zpower_pos n m) = IZR n ^Z Zpos m. + forall n m, IZR (Z.pow_pos n m) = IZR n ^Z Zpos m. Proof. intros. rewrite Zpower_pos_nat; simpl. - induction (nat_of_P m). + induction (Pos.to_nat m). easy. unfold Zpower_nat; simpl. rewrite mult_IZR. @@ -629,10 +634,10 @@ Qed. Hint Resolve powerRZ_le: real. Lemma Zpower_nat_powerRZ_absolu : - forall n m:Z, (0 <= m)%Z -> IZR (Zpower_nat n (Zabs_nat m)) = IZR n ^Z m. + forall n m:Z, (0 <= m)%Z -> IZR (Zpower_nat n (Z.abs_nat m)) = IZR n ^Z m. Proof. intros n m; case m; simpl; auto with zarith. - intros p H'; elim (nat_of_P p); simpl; auto with zarith. + intros p H'; elim (Pos.to_nat p); simpl; auto with zarith. intros n0 H'0; rewrite <- H'0; simpl; auto with zarith. rewrite <- mult_IZR; auto. intros p H'; absurd (0 <= Zneg p)%Z; auto with zarith. @@ -641,9 +646,9 @@ Qed. Lemma powerRZ_R1 : forall n:Z, 1 ^Z n = 1. Proof. intros n; case n; simpl; auto. - intros p; elim (nat_of_P p); simpl; auto; intros n0 H'; rewrite H'; + intros p; elim (Pos.to_nat p); simpl; auto; intros n0 H'; rewrite H'; ring. - intros p; elim (nat_of_P p); simpl. + intros p; elim (Pos.to_nat p); simpl. exact Rinv_1. intros n1 H'; rewrite Rinv_mult_distr; try rewrite Rinv_1; try rewrite H'; auto with real. @@ -751,9 +756,9 @@ Qed. Lemma R_dist_refl : forall x y:R, R_dist x y = 0 <-> x = y. Proof. unfold R_dist; intros; split_Rabs; split; intros. - rewrite (Ropp_minus_distr x y) in H; apply sym_eq; + rewrite (Ropp_minus_distr x y) in H; symmetry; apply (Rminus_diag_uniq y x H). - rewrite (Ropp_minus_distr x y); generalize (sym_eq H); intro; + rewrite (Ropp_minus_distr x y); generalize (eq_sym H); intro; apply (Rminus_diag_eq y x H0). apply (Rminus_diag_uniq x y H). apply (Rminus_diag_eq x y H). diff --git a/theories/Reals/Rgeom.v b/theories/Reals/Rgeom.v index bda64e77..ffa11608 100644 --- a/theories/Reals/Rgeom.v +++ b/theories/Reals/Rgeom.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,9 +9,9 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. -Require Import Rtrigo. +Require Import Rtrigo1. Require Import R_sqrt. -Open Local Scope R_scope. +Local Open Scope R_scope. (** * Distance *) @@ -20,23 +20,23 @@ Definition dist_euc (x0 y0 x1 y1:R) : R := Lemma distance_refl : forall x0 y0:R, dist_euc x0 y0 x0 y0 = 0. Proof. - intros x0 y0; unfold dist_euc in |- *; apply Rsqr_inj; + intros x0 y0; unfold dist_euc; apply Rsqr_inj; [ apply sqrt_positivity; apply Rplus_le_le_0_compat; [ apply Rle_0_sqr | apply Rle_0_sqr ] | right; reflexivity | rewrite Rsqr_0; rewrite Rsqr_sqrt; - [ unfold Rsqr in |- *; ring + [ unfold Rsqr; ring | apply Rplus_le_le_0_compat; [ apply Rle_0_sqr | apply Rle_0_sqr ] ] ]. Qed. Lemma distance_symm : forall x0 y0 x1 y1:R, dist_euc x0 y0 x1 y1 = dist_euc x1 y1 x0 y0. Proof. - intros x0 y0 x1 y1; unfold dist_euc in |- *; apply Rsqr_inj; + intros x0 y0 x1 y1; unfold dist_euc; apply Rsqr_inj; [ apply sqrt_positivity; apply Rplus_le_le_0_compat | apply sqrt_positivity; apply Rplus_le_le_0_compat | repeat rewrite Rsqr_sqrt; - [ unfold Rsqr in |- *; ring + [ unfold Rsqr; ring | apply Rplus_le_le_0_compat | apply Rplus_le_le_0_compat ] ]; apply Rle_0_sqr. Qed. @@ -49,8 +49,8 @@ Lemma law_cosines : a * c * cos ac = (x0 - x1) * (x2 - x1) + (y0 - y1) * (y2 - y1) -> Rsqr b = Rsqr c + Rsqr a - 2 * (a * c * cos ac). Proof. - unfold dist_euc in |- *; intros; repeat rewrite Rsqr_sqrt; - [ rewrite H; unfold Rsqr in |- *; ring + unfold dist_euc; intros; repeat rewrite Rsqr_sqrt; + [ rewrite H; unfold Rsqr; ring | apply Rplus_le_le_0_compat | apply Rplus_le_le_0_compat | apply Rplus_le_le_0_compat ]; apply Rle_0_sqr. @@ -60,7 +60,7 @@ Lemma triangle : forall x0 y0 x1 y1 x2 y2:R, dist_euc x0 y0 x1 y1 <= dist_euc x0 y0 x2 y2 + dist_euc x2 y2 x1 y1. Proof. - intros; unfold dist_euc in |- *; apply Rsqr_incr_0; + intros; unfold dist_euc; apply Rsqr_incr_0; [ rewrite Rsqr_plus; repeat rewrite Rsqr_sqrt; [ replace (Rsqr (x0 - x1)) with (Rsqr (x0 - x2) + Rsqr (x2 - x1) + 2 * (x0 - x2) * (x2 - x1)); @@ -112,7 +112,7 @@ Definition yt (y ty:R) : R := y + ty. Lemma translation_0 : forall x y:R, xt x 0 = x /\ yt y 0 = y. Proof. - intros x y; split; [ unfold xt in |- * | unfold yt in |- * ]; ring. + intros x y; split; [ unfold xt | unfold yt ]; ring. Qed. Lemma isometric_translation : @@ -120,7 +120,7 @@ Lemma isometric_translation : Rsqr (x1 - x2) + Rsqr (y1 - y2) = Rsqr (xt x1 tx - xt x2 tx) + Rsqr (yt y1 ty - yt y2 ty). Proof. - intros; unfold Rsqr, xt, yt in |- *; ring. + intros; unfold Rsqr, xt, yt; ring. Qed. (******************************************************************) @@ -132,13 +132,13 @@ Definition yr (x y theta:R) : R := - x * sin theta + y * cos theta. Lemma rotation_0 : forall x y:R, xr x y 0 = x /\ yr x y 0 = y. Proof. - intros x y; unfold xr, yr in |- *; split; rewrite cos_0; rewrite sin_0; ring. + intros x y; unfold xr, yr; split; rewrite cos_0; rewrite sin_0; ring. Qed. Lemma rotation_PI2 : forall x y:R, xr x y (PI / 2) = y /\ yr x y (PI / 2) = - x. Proof. - intros x y; unfold xr, yr in |- *; split; rewrite cos_PI2; rewrite sin_PI2; + intros x y; unfold xr, yr; split; rewrite cos_PI2; rewrite sin_PI2; ring. Qed. @@ -148,7 +148,7 @@ Lemma isometric_rotation_0 : Rsqr (xr x1 y1 theta - xr x2 y2 theta) + Rsqr (yr x1 y1 theta - yr x2 y2 theta). Proof. - intros; unfold xr, yr in |- *; + intros; unfold xr, yr; replace (x1 * cos theta + y1 * sin theta - (x2 * cos theta + y2 * sin theta)) with (cos theta * (x1 - x2) + sin theta * (y1 - y2)); @@ -168,7 +168,7 @@ Lemma isometric_rotation : dist_euc (xr x1 y1 theta) (yr x1 y1 theta) (xr x2 y2 theta) (yr x2 y2 theta). Proof. - unfold dist_euc in |- *; intros; apply Rsqr_inj; + unfold dist_euc; intros; apply Rsqr_inj; [ apply sqrt_positivity; apply Rplus_le_le_0_compat | apply sqrt_positivity; apply Rplus_le_le_0_compat | repeat rewrite Rsqr_sqrt; diff --git a/theories/Reals/RiemannInt.v b/theories/Reals/RiemannInt.v index 8acfd75b..0a00ca22 100644 --- a/theories/Reals/RiemannInt.v +++ b/theories/Reals/RiemannInt.v @@ -1,7 +1,7 @@ (* -*- coding: utf-8 -*- *) (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,13 +9,13 @@ Require Import Rfunctions. Require Import SeqSeries. -Require Import Ranalysis. +Require Import Ranalysis_reg. Require Import Rbase. Require Import RiemannInt_SF. Require Import Classical_Prop. Require Import Classical_Pred_Type. Require Import Max. -Open Local Scope R_scope. +Local Open Scope R_scope. Set Implicit Arguments. @@ -51,19 +51,19 @@ Lemma RiemannInt_P1 : forall (f:R -> R) (a b:R), Riemann_integrable f a b -> Riemann_integrable f b a. Proof. - unfold Riemann_integrable in |- *; intros; elim (X eps); clear X; intros; + unfold Riemann_integrable; intros; elim (X eps); clear X; intros; elim p; clear p; intros; exists (mkStepFun (StepFun_P6 (pre x))); exists (mkStepFun (StepFun_P6 (pre x0))); elim p; clear p; intros; split. intros; apply (H t); elim H1; clear H1; intros; split; [ apply Rle_trans with (Rmin b a); try assumption; right; - unfold Rmin in |- * + unfold Rmin | apply Rle_trans with (Rmax b a); try assumption; right; - unfold Rmax in |- * ]; + unfold Rmax ]; (case (Rle_dec a b); case (Rle_dec b a); intros; try reflexivity || apply Rle_antisym; [ assumption | assumption | auto with real | auto with real ]). - generalize H0; unfold RiemannInt_SF in |- *; case (Rle_dec a b); + generalize H0; unfold RiemannInt_SF; case (Rle_dec a b); case (Rle_dec b a); intros; (replace (Int_SF (subdivision_val (mkStepFun (StepFun_P6 (pre x0)))) @@ -89,11 +89,11 @@ Lemma RiemannInt_P2 : Rabs (RiemannInt_SF (wn n)) < un n) -> { l:R | Un_cv (fun N:nat => RiemannInt_SF (vn N)) l }. Proof. - intros; apply R_complete; unfold Un_cv in H; unfold Cauchy_crit in |- *; + intros; apply R_complete; unfold Un_cv in H; unfold Cauchy_crit; intros; assert (H3 : 0 < eps / 2). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. - elim (H _ H3); intros N0 H4; exists N0; intros; unfold R_dist in |- *; + elim (H _ H3); intros N0 H4; exists N0; intros; unfold R_dist; unfold R_dist in H4; elim (H1 n); elim (H1 m); intros; replace (RiemannInt_SF (vn n) - RiemannInt_SF (vn m)) with (RiemannInt_SF (vn n) + -1 * RiemannInt_SF (vn m)); @@ -105,15 +105,15 @@ Proof. apply Rle_lt_trans with (RiemannInt_SF (mkStepFun (StepFun_P28 1 (wn n) (wn m)))). apply StepFun_P37; try assumption. - intros; simpl in |- *; + intros; simpl; apply Rle_trans with (Rabs (vn n x - f x) + Rabs (f x - vn m x)). replace (vn n x + -1 * vn m x) with (vn n x - f x + (f x - vn m x)); [ apply Rabs_triang | ring ]. assert (H12 : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. assert (H13 : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. rewrite <- H12 in H11; pattern b at 2 in H11; rewrite <- H13 in H11; rewrite Rmult_1_l; apply Rplus_le_compat. @@ -156,14 +156,14 @@ Proof. intro; elim (H0 n0); intros; split. intros; apply (H2 t); elim H4; clear H4; intros; split; [ apply Rle_trans with (Rmin b a); try assumption; right; - unfold Rmin in |- * + unfold Rmin | apply Rle_trans with (Rmax b a); try assumption; right; - unfold Rmax in |- * ]; + unfold Rmax ]; (case (Rle_dec a b); case (Rle_dec b a); intros; try reflexivity || apply Rle_antisym; [ assumption | assumption | auto with real | auto with real ]). - generalize H3; unfold RiemannInt_SF in |- *; case (Rle_dec a b); - case (Rle_dec b a); unfold wn' in |- *; intros; + generalize H3; unfold RiemannInt_SF; case (Rle_dec a b); + case (Rle_dec b a); unfold wn'; intros; (replace (Int_SF (subdivision_val (mkStepFun (StepFun_P6 (pre (wn n0))))) (subdivision (mkStepFun (StepFun_P6 (pre (wn n0)))))) with @@ -178,19 +178,19 @@ Proof. rewrite Rabs_Ropp in H4; apply H4. apply H4. assert (H3 := RiemannInt_P2 _ _ _ _ H H1 H2); elim H3; intros; - exists (- x); unfold Un_cv in |- *; unfold Un_cv in p; + exists (- x); unfold Un_cv; unfold Un_cv in p; intros; elim (p _ H4); intros; exists x0; intros; - generalize (H5 _ H6); unfold R_dist, RiemannInt_SF in |- *; + generalize (H5 _ H6); unfold R_dist, RiemannInt_SF; case (Rle_dec b a); case (Rle_dec a b); intros. elim n; assumption. unfold vn' in H7; replace (Int_SF (subdivision_val (vn n0)) (subdivision (vn n0))) with (Int_SF (subdivision_val (mkStepFun (StepFun_P6 (pre (vn n0))))) (subdivision (mkStepFun (StepFun_P6 (pre (vn n0)))))); - [ unfold Rminus in |- *; rewrite Ropp_involutive; rewrite <- Rabs_Ropp; + [ unfold Rminus; rewrite Ropp_involutive; rewrite <- Rabs_Ropp; rewrite Ropp_plus_distr; rewrite Ropp_involutive; apply H7 - | symmetry in |- *; apply StepFun_P17 with (fe (vn n0)) a b; + | symmetry ; apply StepFun_P17 with (fe (vn n0)) a b; [ apply StepFun_P1 | apply StepFun_P2; apply (StepFun_P1 (mkStepFun (StepFun_P6 (pre (vn n0))))) ] ]. @@ -218,9 +218,9 @@ Lemma RiemannInt_P4 : Un_cv (fun N:nat => RiemannInt_SF (phi_sequence un pr1 N)) l -> Un_cv (fun N:nat => RiemannInt_SF (phi_sequence vn pr2 N)) l. Proof. - unfold Un_cv in |- *; unfold R_dist in |- *; intros f; intros; + unfold Un_cv; unfold R_dist; intros f; intros; assert (H3 : 0 < eps / 3). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. elim (H _ H3); clear H; intros N0 H; elim (H0 _ H3); clear H0; intros N1 H0; elim (H1 _ H3); clear H1; intros N2 H1; set (N := max (max N0 N1) N2); @@ -255,7 +255,7 @@ Proof. apply StepFun_P34; assumption. apply Rle_lt_trans with (RiemannInt_SF (mkStepFun (StepFun_P28 1 psi_un psi_vn))). - apply StepFun_P37; try assumption; intros; simpl in |- *; rewrite Rmult_1_l; + apply StepFun_P37; try assumption; intros; simpl; rewrite Rmult_1_l; apply Rle_trans with (Rabs (phi_sequence vn pr2 n x - f x) + Rabs (f x - phi_sequence un pr1 n x)). @@ -263,10 +263,10 @@ Proof. (phi_sequence vn pr2 n x - f x + (f x - phi_sequence un pr1 n x)); [ apply Rabs_triang | ring ]. assert (H10 : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. assert (H11 : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. rewrite (Rplus_comm (psi_un x)); apply Rplus_le_compat. rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; elim H5; intros; apply H8. @@ -279,20 +279,20 @@ Proof. apply RRle_abs. assumption. replace (pos (un n)) with (Rabs (un n - 0)); - [ apply H; unfold ge in |- *; apply le_trans with N; try assumption; - unfold N in |- *; apply le_trans with (max N0 N1); + [ apply H; unfold ge; apply le_trans with N; try assumption; + unfold N; apply le_trans with (max N0 N1); apply le_max_l - | unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; + | unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; apply Rle_ge; left; apply (cond_pos (un n)) ]. apply Rlt_trans with (pos (vn n)). elim H5; intros; apply Rle_lt_trans with (Rabs (RiemannInt_SF psi_vn)). apply RRle_abs; assumption. assumption. replace (pos (vn n)) with (Rabs (vn n - 0)); - [ apply H0; unfold ge in |- *; apply le_trans with N; try assumption; - unfold N in |- *; apply le_trans with (max N0 N1); + [ apply H0; unfold ge; apply le_trans with N; try assumption; + unfold N; apply le_trans with (max N0 N1); [ apply le_max_r | apply le_max_l ] - | unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; + | unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; apply Rle_ge; left; apply (cond_pos (vn n)) ]. rewrite StepFun_P39; rewrite Rabs_Ropp; apply Rle_lt_trans with @@ -311,7 +311,7 @@ Proof. (mkStepFun (StepFun_P6 (pre (mkStepFun (StepFun_P28 1 psi_vn psi_un)))))). apply StepFun_P37. auto with real. - intros; simpl in |- *; rewrite Rmult_1_l; + intros; simpl; rewrite Rmult_1_l; apply Rle_trans with (Rabs (phi_sequence vn pr2 n x - f x) + Rabs (f x - phi_sequence un pr1 n x)). @@ -319,10 +319,10 @@ Proof. (phi_sequence vn pr2 n x - f x + (f x - phi_sequence un pr1 n x)); [ apply Rabs_triang | ring ]. assert (H10 : Rmin a b = b). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ elim n0; assumption | reflexivity ]. assert (H11 : Rmax a b = a). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ elim n0; assumption | reflexivity ]. apply Rplus_le_compat. rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; elim H5; intros; apply H8. @@ -341,10 +341,10 @@ Proof. rewrite <- Rabs_Ropp; apply RRle_abs. assumption. replace (pos (vn n)) with (Rabs (vn n - 0)); - [ apply H0; unfold ge in |- *; apply le_trans with N; try assumption; - unfold N in |- *; apply le_trans with (max N0 N1); + [ apply H0; unfold ge; apply le_trans with N; try assumption; + unfold N; apply le_trans with (max N0 N1); [ apply le_max_r | apply le_max_l ] - | unfold R_dist in |- *; unfold Rminus in |- *; rewrite Ropp_0; + | unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; apply Rle_ge; left; apply (cond_pos (vn n)) ]. apply Rlt_trans with (pos (un n)). @@ -352,15 +352,15 @@ Proof. rewrite <- Rabs_Ropp; apply RRle_abs; assumption. assumption. replace (pos (un n)) with (Rabs (un n - 0)); - [ apply H; unfold ge in |- *; apply le_trans with N; try assumption; - unfold N in |- *; apply le_trans with (max N0 N1); + [ apply H; unfold ge; apply le_trans with N; try assumption; + unfold N; apply le_trans with (max N0 N1); apply le_max_l - | unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; + | unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; apply Rle_ge; left; apply (cond_pos (un n)) ]. - apply H1; unfold ge in |- *; apply le_trans with N; try assumption; - unfold N in |- *; apply le_max_r. + apply H1; unfold ge; apply le_trans with N; try assumption; + unfold N; apply le_max_r. apply Rmult_eq_reg_l with 3; - [ unfold Rdiv in |- *; rewrite Rmult_plus_distr_l; + [ unfold Rdiv; rewrite Rmult_plus_distr_l; do 2 rewrite (Rmult_comm 3); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | discrR ] | discrR ]. @@ -376,17 +376,17 @@ Definition RinvN (N:nat) : posreal := mkposreal _ (RinvN_pos N). Lemma RinvN_cv : Un_cv RinvN 0. Proof. - unfold Un_cv in |- *; intros; assert (H0 := archimed (/ eps)); elim H0; + unfold Un_cv; intros; assert (H0 := archimed (/ eps)); elim H0; clear H0; intros; assert (H2 : (0 <= up (/ eps))%Z). apply le_IZR; left; apply Rlt_trans with (/ eps); [ apply Rinv_0_lt_compat; assumption | assumption ]. - elim (IZN _ H2); intros; exists x; intros; unfold R_dist in |- *; - simpl in |- *; unfold Rminus in |- *; rewrite Ropp_0; + elim (IZN _ H2); intros; exists x; intros; unfold R_dist; + simpl; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; assert (H5 : 0 < INR n + 1). apply Rplus_le_lt_0_compat; [ apply pos_INR | apply Rlt_0_1 ]. rewrite Rabs_right; [ idtac - | left; change (0 < / (INR n + 1)) in |- *; apply Rinv_0_lt_compat; + | left; change (0 < / (INR n + 1)); apply Rinv_0_lt_compat; assumption ]; apply Rle_lt_trans with (/ (INR x + 1)). apply Rle_Rinv. apply Rplus_le_lt_0_compat; [ apply pos_INR | apply Rlt_0_1 ]. @@ -400,9 +400,9 @@ Proof. apply Rplus_le_lt_0_compat; [ apply pos_INR | apply Rlt_0_1 ]. apply Rlt_trans with (INR x); [ rewrite INR_IZR_INZ; rewrite <- H3; apply H0 - | pattern (INR x) at 1 in |- *; rewrite <- Rplus_0_r; + | pattern (INR x) at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; apply Rlt_0_1 ]. - red in |- *; intro; rewrite H6 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H6 in H; elim (Rlt_irrefl _ H). Qed. (**********) @@ -413,7 +413,7 @@ Lemma RiemannInt_P5 : forall (f:R -> R) (a b:R) (pr1 pr2:Riemann_integrable f a b), RiemannInt pr1 = RiemannInt pr2. Proof. - intros; unfold RiemannInt in |- *; + intros; unfold RiemannInt; case (RiemannInt_exists pr1 RinvN RinvN_cv); case (RiemannInt_exists pr2 RinvN RinvN_cv); intros; eapply UL_sequence; @@ -431,7 +431,7 @@ Lemma maxN : Proof. intros; set (I := fun n:nat => a + INR n * del < b); assert (H0 : exists n : nat, I n). - exists 0%nat; unfold I in |- *; rewrite Rmult_0_l; rewrite Rplus_0_r; + exists 0%nat; unfold I; rewrite Rmult_0_l; rewrite Rplus_0_r; assumption. cut (Nbound I). intro; assert (H2 := Nzorn H0 H1); elim H2; intros; exists x; elim p; intros; @@ -440,27 +440,27 @@ Proof. case (total_order_T (a + INR (S x) * del) b); intro. elim s; intro. assert (H5 := H4 (S x) a0); elim (le_Sn_n _ H5). - right; symmetry in |- *; assumption. + right; symmetry ; assumption. left; apply r. assert (H1 : 0 <= (b - a) / del). - unfold Rdiv in |- *; apply Rmult_le_pos; + unfold Rdiv; apply Rmult_le_pos; [ apply Rge_le; apply Rge_minus; apply Rle_ge; left; apply H | left; apply Rinv_0_lt_compat; apply (cond_pos del) ]. elim (archimed ((b - a) / del)); intros; assert (H4 : (0 <= up ((b - a) / del))%Z). - apply le_IZR; simpl in |- *; left; apply Rle_lt_trans with ((b - a) / del); + apply le_IZR; simpl; left; apply Rle_lt_trans with ((b - a) / del); assumption. assert (H5 := IZN _ H4); elim H5; clear H5; intros N H5; - unfold Nbound in |- *; exists N; intros; unfold I in H6; + unfold Nbound; exists N; intros; unfold I in H6; apply INR_le; rewrite H5 in H2; rewrite <- INR_IZR_INZ in H2; left; apply Rle_lt_trans with ((b - a) / del); try assumption; apply Rmult_le_reg_l with (pos del); [ apply (cond_pos del) - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ del)); + | unfold Rdiv; rewrite <- (Rmult_comm (/ del)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite Rmult_comm; apply Rplus_le_reg_l with a; replace (a + (b - a)) with b; [ left; assumption | ring ] - | assert (H7 := cond_pos del); red in |- *; intro; rewrite H8 in H7; + | assert (H7 := cond_pos del); red; intro; rewrite H8 in H7; elim (Rlt_irrefl _ H7) ] ]. Qed. @@ -496,15 +496,15 @@ Proof. a <= x <= b -> a <= y <= b -> Rabs (x - y) < l -> Rabs (f x - f y) < eps)); assert (H1 : bound E). - unfold bound in |- *; exists (b - a); unfold is_upper_bound in |- *; intros; + unfold bound; exists (b - a); unfold is_upper_bound; intros; unfold E in H1; elim H1; clear H1; intros H1 _; elim H1; intros; assumption. assert (H2 : exists x : R, E x). assert (H2 := Heine f (fun x:R => a <= x <= b) (compact_P3 a b) H0 eps); - elim H2; intros; exists (Rmin x (b - a)); unfold E in |- *; + elim H2; intros; exists (Rmin x (b - a)); unfold E; split; [ split; - [ unfold Rmin in |- *; case (Rle_dec x (b - a)); intro; + [ unfold Rmin; case (Rle_dec x (b - a)); intro; [ apply (cond_pos x) | apply Rlt_Rminus; assumption ] | apply Rmin_r ] | intros; apply H3; try assumption; apply Rlt_le_trans with (Rmin x (b - a)); @@ -519,7 +519,7 @@ Proof. intros; apply H15; assumption. assert (H12 := not_ex_all_not _ (fun y:R => D < y /\ E y) H11); assert (H13 : is_upper_bound E D). - unfold is_upper_bound in |- *; intros; assert (H14 := H12 x1); + unfold is_upper_bound; intros; assert (H14 := H12 x1); elim (not_and_or (D < x1) (E x1) H14); intro. case (Rle_dec x1 D); intro. assumption. @@ -551,7 +551,7 @@ Proof. exists (mkposreal _ Rlt_0_1); intros; assert (H3 : x = y); [ elim H0; elim H1; intros; rewrite b0 in H3; rewrite b0 in H5; apply Rle_antisym; apply Rle_trans with b; assumption - | rewrite H3; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + | rewrite H3; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply (cond_pos eps) ]. exists (mkposreal _ Rlt_0_1); intros; elim H0; intros; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ (Rle_trans _ _ _ H3 H4) r)). @@ -560,14 +560,14 @@ Qed. Lemma SubEqui_P1 : forall (a b:R) (del:posreal) (h:a < b), pos_Rl (SubEqui del h) 0 = a. Proof. - intros; unfold SubEqui in |- *; case (maxN del h); intros; reflexivity. + intros; unfold SubEqui; case (maxN del h); intros; reflexivity. Qed. Lemma SubEqui_P2 : forall (a b:R) (del:posreal) (h:a < b), pos_Rl (SubEqui del h) (pred (Rlength (SubEqui del h))) = b. Proof. - intros; unfold SubEqui in |- *; case (maxN del h); intros; clear a0; + intros; unfold SubEqui; case (maxN del h); intros; clear a0; cut (forall (x:nat) (a:R) (del:posreal), pos_Rl (SubEquiN (S x) a b del) @@ -579,14 +579,14 @@ Proof. change (pos_Rl (SubEquiN (S n) (a0 + del0) b del0) (pred (Rlength (SubEquiN (S n) (a0 + del0) b del0))) = b) - in |- *; apply H ] ]. + ; apply H ] ]. Qed. Lemma SubEqui_P3 : forall (N:nat) (a b:R) (del:posreal), Rlength (SubEquiN N a b del) = S N. Proof. simple induction N; intros; - [ reflexivity | simpl in |- *; rewrite H; reflexivity ]. + [ reflexivity | simpl; rewrite H; reflexivity ]. Qed. Lemma SubEqui_P4 : @@ -594,36 +594,36 @@ Lemma SubEqui_P4 : (i < S N)%nat -> pos_Rl (SubEquiN (S N) a b del) i = a + INR i * del. Proof. simple induction N; - [ intros; inversion H; [ simpl in |- *; ring | elim (le_Sn_O _ H1) ] + [ intros; inversion H; [ simpl; ring | elim (le_Sn_O _ H1) ] | intros; induction i as [| i Hreci]; - [ simpl in |- *; ring + [ simpl; ring | change (pos_Rl (SubEquiN (S n) (a + del) b del) i = a + INR (S i) * del) - in |- *; rewrite H; [ rewrite S_INR; ring | apply lt_S_n; apply H0 ] ] ]. + ; rewrite H; [ rewrite S_INR; ring | apply lt_S_n; apply H0 ] ] ]. Qed. Lemma SubEqui_P5 : forall (a b:R) (del:posreal) (h:a < b), Rlength (SubEqui del h) = S (S (max_N del h)). Proof. - intros; unfold SubEqui in |- *; apply SubEqui_P3. + intros; unfold SubEqui; apply SubEqui_P3. Qed. Lemma SubEqui_P6 : forall (a b:R) (del:posreal) (h:a < b) (i:nat), (i < S (max_N del h))%nat -> pos_Rl (SubEqui del h) i = a + INR i * del. Proof. - intros; unfold SubEqui in |- *; apply SubEqui_P4; assumption. + intros; unfold SubEqui; apply SubEqui_P4; assumption. Qed. Lemma SubEqui_P7 : forall (a b:R) (del:posreal) (h:a < b), ordered_Rlist (SubEqui del h). Proof. - intros; unfold ordered_Rlist in |- *; intros; rewrite SubEqui_P5 in H; + intros; unfold ordered_Rlist; intros; rewrite SubEqui_P5 in H; simpl in H; inversion H. rewrite (SubEqui_P6 del h (i:=(max_N del h))). replace (S (max_N del h)) with (pred (Rlength (SubEqui del h))). - rewrite SubEqui_P2; unfold max_N in |- *; case (maxN del h); intros; left; + rewrite SubEqui_P2; unfold max_N; case (maxN del h); intros; left; elim a0; intros; assumption. rewrite SubEqui_P5; reflexivity. apply lt_n_Sn. @@ -631,7 +631,7 @@ Proof. 3: assumption. 2: apply le_lt_n_Sm; assumption. apply Rplus_le_compat_l; rewrite S_INR; rewrite Rmult_plus_distr_r; - pattern (INR i * del) at 1 in |- *; rewrite <- Rplus_0_r; + pattern (INR i * del) at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; rewrite Rmult_1_l; left; apply (cond_pos del). Qed. @@ -641,11 +641,11 @@ Lemma SubEqui_P8 : (i < Rlength (SubEqui del h))%nat -> a <= pos_Rl (SubEqui del h) i <= b. Proof. intros; split. - pattern a at 1 in |- *; rewrite <- (SubEqui_P1 del h); apply RList_P5. + pattern a at 1; rewrite <- (SubEqui_P1 del h); apply RList_P5. apply SubEqui_P7. elim (RList_P3 (SubEqui del h) (pos_Rl (SubEqui del h) i)); intros; apply H1; exists i; split; [ reflexivity | assumption ]. - pattern b at 2 in |- *; rewrite <- (SubEqui_P2 del h); apply RList_P7; + pattern b at 2; rewrite <- (SubEqui_P2 del h); apply RList_P7; [ apply SubEqui_P7 | elim (RList_P3 (SubEqui del h) (pos_Rl (SubEqui del h) i)); intros; apply H1; exists i; split; [ reflexivity | assumption ] ]. @@ -671,42 +671,42 @@ Lemma RiemannInt_P6 : a < b -> (forall x:R, a <= x <= b -> continuity_pt f x) -> Riemann_integrable f a b. Proof. - intros; unfold Riemann_integrable in |- *; intro; + intros; unfold Riemann_integrable; intro; assert (H1 : 0 < eps / (2 * (b - a))). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos eps) | apply Rinv_0_lt_compat; apply Rmult_lt_0_compat; [ prove_sup0 | apply Rlt_Rminus; assumption ] ]. assert (H2 : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; left; assumption ]. assert (H3 : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; left; assumption ]. elim (Heine_cor2 H0 (mkposreal _ H1)); intros del H4; elim (SubEqui_P9 del f H); intros phi [H5 H6]; split with phi; split with (mkStepFun (StepFun_P4 a b (eps / (2 * (b - a))))); split. - 2: rewrite StepFun_P18; unfold Rdiv in |- *; rewrite Rinv_mult_distr. + 2: rewrite StepFun_P18; unfold Rdiv; rewrite Rinv_mult_distr. 2: do 2 rewrite Rmult_assoc; rewrite <- Rinv_l_sym. 2: rewrite Rmult_1_r; rewrite Rabs_right. 2: apply Rmult_lt_reg_l with 2. 2: prove_sup0. 2: rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. - 2: rewrite Rmult_1_l; pattern (pos eps) at 1 in |- *; rewrite <- Rplus_0_r; + 2: rewrite Rmult_1_l; pattern (pos eps) at 1; rewrite <- Rplus_0_r; rewrite double; apply Rplus_lt_compat_l; apply (cond_pos eps). 2: discrR. 2: apply Rle_ge; left; apply Rmult_lt_0_compat. 2: apply (cond_pos eps). 2: apply Rinv_0_lt_compat; prove_sup0. - 2: apply Rminus_eq_contra; red in |- *; intro; clear H6; rewrite H7 in H; + 2: apply Rminus_eq_contra; red; intro; clear H6; rewrite H7 in H; elim (Rlt_irrefl _ H). 2: discrR. - 2: apply Rminus_eq_contra; red in |- *; intro; clear H6; rewrite H7 in H; + 2: apply Rminus_eq_contra; red; intro; clear H6; rewrite H7 in H; elim (Rlt_irrefl _ H). - intros; rewrite H2 in H7; rewrite H3 in H7; simpl in |- *; - unfold fct_cte in |- *; + intros; rewrite H2 in H7; rewrite H3 in H7; simpl; + unfold fct_cte; cut (forall t:R, a <= t <= b -> @@ -716,14 +716,14 @@ Proof. co_interval (pos_Rl (SubEqui del H) i) (pos_Rl (SubEqui del H) (S i)) t)). intro; elim (H8 _ H7); intro. - rewrite H9; rewrite H5; unfold Rminus in |- *; rewrite Rplus_opp_r; + rewrite H9; rewrite H5; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; left; assumption. elim H9; clear H9; intros I [H9 H10]; assert (H11 := H6 I H9 t H10); rewrite H11; left; apply H4. assumption. apply SubEqui_P8; apply lt_trans with (pred (Rlength (SubEqui del H))). assumption. - apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H12 in H9; + apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H12 in H9; elim (lt_n_O _ H9). unfold co_interval in H10; elim H10; clear H10; intros; rewrite Rabs_right. rewrite SubEqui_P5 in H9; simpl in H9; inversion H9. @@ -738,7 +738,7 @@ Proof. rewrite H13 in H12; rewrite SubEqui_P2 in H12; apply H12. rewrite SubEqui_P6. 2: apply lt_n_Sn. - unfold max_N in |- *; case (maxN del H); intros; elim a0; clear a0; + unfold max_N; case (maxN del H); intros; elim a0; clear a0; intros _ H13; replace (a + INR x * del + del) with (a + INR (S x) * del); [ assumption | rewrite S_INR; ring ]. apply Rplus_lt_reg_r with (pos_Rl (SubEqui del H) I); @@ -755,10 +755,10 @@ Proof. left; assumption. right; set (I := fun j:nat => a + INR j * del <= t0); assert (H1 : exists n : nat, I n). - exists 0%nat; unfold I in |- *; rewrite Rmult_0_l; rewrite Rplus_0_r; elim H8; + exists 0%nat; unfold I; rewrite Rmult_0_l; rewrite Rplus_0_r; elim H8; intros; assumption. assert (H4 : Nbound I). - unfold Nbound in |- *; exists (S (max_N del H)); intros; unfold max_N in |- *; + unfold Nbound; exists (S (max_N del H)); intros; unfold max_N; case (maxN del H); intros; elim a0; clear a0; intros _ H5; apply INR_le; apply Rmult_le_reg_l with (pos del). apply (cond_pos del). @@ -767,7 +767,7 @@ Proof. apply Rle_trans with b; try assumption; elim H8; intros; assumption. elim (Nzorn H1 H4); intros N [H5 H6]; assert (H7 : (N < S (max_N del H))%nat). - unfold max_N in |- *; case (maxN del H); intros; apply INR_lt; + unfold max_N; case (maxN del H); intros; apply INR_lt; apply Rmult_lt_reg_l with (pos del). apply (cond_pos del). apply Rplus_lt_reg_r with a; do 2 rewrite (Rmult_comm del); @@ -778,8 +778,8 @@ Proof. assumption. elim H0; assumption. exists N; split. - rewrite SubEqui_P5; simpl in |- *; assumption. - unfold co_interval in |- *; split. + rewrite SubEqui_P5; simpl; assumption. + unfold co_interval; split. rewrite SubEqui_P6. apply H5. assumption. @@ -799,13 +799,13 @@ Qed. Lemma RiemannInt_P7 : forall (f:R -> R) (a:R), Riemann_integrable f a a. Proof. - unfold Riemann_integrable in |- *; intro f; intros; + unfold Riemann_integrable; intro f; intros; split with (mkStepFun (StepFun_P4 a a (f a))); split with (mkStepFun (StepFun_P4 a a 0)); split. - intros; simpl in |- *; unfold fct_cte in |- *; replace t with a. - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; right; + intros; simpl; unfold fct_cte; replace t with a. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; right; reflexivity. - generalize H; unfold Rmin, Rmax in |- *; case (Rle_dec a a); intros; elim H0; + generalize H; unfold Rmin, Rmax; case (Rle_dec a a); intros; elim H0; intros; apply Rle_antisym; assumption. rewrite StepFun_P18; rewrite Rmult_0_l; rewrite Rabs_R0; apply (cond_pos eps). Qed. @@ -826,9 +826,9 @@ Lemma RiemannInt_P8 : (pr2:Riemann_integrable f b a), RiemannInt pr1 = - RiemannInt pr2. Proof. intro f; intros; eapply UL_sequence. - unfold RiemannInt in |- *; case (RiemannInt_exists pr1 RinvN RinvN_cv); + unfold RiemannInt; case (RiemannInt_exists pr1 RinvN RinvN_cv); intros; apply u. - unfold RiemannInt in |- *; case (RiemannInt_exists pr2 RinvN RinvN_cv); + unfold RiemannInt; case (RiemannInt_exists pr2 RinvN RinvN_cv); intros; cut (exists psi1 : nat -> StepFun a b, @@ -845,9 +845,9 @@ Proof. Rabs (f t - phi_sequence RinvN pr2 n t) <= psi2 n t) /\ Rabs (RiemannInt_SF (psi2 n)) < RinvN n)). intros; elim H; clear H; intros psi2 H; elim H0; clear H0; intros psi1 H0; - assert (H1 := RinvN_cv); unfold Un_cv in |- *; intros; + assert (H1 := RinvN_cv); unfold Un_cv; intros; assert (H3 : 0 < eps / 3). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. unfold Un_cv in H1; elim (H1 _ H3); clear H1; intros N0 H1; unfold R_dist in H1; simpl in H1; @@ -855,10 +855,10 @@ Proof. intros; assert (H5 := H1 _ H4); replace (pos (RinvN n)) with (Rabs (/ (INR n + 1) - 0)); [ assumption - | unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; + | unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; left; apply (cond_pos (RinvN n)) ]. clear H1; unfold Un_cv in u; elim (u _ H3); clear u; intros N1 H1; - exists (max N0 N1); intros; unfold R_dist in |- *; + exists (max N0 N1); intros; unfold R_dist; apply Rle_lt_trans with (Rabs (RiemannInt_SF (phi_sequence RinvN pr1 n) + @@ -895,7 +895,7 @@ Proof. (mkStepFun (StepFun_P28 1 (psi1 n) (mkStepFun (StepFun_P6 (pre (psi2 n))))))). apply StepFun_P37; try assumption. - intros; simpl in |- *; rewrite Rmult_1_l; + intros; simpl; rewrite Rmult_1_l; apply Rle_trans with (Rabs (phi_sequence RinvN pr1 n x0 - f x0) + Rabs (f x0 - phi_sequence RinvN pr2 n x0)). @@ -903,10 +903,10 @@ Proof. (phi_sequence RinvN pr1 n x0 - f x0 + (f x0 - phi_sequence RinvN pr2 n x0)); [ apply Rabs_triang | ring ]. assert (H7 : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. assert (H8 : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. apply Rplus_le_compat. elim (H0 n); intros; rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; apply H9; @@ -919,7 +919,7 @@ Proof. [ apply RRle_abs | apply Rlt_trans with (pos (RinvN n)); [ assumption - | apply H4; unfold ge in |- *; apply le_trans with (max N0 N1); + | apply H4; unfold ge; apply le_trans with (max N0 N1); [ apply le_max_l | assumption ] ] ]. elim (H n); intros; rewrite <- @@ -929,7 +929,7 @@ Proof. [ rewrite <- Rabs_Ropp; apply RRle_abs | apply Rlt_trans with (pos (RinvN n)); [ assumption - | apply H4; unfold ge in |- *; apply le_trans with (max N0 N1); + | apply H4; unfold ge; apply le_trans with (max N0 N1); [ apply le_max_l | assumption ] ] ]. assert (Hyp : b <= a). auto with real. @@ -948,7 +948,7 @@ Proof. (mkStepFun (StepFun_P28 1 (mkStepFun (StepFun_P6 (pre (psi1 n)))) (psi2 n)))). apply StepFun_P37; try assumption. - intros; simpl in |- *; rewrite Rmult_1_l; + intros; simpl; rewrite Rmult_1_l; apply Rle_trans with (Rabs (phi_sequence RinvN pr1 n x0 - f x0) + Rabs (f x0 - phi_sequence RinvN pr2 n x0)). @@ -956,10 +956,10 @@ Proof. (phi_sequence RinvN pr1 n x0 - f x0 + (f x0 - phi_sequence RinvN pr2 n x0)); [ apply Rabs_triang | ring ]. assert (H7 : Rmin a b = b). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ elim n0; assumption | reflexivity ]. assert (H8 : Rmax a b = a). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ elim n0; assumption | reflexivity ]. apply Rplus_le_compat. elim (H0 n); intros; rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; apply H9; @@ -976,18 +976,18 @@ Proof. [ rewrite <- Rabs_Ropp; apply RRle_abs | apply Rlt_trans with (pos (RinvN n)); [ assumption - | apply H4; unfold ge in |- *; apply le_trans with (max N0 N1); + | apply H4; unfold ge; apply le_trans with (max N0 N1); [ apply le_max_l | assumption ] ] ]. elim (H n); intros; apply Rle_lt_trans with (Rabs (RiemannInt_SF (psi2 n))); [ apply RRle_abs | apply Rlt_trans with (pos (RinvN n)); [ assumption - | apply H4; unfold ge in |- *; apply le_trans with (max N0 N1); + | apply H4; unfold ge; apply le_trans with (max N0 N1); [ apply le_max_l | assumption ] ] ]. - unfold R_dist in H1; apply H1; unfold ge in |- *; + unfold R_dist in H1; apply H1; unfold ge; apply le_trans with (max N0 N1); [ apply le_max_r | assumption ]. apply Rmult_eq_reg_l with 3; - [ unfold Rdiv in |- *; rewrite Rmult_plus_distr_l; + [ unfold Rdiv; rewrite Rmult_plus_distr_l; do 2 rewrite (Rmult_comm 3); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | discrR ] | discrR ]. @@ -1002,7 +1002,7 @@ Lemma RiemannInt_P9 : forall (f:R -> R) (a:R) (pr:Riemann_integrable f a a), RiemannInt pr = 0. Proof. intros; assert (H := RiemannInt_P8 pr pr); apply Rmult_eq_reg_l with 2; - [ rewrite Rmult_0_r; rewrite double; pattern (RiemannInt pr) at 2 in |- *; + [ rewrite Rmult_0_r; rewrite double; pattern (RiemannInt pr) at 2; rewrite H; apply Rplus_opp_r | discrR ]. Qed. @@ -1011,9 +1011,9 @@ Lemma Req_EM_T : forall r1 r2:R, {r1 = r2} + {r1 <> r2}. Proof. intros; elim (total_order_T r1 r2); intros; [ elim a; intro; - [ right; red in |- *; intro; rewrite H in a0; elim (Rlt_irrefl r2 a0) + [ right; red; intro; rewrite H in a0; elim (Rlt_irrefl r2 a0) | left; assumption ] - | right; red in |- *; intro; rewrite H in b; elim (Rlt_irrefl r2 b) ]. + | right; red; intro; rewrite H in b; elim (Rlt_irrefl r2 b) ]. Qed. (* L1([a,b]) is a vectorial space *) @@ -1023,16 +1023,16 @@ Lemma RiemannInt_P10 : Riemann_integrable g a b -> Riemann_integrable (fun x:R => f x + l * g x) a b. Proof. - unfold Riemann_integrable in |- *; intros f g; intros; case (Req_EM_T l 0); + unfold Riemann_integrable; intros f g; intros; case (Req_EM_T l 0); intro. elim (X eps); intros; split with x; elim p; intros; split with x0; elim p0; intros; split; try assumption; rewrite e; intros; rewrite Rmult_0_l; rewrite Rplus_0_r; apply H; assumption. assert (H : 0 < eps / 2). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos eps) | apply Rinv_0_lt_compat; prove_sup0 ]. assert (H0 : 0 < eps / (2 * Rabs l)). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos eps) | apply Rinv_0_lt_compat; apply Rmult_lt_0_compat; [ prove_sup0 | apply Rabs_pos_lt; assumption ] ]. @@ -1040,7 +1040,7 @@ Proof. split with (mkStepFun (StepFun_P28 l x x0)); elim p0; elim p; intros; split with (mkStepFun (StepFun_P28 (Rabs l) x1 x2)); elim p1; elim p2; clear p1 p2 p0 p X X0; intros; split. - intros; simpl in |- *; + intros; simpl; apply Rle_trans with (Rabs (f t - x t) + Rabs (l * (g t - x0 t))). replace (f t + l * g t - (x t + l * x0 t)) with (f t - x t + l * (g t - x0 t)); [ apply Rabs_triang | ring ]. @@ -1060,7 +1060,7 @@ Proof. [ rewrite Rmult_1_l; replace (/ Rabs l * (eps / 2)) with (eps / (2 * Rabs l)); [ apply H2 - | unfold Rdiv in |- *; rewrite Rinv_mult_distr; + | unfold Rdiv; rewrite Rinv_mult_distr; [ ring | discrR | apply Rabs_no_R0; assumption ] ] | apply Rabs_no_R0; assumption ]. Qed. @@ -1080,14 +1080,14 @@ Lemma RiemannInt_P11 : Un_cv (fun N:nat => RiemannInt_SF (phi1 N)) l -> Un_cv (fun N:nat => RiemannInt_SF (phi2 N)) l. Proof. - unfold Un_cv in |- *; intro f; intros; intros. + unfold Un_cv; intro f; intros; intros. case (Rle_dec a b); intro Hyp. assert (H4 : 0 < eps / 3). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. elim (H _ H4); clear H; intros N0 H. elim (H2 _ H4); clear H2; intros N1 H2. - set (N := max N0 N1); exists N; intros; unfold R_dist in |- *. + set (N := max N0 N1); exists N; intros; unfold R_dist. apply Rle_lt_trans with (Rabs (RiemannInt_SF (phi2 n) - RiemannInt_SF (phi1 n)) + Rabs (RiemannInt_SF (phi1 n) - l)). @@ -1106,24 +1106,24 @@ Proof. apply StepFun_P34; assumption. apply Rle_lt_trans with (RiemannInt_SF (mkStepFun (StepFun_P28 1 (psi1 n) (psi2 n)))). - apply StepFun_P37; try assumption; intros; simpl in |- *; rewrite Rmult_1_l. + apply StepFun_P37; try assumption; intros; simpl; rewrite Rmult_1_l. apply Rle_trans with (Rabs (phi2 n x - f x) + Rabs (f x - phi1 n x)). replace (phi2 n x + -1 * phi1 n x) with (phi2 n x - f x + (f x - phi1 n x)); [ apply Rabs_triang | ring ]. rewrite (Rplus_comm (psi1 n x)); apply Rplus_le_compat. rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; elim (H1 n); intros; apply H7. assert (H10 : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. assert (H11 : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. rewrite H10; rewrite H11; elim H6; intros; split; left; assumption. elim (H0 n); intros; apply H7; assert (H10 : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. assert (H11 : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. rewrite H10; rewrite H11; elim H6; intros; split; left; assumption. rewrite StepFun_P30; rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat. @@ -1132,9 +1132,9 @@ Proof. apply RRle_abs. assumption. replace (pos (un n)) with (R_dist (un n) 0). - apply H; unfold ge in |- *; apply le_trans with N; try assumption. - unfold N in |- *; apply le_max_l. - unfold R_dist in |- *; unfold Rminus in |- *; rewrite Ropp_0; + apply H; unfold ge; apply le_trans with N; try assumption. + unfold N; apply le_max_l. + unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right. apply Rle_ge; left; apply (cond_pos (un n)). apply Rlt_trans with (pos (un n)). @@ -1142,24 +1142,24 @@ Proof. apply RRle_abs; assumption. assumption. replace (pos (un n)) with (R_dist (un n) 0). - apply H; unfold ge in |- *; apply le_trans with N; try assumption; - unfold N in |- *; apply le_max_l. - unfold R_dist in |- *; unfold Rminus in |- *; rewrite Ropp_0; + apply H; unfold ge; apply le_trans with N; try assumption; + unfold N; apply le_max_l. + unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; apply Rle_ge; left; apply (cond_pos (un n)). - unfold R_dist in H2; apply H2; unfold ge in |- *; apply le_trans with N; - try assumption; unfold N in |- *; apply le_max_r. + unfold R_dist in H2; apply H2; unfold ge; apply le_trans with N; + try assumption; unfold N; apply le_max_r. apply Rmult_eq_reg_l with 3; - [ unfold Rdiv in |- *; rewrite Rmult_plus_distr_l; + [ unfold Rdiv; rewrite Rmult_plus_distr_l; do 2 rewrite (Rmult_comm 3); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | discrR ] | discrR ]. assert (H4 : 0 < eps / 3). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. elim (H _ H4); clear H; intros N0 H. elim (H2 _ H4); clear H2; intros N1 H2. - set (N := max N0 N1); exists N; intros; unfold R_dist in |- *. + set (N := max N0 N1); exists N; intros; unfold R_dist. apply Rle_lt_trans with (Rabs (RiemannInt_SF (phi2 n) - RiemannInt_SF (phi1 n)) + Rabs (RiemannInt_SF (phi1 n) - l)). @@ -1189,24 +1189,24 @@ Proof. (mkStepFun (StepFun_P6 (pre (mkStepFun (StepFun_P28 1 (psi1 n) (psi2 n))))))). apply StepFun_P37; try assumption. - intros; simpl in |- *; rewrite Rmult_1_l. + intros; simpl; rewrite Rmult_1_l. apply Rle_trans with (Rabs (phi2 n x - f x) + Rabs (f x - phi1 n x)). replace (phi2 n x + -1 * phi1 n x) with (phi2 n x - f x + (f x - phi1 n x)); [ apply Rabs_triang | ring ]. rewrite (Rplus_comm (psi1 n x)); apply Rplus_le_compat. rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; elim (H1 n); intros; apply H7. assert (H10 : Rmin a b = b). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ elim Hyp; assumption | reflexivity ]. assert (H11 : Rmax a b = a). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ elim Hyp; assumption | reflexivity ]. rewrite H10; rewrite H11; elim H6; intros; split; left; assumption. elim (H0 n); intros; apply H7; assert (H10 : Rmin a b = b). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ elim Hyp; assumption | reflexivity ]. assert (H11 : Rmax a b = a). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ elim Hyp; assumption | reflexivity ]. rewrite H10; rewrite H11; elim H6; intros; split; left; assumption. rewrite <- @@ -1224,9 +1224,9 @@ Proof. rewrite <- Rabs_Ropp; apply RRle_abs. assumption. replace (pos (un n)) with (R_dist (un n) 0). - apply H; unfold ge in |- *; apply le_trans with N; try assumption. - unfold N in |- *; apply le_max_l. - unfold R_dist in |- *; unfold Rminus in |- *; rewrite Ropp_0; + apply H; unfold ge; apply le_trans with N; try assumption. + unfold N; apply le_max_l. + unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right. apply Rle_ge; left; apply (cond_pos (un n)). apply Rlt_trans with (pos (un n)). @@ -1234,15 +1234,15 @@ Proof. rewrite <- Rabs_Ropp; apply RRle_abs; assumption. assumption. replace (pos (un n)) with (R_dist (un n) 0). - apply H; unfold ge in |- *; apply le_trans with N; try assumption; - unfold N in |- *; apply le_max_l. - unfold R_dist in |- *; unfold Rminus in |- *; rewrite Ropp_0; + apply H; unfold ge; apply le_trans with N; try assumption; + unfold N; apply le_max_l. + unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; apply Rle_ge; left; apply (cond_pos (un n)). - unfold R_dist in H2; apply H2; unfold ge in |- *; apply le_trans with N; - try assumption; unfold N in |- *; apply le_max_r. + unfold R_dist in H2; apply H2; unfold ge; apply le_trans with N; + try assumption; unfold N; apply le_max_r. apply Rmult_eq_reg_l with 3; - [ unfold Rdiv in |- *; rewrite Rmult_plus_distr_l; + [ unfold Rdiv; rewrite Rmult_plus_distr_l; do 2 rewrite (Rmult_comm 3); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | discrR ] | discrR ]. @@ -1255,8 +1255,8 @@ Lemma RiemannInt_P12 : a <= b -> RiemannInt pr3 = RiemannInt pr1 + l * RiemannInt pr2. Proof. intro f; intros; case (Req_dec l 0); intro. - pattern l at 2 in |- *; rewrite H0; rewrite Rmult_0_l; rewrite Rplus_0_r; - unfold RiemannInt in |- *; case (RiemannInt_exists pr3 RinvN RinvN_cv); + pattern l at 2; rewrite H0; rewrite Rmult_0_l; rewrite Rplus_0_r; + unfold RiemannInt; case (RiemannInt_exists pr3 RinvN RinvN_cv); case (RiemannInt_exists pr1 RinvN RinvN_cv); intros; eapply UL_sequence; [ apply u0 @@ -1278,18 +1278,18 @@ Proof. [ apply H2; assumption | rewrite H0; ring ] ] | assumption ] ]. eapply UL_sequence. - unfold RiemannInt in |- *; case (RiemannInt_exists pr3 RinvN RinvN_cv); + unfold RiemannInt; case (RiemannInt_exists pr3 RinvN RinvN_cv); intros; apply u. - unfold Un_cv in |- *; intros; unfold RiemannInt in |- *; + unfold Un_cv; intros; unfold RiemannInt; case (RiemannInt_exists pr1 RinvN RinvN_cv); - case (RiemannInt_exists pr2 RinvN RinvN_cv); unfold Un_cv in |- *; + case (RiemannInt_exists pr2 RinvN RinvN_cv); unfold Un_cv; intros; assert (H2 : 0 < eps / 5). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. elim (u0 _ H2); clear u0; intros N0 H3; assert (H4 := RinvN_cv); unfold Un_cv in H4; elim (H4 _ H2); clear H4 H2; intros N1 H4; assert (H5 : 0 < eps / (5 * Rabs l)). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; apply Rmult_lt_0_compat; [ prove_sup0 | apply Rabs_pos_lt; assumption ] ]. @@ -1298,17 +1298,17 @@ Proof. unfold R_dist in H3, H4, H5, H6; set (N := max (max N0 N1) (max N2 N3)). assert (H7 : forall n:nat, (n >= N1)%nat -> RinvN n < eps / 5). intros; replace (pos (RinvN n)) with (Rabs (RinvN n - 0)); - [ unfold RinvN in |- *; apply H4; assumption - | unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; + [ unfold RinvN; apply H4; assumption + | unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; left; apply (cond_pos (RinvN n)) ]. clear H4; assert (H4 := H7); clear H7; assert (H7 : forall n:nat, (n >= N3)%nat -> RinvN n < eps / (5 * Rabs l)). intros; replace (pos (RinvN n)) with (Rabs (RinvN n - 0)); - [ unfold RinvN in |- *; apply H5; assumption - | unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; + [ unfold RinvN; apply H5; assumption + | unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; left; apply (cond_pos (RinvN n)) ]. clear H5; assert (H5 := H7); clear H7; exists N; intros; - unfold R_dist in |- *. + unfold R_dist. apply Rle_lt_trans with (Rabs (RiemannInt_SF (phi_sequence RinvN pr3 n) - @@ -1381,10 +1381,10 @@ Proof. (RiemannInt_SF (phi_sequence RinvN pr1 n) + l * RiemannInt_SF (phi_sequence RinvN pr2 n))); [ idtac | ring ]; do 2 rewrite <- StepFun_P30; assert (H10 : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. assert (H11 : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. rewrite H10 in H7; rewrite H10 in H8; rewrite H10 in H9; rewrite H11 in H7; rewrite H11 in H8; rewrite H11 in H9; @@ -1404,7 +1404,7 @@ Proof. (StepFun_P28 1 (psi3 n) (mkStepFun (StepFun_P28 (Rabs l) (psi1 n) (psi2 n)))))). apply StepFun_P37; try assumption. - intros; simpl in |- *; rewrite Rmult_1_l. + intros; simpl; rewrite Rmult_1_l. apply Rle_trans with (Rabs (phi_sequence RinvN pr3 n x1 - (f x1 + l * g x1)) + Rabs @@ -1444,16 +1444,16 @@ Proof. apply Rlt_trans with (pos (RinvN n)); [ apply Rle_lt_trans with (Rabs (RiemannInt_SF (psi3 n))); [ apply RRle_abs | elim (H9 n); intros; assumption ] - | apply H4; unfold ge in |- *; apply le_trans with N; + | apply H4; unfold ge; apply le_trans with N; [ apply le_trans with (max N0 N1); - [ apply le_max_r | unfold N in |- *; apply le_max_l ] + [ apply le_max_r | unfold N; apply le_max_l ] | assumption ] ]. apply Rlt_trans with (pos (RinvN n)); [ apply Rle_lt_trans with (Rabs (RiemannInt_SF (psi1 n))); [ apply RRle_abs | elim (H7 n); intros; assumption ] - | apply H4; unfold ge in |- *; apply le_trans with N; + | apply H4; unfold ge; apply le_trans with N; [ apply le_trans with (max N0 N1); - [ apply le_max_r | unfold N in |- *; apply le_max_l ] + [ apply le_max_r | unfold N; apply le_max_l ] | assumption ] ]. apply Rmult_lt_reg_l with (/ Rabs l). apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption. @@ -1462,28 +1462,28 @@ Proof. apply Rlt_trans with (pos (RinvN n)); [ apply Rle_lt_trans with (Rabs (RiemannInt_SF (psi2 n))); [ apply RRle_abs | elim (H8 n); intros; assumption ] - | apply H5; unfold ge in |- *; apply le_trans with N; + | apply H5; unfold ge; apply le_trans with N; [ apply le_trans with (max N2 N3); - [ apply le_max_r | unfold N in |- *; apply le_max_r ] + [ apply le_max_r | unfold N; apply le_max_r ] | assumption ] ]. - unfold Rdiv in |- *; rewrite Rinv_mult_distr; + unfold Rdiv; rewrite Rinv_mult_distr; [ ring | discrR | apply Rabs_no_R0; assumption ]. apply Rabs_no_R0; assumption. - apply H3; unfold ge in |- *; apply le_trans with (max N0 N1); + apply H3; unfold ge; apply le_trans with (max N0 N1); [ apply le_max_l - | apply le_trans with N; [ unfold N in |- *; apply le_max_l | assumption ] ]. + | apply le_trans with N; [ unfold N; apply le_max_l | assumption ] ]. apply Rmult_lt_reg_l with (/ Rabs l). apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption. rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_l; replace (/ Rabs l * (eps / 5)) with (eps / (5 * Rabs l)). - apply H6; unfold ge in |- *; apply le_trans with (max N2 N3); + apply H6; unfold ge; apply le_trans with (max N2 N3); [ apply le_max_l - | apply le_trans with N; [ unfold N in |- *; apply le_max_r | assumption ] ]. - unfold Rdiv in |- *; rewrite Rinv_mult_distr; + | apply le_trans with N; [ unfold N; apply le_max_r | assumption ] ]. + unfold Rdiv; rewrite Rinv_mult_distr; [ ring | discrR | apply Rabs_no_R0; assumption ]. apply Rabs_no_R0; assumption. apply Rmult_eq_reg_l with 5; - [ unfold Rdiv in |- *; do 2 rewrite Rmult_plus_distr_l; + [ unfold Rdiv; do 2 rewrite Rmult_plus_distr_l; do 3 rewrite (Rmult_comm 5); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | discrR ] | discrR ]. @@ -1500,11 +1500,11 @@ Proof. | assert (H : b <= a); [ auto with real | replace (RiemannInt pr3) with (- RiemannInt (RiemannInt_P1 pr3)); - [ idtac | symmetry in |- *; apply RiemannInt_P8 ]; + [ idtac | symmetry ; apply RiemannInt_P8 ]; replace (RiemannInt pr2) with (- RiemannInt (RiemannInt_P1 pr2)); - [ idtac | symmetry in |- *; apply RiemannInt_P8 ]; + [ idtac | symmetry ; apply RiemannInt_P8 ]; replace (RiemannInt pr1) with (- RiemannInt (RiemannInt_P1 pr1)); - [ idtac | symmetry in |- *; apply RiemannInt_P8 ]; + [ idtac | symmetry ; apply RiemannInt_P8 ]; rewrite (RiemannInt_P12 (RiemannInt_P1 pr1) (RiemannInt_P1 pr2) (RiemannInt_P1 pr3) H); ring ] ]. @@ -1512,11 +1512,11 @@ Qed. Lemma RiemannInt_P14 : forall a b c:R, Riemann_integrable (fct_cte c) a b. Proof. - unfold Riemann_integrable in |- *; intros; + unfold Riemann_integrable; intros; split with (mkStepFun (StepFun_P4 a b c)); split with (mkStepFun (StepFun_P4 a b 0)); split; - [ intros; simpl in |- *; unfold Rminus in |- *; rewrite Rplus_opp_r; - rewrite Rabs_R0; unfold fct_cte in |- *; right; + [ intros; simpl; unfold Rminus; rewrite Rplus_opp_r; + rewrite Rabs_R0; unfold fct_cte; right; reflexivity | rewrite StepFun_P18; rewrite Rmult_0_l; rewrite Rabs_R0; apply (cond_pos eps) ]. @@ -1526,11 +1526,11 @@ Lemma RiemannInt_P15 : forall (a b c:R) (pr:Riemann_integrable (fct_cte c) a b), RiemannInt pr = c * (b - a). Proof. - intros; unfold RiemannInt in |- *; case (RiemannInt_exists pr RinvN RinvN_cv); + intros; unfold RiemannInt; case (RiemannInt_exists pr RinvN RinvN_cv); intros; eapply UL_sequence. apply u. set (phi1 := fun N:nat => phi_sequence RinvN pr N); - change (Un_cv (fun N:nat => RiemannInt_SF (phi1 N)) (c * (b - a))) in |- *; + change (Un_cv (fun N:nat => RiemannInt_SF (phi1 N)) (c * (b - a))); set (f := fct_cte c); assert (H1 : @@ -1549,13 +1549,13 @@ Proof. try assumption. apply RinvN_cv. intro; split. - intros; unfold f in |- *; simpl in |- *; unfold Rminus in |- *; - rewrite Rplus_opp_r; rewrite Rabs_R0; unfold fct_cte in |- *; + intros; unfold f; simpl; unfold Rminus; + rewrite Rplus_opp_r; rewrite Rabs_R0; unfold fct_cte; right; reflexivity. - unfold psi2 in |- *; rewrite StepFun_P18; rewrite Rmult_0_l; rewrite Rabs_R0; + unfold psi2; rewrite StepFun_P18; rewrite Rmult_0_l; rewrite Rabs_R0; apply (cond_pos (RinvN n)). - unfold Un_cv in |- *; intros; split with 0%nat; intros; unfold R_dist in |- *; - unfold phi2 in |- *; rewrite StepFun_P18; unfold Rminus in |- *; + unfold Un_cv; intros; split with 0%nat; intros; unfold R_dist; + unfold phi2; rewrite StepFun_P18; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply H. Qed. @@ -1563,9 +1563,9 @@ Lemma RiemannInt_P16 : forall (f:R -> R) (a b:R), Riemann_integrable f a b -> Riemann_integrable (fun x:R => Rabs (f x)) a b. Proof. - unfold Riemann_integrable in |- *; intro f; intros; elim (X eps); clear X; + unfold Riemann_integrable; intro f; intros; elim (X eps); clear X; intros phi [psi [H H0]]; split with (mkStepFun (StepFun_P32 phi)); - split with psi; split; try assumption; intros; simpl in |- *; + split with psi; split; try assumption; intros; simpl; apply Rle_trans with (Rabs (f t - phi t)); [ apply Rabs_triang_inv2 | apply H; assumption ]. Qed. @@ -1579,9 +1579,9 @@ Proof. assert (H2 : l2 < l1). auto with real. clear n; assert (H3 : 0 < (l1 - l2) / 2). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply Rlt_Rminus; assumption | apply Rinv_0_lt_compat; prove_sup0 ]. - elim (H1 _ H3); elim (H0 _ H3); clear H0 H1; unfold R_dist in |- *; intros; + elim (H1 _ H3); elim (H0 _ H3); clear H0 H1; unfold R_dist; intros; set (N := max x x0); cut (Vn N < Un N). intro; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ (H N) H4)). apply Rlt_trans with ((l1 + l2) / 2). @@ -1589,9 +1589,9 @@ Proof. replace (- l2 + (l1 + l2) / 2) with ((l1 - l2) / 2). rewrite Rplus_comm; apply Rle_lt_trans with (Rabs (Vn N - l2)). apply RRle_abs. - apply H1; unfold ge in |- *; unfold N in |- *; apply le_max_r. + apply H1; unfold ge; unfold N; apply le_max_r. apply Rmult_eq_reg_l with 2; - [ unfold Rdiv in |- *; do 2 rewrite (Rmult_comm 2); + [ unfold Rdiv; do 2 rewrite (Rmult_comm 2); rewrite (Rmult_plus_distr_r (- l2) ((l1 + l2) * / 2) 2); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | discrR ] @@ -1600,9 +1600,9 @@ Proof. replace (l1 + - ((l1 + l2) / 2)) with ((l1 - l2) / 2). apply Rle_lt_trans with (Rabs (Un N - l1)). rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; apply RRle_abs. - apply H0; unfold ge in |- *; unfold N in |- *; apply le_max_l. + apply H0; unfold ge; unfold N; apply le_max_l. apply Rmult_eq_reg_l with 2; - [ unfold Rdiv in |- *; do 2 rewrite (Rmult_comm 2); + [ unfold Rdiv; do 2 rewrite (Rmult_comm 2); rewrite (Rmult_plus_distr_r l1 (- ((l1 + l2) * / 2)) 2); rewrite <- Ropp_mult_distr_l_reverse; repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | discrR ] @@ -1614,7 +1614,7 @@ Lemma RiemannInt_P17 : (pr2:Riemann_integrable (fun x:R => Rabs (f x)) a b), a <= b -> Rabs (RiemannInt pr1) <= RiemannInt pr2. Proof. - intro f; intros; unfold RiemannInt in |- *; + intro f; intros; unfold RiemannInt; case (RiemannInt_exists pr1 RinvN RinvN_cv); case (RiemannInt_exists pr2 RinvN RinvN_cv); intros; set (phi1 := phi_sequence RinvN pr1) in u0; @@ -1622,7 +1622,7 @@ Proof. apply Rle_cv_lim with (fun N:nat => Rabs (RiemannInt_SF (phi1 N))) (fun N:nat => RiemannInt_SF (phi2 N)). - intro; unfold phi2 in |- *; apply StepFun_P34; assumption. + intro; unfold phi2; apply StepFun_P34; assumption. apply (continuity_seq Rabs (fun N:nat => RiemannInt_SF (phi1 N)) x0); try assumption. apply Rcontinuity_abs. @@ -1656,7 +1656,7 @@ Proof. apply (proj2_sig (phi_sequence_prop RinvN pr1 n)). elim H1; clear H1; intros psi2 H1; split with psi2; intros; elim (H1 n); clear H1; intros; split; try assumption. - intros; unfold phi2 in |- *; simpl in |- *; + intros; unfold phi2; simpl; apply Rle_trans with (Rabs (f t - phi1 n t)). apply Rabs_triang_inv2. apply H1; assumption. @@ -1671,13 +1671,13 @@ Lemma RiemannInt_P18 : a <= b -> (forall x:R, a < x < b -> f x = g x) -> RiemannInt pr1 = RiemannInt pr2. Proof. - intro f; intros; unfold RiemannInt in |- *; + intro f; intros; unfold RiemannInt; case (RiemannInt_exists pr1 RinvN RinvN_cv); case (RiemannInt_exists pr2 RinvN RinvN_cv); intros; eapply UL_sequence. apply u0. set (phi1 := fun N:nat => phi_sequence RinvN pr1 N); - change (Un_cv (fun N:nat => RiemannInt_SF (phi1 N)) x) in |- *; + change (Un_cv (fun N:nat => RiemannInt_SF (phi1 N)) x); assert (H1 : exists psi1 : nat -> StepFun a b, @@ -1717,45 +1717,45 @@ Proof. try assumption. apply RinvN_cv. intro; elim (H2 n); intros; split; try assumption. - intros; unfold phi2_m in |- *; simpl in |- *; unfold phi2_aux in |- *; + intros; unfold phi2_m; simpl; unfold phi2_aux; case (Req_EM_T t a); case (Req_EM_T t b); intros. - rewrite e0; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + rewrite e0; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply Rle_trans with (Rabs (g t - phi2 n t)). apply Rabs_pos. - pattern a at 3 in |- *; rewrite <- e0; apply H3; assumption. - rewrite e; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + pattern a at 3; rewrite <- e0; apply H3; assumption. + rewrite e; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply Rle_trans with (Rabs (g t - phi2 n t)). apply Rabs_pos. - pattern a at 3 in |- *; rewrite <- e; apply H3; assumption. - rewrite e; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + pattern a at 3; rewrite <- e; apply H3; assumption. + rewrite e; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply Rle_trans with (Rabs (g t - phi2 n t)). apply Rabs_pos. - pattern b at 3 in |- *; rewrite <- e; apply H3; assumption. + pattern b at 3; rewrite <- e; apply H3; assumption. replace (f t) with (g t). apply H3; assumption. - symmetry in |- *; apply H0; elim H5; clear H5; intros. + symmetry ; apply H0; elim H5; clear H5; intros. assert (H7 : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n2; assumption ]. assert (H8 : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n2; assumption ]. rewrite H7 in H5; rewrite H8 in H6; split. - elim H5; intro; [ assumption | elim n1; symmetry in |- *; assumption ]. + elim H5; intro; [ assumption | elim n1; symmetry ; assumption ]. elim H6; intro; [ assumption | elim n0; assumption ]. cut (forall N:nat, RiemannInt_SF (phi2_m N) = RiemannInt_SF (phi2 N)). - intro; unfold Un_cv in |- *; intros; elim (u _ H4); intros; exists x1; intros; + intro; unfold Un_cv; intros; elim (u _ H4); intros; exists x1; intros; rewrite (H3 n); apply H5; assumption. intro; apply Rle_antisym. apply StepFun_P37; try assumption. - intros; unfold phi2_m in |- *; simpl in |- *; unfold phi2_aux in |- *; + intros; unfold phi2_m; simpl; unfold phi2_aux; case (Req_EM_T x1 a); case (Req_EM_T x1 b); intros. elim H3; intros; rewrite e0 in H4; elim (Rlt_irrefl _ H4). elim H3; intros; rewrite e in H4; elim (Rlt_irrefl _ H4). elim H3; intros; rewrite e in H5; elim (Rlt_irrefl _ H5). right; reflexivity. apply StepFun_P37; try assumption. - intros; unfold phi2_m in |- *; simpl in |- *; unfold phi2_aux in |- *; + intros; unfold phi2_m; simpl; unfold phi2_aux; case (Req_EM_T x1 a); case (Req_EM_T x1 b); intros. elim H3; intros; rewrite e0 in H4; elim (Rlt_irrefl _ H4). elim H3; intros; rewrite e in H4; elim (Rlt_irrefl _ H4). @@ -1764,10 +1764,10 @@ Proof. intro; assert (H2 := pre (phi2 N)); unfold IsStepFun in H2; unfold is_subdivision in H2; elim H2; clear H2; intros l [lf H2]; split with l; split with lf; unfold adapted_couple in H2; - decompose [and] H2; clear H2; unfold adapted_couple in |- *; + decompose [and] H2; clear H2; unfold adapted_couple; repeat split; try assumption. intros; assert (H9 := H8 i H2); unfold constant_D_eq, open_interval in H9; - unfold constant_D_eq, open_interval in |- *; intros; + unfold constant_D_eq, open_interval; intros; rewrite <- (H9 x1 H7); assert (H10 : a <= pos_Rl l i). replace a with (Rmin a b). rewrite <- H5; elim (RList_P6 l); intros; apply H10. @@ -1775,7 +1775,7 @@ Proof. apply le_O_n. apply lt_trans with (pred (Rlength l)); [ assumption | apply lt_pred_n_n ]. apply neq_O_lt; intro; rewrite <- H12 in H6; discriminate. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. assert (H11 : pos_Rl l (S i) <= b). replace b with (Rmax a b). @@ -1783,9 +1783,9 @@ Proof. assumption. apply lt_le_S; assumption. apply lt_pred_n_n; apply neq_O_lt; intro; rewrite <- H13 in H6; discriminate. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. - elim H7; clear H7; intros; unfold phi2_aux in |- *; case (Req_EM_T x1 a); + elim H7; clear H7; intros; unfold phi2_aux; case (Req_EM_T x1 a); case (Req_EM_T x1 b); intros. rewrite e in H12; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H11 H12)). rewrite e in H7; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H10 H7)). @@ -1852,12 +1852,12 @@ Proof. intros; replace (primitive h pr a) with 0. replace (RiemannInt pr0) with (primitive h pr b). ring. - unfold primitive in |- *; case (Rle_dec a b); case (Rle_dec b b); intros; + unfold primitive; case (Rle_dec a b); case (Rle_dec b b); intros; [ apply RiemannInt_P5 | elim n; right; reflexivity | elim n; assumption | elim n0; assumption ]. - symmetry in |- *; unfold primitive in |- *; case (Rle_dec a a); + symmetry ; unfold primitive; case (Rle_dec a a); case (Rle_dec a b); intros; [ apply RiemannInt_P9 | elim n; assumption @@ -1872,9 +1872,9 @@ Lemma RiemannInt_P21 : Riemann_integrable f a b -> Riemann_integrable f b c -> Riemann_integrable f a c. Proof. - unfold Riemann_integrable in |- *; intros f a b c Hyp1 Hyp2 X X0 eps. + unfold Riemann_integrable; intros f a b c Hyp1 Hyp2 X X0 eps. assert (H : 0 < eps / 2). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos eps) | apply Rinv_0_lt_compat; prove_sup0 ]. elim (X (mkposreal _ H)); clear X; intros phi1 [psi1 H1]; elim (X0 (mkposreal _ H)); clear X0; intros phi2 [psi2 H2]. @@ -1904,35 +1904,35 @@ Proof. intro; cut (IsStepFun psi3 a b). intro; cut (IsStepFun psi3 b c). intro; cut (IsStepFun psi3 a c). - intro; split with (mkStepFun X); split with (mkStepFun X2); simpl in |- *; + intro; split with (mkStepFun X); split with (mkStepFun X2); simpl; split. - intros; unfold phi3, psi3 in |- *; case (Rle_dec t b); case (Rle_dec a t); + intros; unfold phi3, psi3; case (Rle_dec t b); case (Rle_dec a t); intros. elim H1; intros; apply H3. replace (Rmin a b) with a. replace (Rmax a b) with b. split; assumption. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. elim n; replace a with (Rmin a c). elim H0; intros; assumption. - unfold Rmin in |- *; case (Rle_dec a c); intro; + unfold Rmin; case (Rle_dec a c); intro; [ reflexivity | elim n0; apply Rle_trans with b; assumption ]. elim H2; intros; apply H3. replace (Rmax b c) with (Rmax a c). elim H0; intros; split; try assumption. replace (Rmin b c) with b. auto with real. - unfold Rmin in |- *; case (Rle_dec b c); intro; + unfold Rmin; case (Rle_dec b c); intro; [ reflexivity | elim n0; assumption ]. - unfold Rmax in |- *; case (Rle_dec a c); case (Rle_dec b c); intros; + unfold Rmax; case (Rle_dec a c); case (Rle_dec b c); intros; try (elim n0; assumption || elim n0; apply Rle_trans with b; assumption). reflexivity. elim n; replace a with (Rmin a c). elim H0; intros; assumption. - unfold Rmin in |- *; case (Rle_dec a c); intro; + unfold Rmin; case (Rle_dec a c); intro; [ reflexivity | elim n1; apply Rle_trans with b; assumption ]. rewrite <- (StepFun_P43 X0 X1 X2). apply Rle_lt_trans with @@ -1946,14 +1946,14 @@ Proof. elim H2; intros; assumption. apply Rle_antisym. apply StepFun_P37; try assumption. - simpl in |- *; intros; unfold psi3 in |- *; elim H0; clear H0; intros; + simpl; intros; unfold psi3; elim H0; clear H0; intros; case (Rle_dec a x); case (Rle_dec x b); intros; [ elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r H0)) | right; reflexivity | elim n; apply Rle_trans with b; [ assumption | left; assumption ] | elim n0; apply Rle_trans with b; [ assumption | left; assumption ] ]. apply StepFun_P37; try assumption. - simpl in |- *; intros; unfold psi3 in |- *; elim H0; clear H0; intros; + simpl; intros; unfold psi3; elim H0; clear H0; intros; case (Rle_dec a x); case (Rle_dec x b); intros; [ elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r H0)) | right; reflexivity @@ -1961,14 +1961,14 @@ Proof. | elim n0; apply Rle_trans with b; [ assumption | left; assumption ] ]. apply Rle_antisym. apply StepFun_P37; try assumption. - simpl in |- *; intros; unfold psi3 in |- *; elim H0; clear H0; intros; + simpl; intros; unfold psi3; elim H0; clear H0; intros; case (Rle_dec a x); case (Rle_dec x b); intros; [ right; reflexivity | elim n; left; assumption | elim n; left; assumption | elim n0; left; assumption ]. apply StepFun_P37; try assumption. - simpl in |- *; intros; unfold psi3 in |- *; elim H0; clear H0; intros; + simpl; intros; unfold psi3; elim H0; clear H0; intros; case (Rle_dec a x); case (Rle_dec x b); intros; [ right; reflexivity | elim n; left; assumption @@ -1978,19 +1978,19 @@ Proof. assert (H3 := pre psi2); unfold IsStepFun in H3; unfold is_subdivision in H3; elim H3; clear H3; intros l1 [lf1 H3]; split with l1; split with lf1; unfold adapted_couple in H3; decompose [and] H3; - clear H3; unfold adapted_couple in |- *; repeat split; + clear H3; unfold adapted_couple; repeat split; try assumption. - intros; assert (H9 := H8 i H3); unfold constant_D_eq, open_interval in |- *; + intros; assert (H9 := H8 i H3); unfold constant_D_eq, open_interval; unfold constant_D_eq, open_interval in H9; intros; - rewrite <- (H9 x H7); unfold psi3 in |- *; assert (H10 : b < x). + rewrite <- (H9 x H7); unfold psi3; assert (H10 : b < x). apply Rle_lt_trans with (pos_Rl l1 i). replace b with (Rmin b c). rewrite <- H5; elim (RList_P6 l1); intros; apply H10; try assumption. apply le_O_n. apply lt_trans with (pred (Rlength l1)); try assumption; apply lt_pred_n_n; - apply neq_O_lt; red in |- *; intro; rewrite <- H12 in H6; + apply neq_O_lt; red; intro; rewrite <- H12 in H6; discriminate. - unfold Rmin in |- *; case (Rle_dec b c); intro; + unfold Rmin; case (Rle_dec b c); intro; [ reflexivity | elim n; assumption ]. elim H7; intros; assumption. case (Rle_dec a x); case (Rle_dec x b); intros; @@ -2001,18 +2001,18 @@ Proof. assert (H3 := pre psi1); unfold IsStepFun in H3; unfold is_subdivision in H3; elim H3; clear H3; intros l1 [lf1 H3]; split with l1; split with lf1; unfold adapted_couple in H3; decompose [and] H3; - clear H3; unfold adapted_couple in |- *; repeat split; + clear H3; unfold adapted_couple; repeat split; try assumption. - intros; assert (H9 := H8 i H3); unfold constant_D_eq, open_interval in |- *; + intros; assert (H9 := H8 i H3); unfold constant_D_eq, open_interval; unfold constant_D_eq, open_interval in H9; intros; - rewrite <- (H9 x H7); unfold psi3 in |- *; assert (H10 : x <= b). + rewrite <- (H9 x H7); unfold psi3; assert (H10 : x <= b). apply Rle_trans with (pos_Rl l1 (S i)). elim H7; intros; left; assumption. replace b with (Rmax a b). rewrite <- H4; elim (RList_P6 l1); intros; apply H10; try assumption. - apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H12 in H6; + apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H12 in H6; discriminate. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. assert (H11 : a <= x). apply Rle_trans with (pos_Rl l1 i). @@ -2020,9 +2020,9 @@ Proof. rewrite <- H5; elim (RList_P6 l1); intros; apply H11; try assumption. apply le_O_n. apply lt_trans with (pred (Rlength l1)); try assumption; apply lt_pred_n_n; - apply neq_O_lt; red in |- *; intro; rewrite <- H13 in H6; + apply neq_O_lt; red; intro; rewrite <- H13 in H6; discriminate. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. left; elim H7; intros; assumption. case (Rle_dec a x); case (Rle_dec x b); intros; reflexivity || elim n; @@ -2031,18 +2031,18 @@ Proof. assert (H3 := pre phi1); unfold IsStepFun in H3; unfold is_subdivision in H3; elim H3; clear H3; intros l1 [lf1 H3]; split with l1; split with lf1; unfold adapted_couple in H3; decompose [and] H3; - clear H3; unfold adapted_couple in |- *; repeat split; + clear H3; unfold adapted_couple; repeat split; try assumption. - intros; assert (H9 := H8 i H3); unfold constant_D_eq, open_interval in |- *; + intros; assert (H9 := H8 i H3); unfold constant_D_eq, open_interval; unfold constant_D_eq, open_interval in H9; intros; - rewrite <- (H9 x H7); unfold psi3 in |- *; assert (H10 : x <= b). + rewrite <- (H9 x H7); unfold psi3; assert (H10 : x <= b). apply Rle_trans with (pos_Rl l1 (S i)). elim H7; intros; left; assumption. replace b with (Rmax a b). rewrite <- H4; elim (RList_P6 l1); intros; apply H10; try assumption. - apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H12 in H6; + apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H12 in H6; discriminate. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. assert (H11 : a <= x). apply Rle_trans with (pos_Rl l1 i). @@ -2050,32 +2050,32 @@ Proof. rewrite <- H5; elim (RList_P6 l1); intros; apply H11; try assumption. apply le_O_n. apply lt_trans with (pred (Rlength l1)); try assumption; apply lt_pred_n_n; - apply neq_O_lt; red in |- *; intro; rewrite <- H13 in H6; + apply neq_O_lt; red; intro; rewrite <- H13 in H6; discriminate. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. left; elim H7; intros; assumption. - unfold phi3 in |- *; case (Rle_dec a x); case (Rle_dec x b); intros; + unfold phi3; case (Rle_dec a x); case (Rle_dec x b); intros; reflexivity || elim n; assumption. assert (H3 := pre phi2); unfold IsStepFun in H3; unfold is_subdivision in H3; elim H3; clear H3; intros l1 [lf1 H3]; split with l1; split with lf1; unfold adapted_couple in H3; decompose [and] H3; - clear H3; unfold adapted_couple in |- *; repeat split; + clear H3; unfold adapted_couple; repeat split; try assumption. - intros; assert (H9 := H8 i H3); unfold constant_D_eq, open_interval in |- *; + intros; assert (H9 := H8 i H3); unfold constant_D_eq, open_interval; unfold constant_D_eq, open_interval in H9; intros; - rewrite <- (H9 x H7); unfold psi3 in |- *; assert (H10 : b < x). + rewrite <- (H9 x H7); unfold psi3; assert (H10 : b < x). apply Rle_lt_trans with (pos_Rl l1 i). replace b with (Rmin b c). rewrite <- H5; elim (RList_P6 l1); intros; apply H10; try assumption. apply le_O_n. apply lt_trans with (pred (Rlength l1)); try assumption; apply lt_pred_n_n; - apply neq_O_lt; red in |- *; intro; rewrite <- H12 in H6; + apply neq_O_lt; red; intro; rewrite <- H12 in H6; discriminate. - unfold Rmin in |- *; case (Rle_dec b c); intro; + unfold Rmin; case (Rle_dec b c); intro; [ reflexivity | elim n; assumption ]. elim H7; intros; assumption. - unfold phi3 in |- *; case (Rle_dec a x); case (Rle_dec x b); intros; + unfold phi3; case (Rle_dec a x); case (Rle_dec x b); intros; [ elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r H10)) | reflexivity | elim n; apply Rle_trans with b; [ assumption | left; assumption ] @@ -2086,7 +2086,7 @@ Lemma RiemannInt_P22 : forall (f:R -> R) (a b c:R), Riemann_integrable f a b -> a <= c <= b -> Riemann_integrable f a c. Proof. - unfold Riemann_integrable in |- *; intros; elim (X eps); clear X; + unfold Riemann_integrable; intros; elim (X eps); clear X; intros phi [psi H0]; elim H; elim H0; clear H H0; intros; assert (H3 : IsStepFun phi a c). apply StepFun_P44 with b. @@ -2097,18 +2097,18 @@ Proof. apply (pre psi). split; assumption. split with (mkStepFun H3); split with (mkStepFun H4); split. - simpl in |- *; intros; apply H. + simpl; intros; apply H. replace (Rmin a b) with (Rmin a c). elim H5; intros; split; try assumption. apply Rle_trans with (Rmax a c); try assumption. replace (Rmax a b) with b. replace (Rmax a c) with c. assumption. - unfold Rmax in |- *; case (Rle_dec a c); intro; + unfold Rmax; case (Rle_dec a c); intro; [ reflexivity | elim n; assumption ]. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; apply Rle_trans with c; assumption ]. - unfold Rmin in |- *; case (Rle_dec a c); case (Rle_dec a b); intros; + unfold Rmin; case (Rle_dec a c); case (Rle_dec a b); intros; [ reflexivity | elim n; apply Rle_trans with c; assumption | elim n; assumption @@ -2121,12 +2121,12 @@ Proof. replace (RiemannInt_SF (mkStepFun H4)) with (RiemannInt_SF psi - RiemannInt_SF (mkStepFun H5)). apply Rle_lt_trans with (RiemannInt_SF psi). - unfold Rminus in |- *; pattern (RiemannInt_SF psi) at 2 in |- *; + unfold Rminus; pattern (RiemannInt_SF psi) at 2; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; rewrite <- Ropp_0; apply Ropp_ge_le_contravar; apply Rle_ge; replace 0 with (RiemannInt_SF (mkStepFun (StepFun_P4 c b 0))). apply StepFun_P37; try assumption. - intros; simpl in |- *; unfold fct_cte in |- *; + intros; simpl; unfold fct_cte; apply Rle_trans with (Rabs (f x - phi x)). apply Rabs_pos. apply H. @@ -2135,9 +2135,9 @@ Proof. elim H6; intros; split; left. apply Rle_lt_trans with c; assumption. assumption. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; apply Rle_trans with c; assumption ]. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; apply Rle_trans with c; assumption ]. rewrite StepFun_P18; ring. apply Rle_lt_trans with (Rabs (RiemannInt_SF psi)). @@ -2147,16 +2147,16 @@ Proof. apply (pre psi). replace (RiemannInt_SF psi) with (RiemannInt_SF (mkStepFun H6)). rewrite <- (StepFun_P43 H4 H5 H6); ring. - unfold RiemannInt_SF in |- *; case (Rle_dec a b); intro. + unfold RiemannInt_SF; case (Rle_dec a b); intro. eapply StepFun_P17. apply StepFun_P1. - simpl in |- *; apply StepFun_P1. + simpl; apply StepFun_P1. apply Ropp_eq_compat; eapply StepFun_P17. apply StepFun_P1. - simpl in |- *; apply StepFun_P1. + simpl; apply StepFun_P1. apply Rle_ge; replace 0 with (RiemannInt_SF (mkStepFun (StepFun_P4 a c 0))). apply StepFun_P37; try assumption. - intros; simpl in |- *; unfold fct_cte in |- *; + intros; simpl; unfold fct_cte; apply Rle_trans with (Rabs (f x - phi x)). apply Rabs_pos. apply H. @@ -2165,9 +2165,9 @@ Proof. elim H5; intros; split; left. assumption. apply Rlt_le_trans with c; assumption. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; apply Rle_trans with c; assumption ]. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; apply Rle_trans with c; assumption ]. rewrite StepFun_P18; ring. Qed. @@ -2176,7 +2176,7 @@ Lemma RiemannInt_P23 : forall (f:R -> R) (a b c:R), Riemann_integrable f a b -> a <= c <= b -> Riemann_integrable f c b. Proof. - unfold Riemann_integrable in |- *; intros; elim (X eps); clear X; + unfold Riemann_integrable; intros; elim (X eps); clear X; intros phi [psi H0]; elim H; elim H0; clear H H0; intros; assert (H3 : IsStepFun phi c b). apply StepFun_P45 with a. @@ -2187,18 +2187,18 @@ Proof. apply (pre psi). split; assumption. split with (mkStepFun H3); split with (mkStepFun H4); split. - simpl in |- *; intros; apply H. + simpl; intros; apply H. replace (Rmax a b) with (Rmax c b). elim H5; intros; split; try assumption. apply Rle_trans with (Rmin c b); try assumption. replace (Rmin a b) with a. replace (Rmin c b) with c. assumption. - unfold Rmin in |- *; case (Rle_dec c b); intro; + unfold Rmin; case (Rle_dec c b); intro; [ reflexivity | elim n; assumption ]. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; apply Rle_trans with c; assumption ]. - unfold Rmax in |- *; case (Rle_dec c b); case (Rle_dec a b); intros; + unfold Rmax; case (Rle_dec c b); case (Rle_dec a b); intros; [ reflexivity | elim n; apply Rle_trans with c; assumption | elim n; assumption @@ -2211,12 +2211,12 @@ Proof. replace (RiemannInt_SF (mkStepFun H4)) with (RiemannInt_SF psi - RiemannInt_SF (mkStepFun H5)). apply Rle_lt_trans with (RiemannInt_SF psi). - unfold Rminus in |- *; pattern (RiemannInt_SF psi) at 2 in |- *; + unfold Rminus; pattern (RiemannInt_SF psi) at 2; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; rewrite <- Ropp_0; apply Ropp_ge_le_contravar; apply Rle_ge; replace 0 with (RiemannInt_SF (mkStepFun (StepFun_P4 a c 0))). apply StepFun_P37; try assumption. - intros; simpl in |- *; unfold fct_cte in |- *; + intros; simpl; unfold fct_cte; apply Rle_trans with (Rabs (f x - phi x)). apply Rabs_pos. apply H. @@ -2225,9 +2225,9 @@ Proof. elim H6; intros; split; left. assumption. apply Rlt_le_trans with c; assumption. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; apply Rle_trans with c; assumption ]. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; apply Rle_trans with c; assumption ]. rewrite StepFun_P18; ring. apply Rle_lt_trans with (Rabs (RiemannInt_SF psi)). @@ -2237,16 +2237,16 @@ Proof. apply (pre psi). replace (RiemannInt_SF psi) with (RiemannInt_SF (mkStepFun H6)). rewrite <- (StepFun_P43 H5 H4 H6); ring. - unfold RiemannInt_SF in |- *; case (Rle_dec a b); intro. + unfold RiemannInt_SF; case (Rle_dec a b); intro. eapply StepFun_P17. apply StepFun_P1. - simpl in |- *; apply StepFun_P1. + simpl; apply StepFun_P1. apply Ropp_eq_compat; eapply StepFun_P17. apply StepFun_P1. - simpl in |- *; apply StepFun_P1. + simpl; apply StepFun_P1. apply Rle_ge; replace 0 with (RiemannInt_SF (mkStepFun (StepFun_P4 c b 0))). apply StepFun_P37; try assumption. - intros; simpl in |- *; unfold fct_cte in |- *; + intros; simpl; unfold fct_cte; apply Rle_trans with (Rabs (f x - phi x)). apply Rabs_pos. apply H. @@ -2255,9 +2255,9 @@ Proof. elim H5; intros; split; left. apply Rle_lt_trans with c; assumption. assumption. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; apply Rle_trans with c; assumption ]. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; apply Rle_trans with c; assumption ]. rewrite StepFun_P18; ring. Qed. @@ -2290,14 +2290,14 @@ Lemma RiemannInt_P25 : (pr2:Riemann_integrable f b c) (pr3:Riemann_integrable f a c), a <= b -> b <= c -> RiemannInt pr1 + RiemannInt pr2 = RiemannInt pr3. Proof. - intros f a b c pr1 pr2 pr3 Hyp1 Hyp2; unfold RiemannInt in |- *; + intros f a b c pr1 pr2 pr3 Hyp1 Hyp2; unfold RiemannInt; case (RiemannInt_exists pr1 RinvN RinvN_cv); case (RiemannInt_exists pr2 RinvN RinvN_cv); case (RiemannInt_exists pr3 RinvN RinvN_cv); intros; - symmetry in |- *; eapply UL_sequence. + symmetry ; eapply UL_sequence. apply u. - unfold Un_cv in |- *; intros; assert (H0 : 0 < eps / 3). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Un_cv; intros; assert (H0 : 0 < eps / 3). + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. elim (u1 _ H0); clear u1; intros N1 H1; elim (u0 _ H0); clear u0; intros N2 H2; @@ -2309,7 +2309,7 @@ Proof. RiemannInt_SF (phi_sequence RinvN pr2 n))) 0). intro; elim (H3 _ H0); clear H3; intros N3 H3; set (N0 := max (max N1 N2) N3); exists N0; intros; - unfold R_dist in |- *; + unfold R_dist; apply Rle_lt_trans with (Rabs (RiemannInt_SF (phi_sequence RinvN pr3 n) - @@ -2330,8 +2330,8 @@ Proof. unfold R_dist in H3; cut (n >= N3)%nat. intro; assert (H6 := H3 _ H5); unfold Rminus in H6; rewrite Ropp_0 in H6; rewrite Rplus_0_r in H6; apply H6. - unfold ge in |- *; apply le_trans with N0; - [ unfold N0 in |- *; apply le_max_r | assumption ]. + unfold ge; apply le_trans with N0; + [ unfold N0; apply le_max_r | assumption ]. apply Rle_lt_trans with (Rabs (RiemannInt_SF (phi_sequence RinvN pr1 n) - x1) + Rabs (RiemannInt_SF (phi_sequence RinvN pr2 n) - x0)). @@ -2343,17 +2343,17 @@ Proof. [ apply Rabs_triang | ring ]. apply Rplus_lt_compat. unfold R_dist in H1; apply H1. - unfold ge in |- *; apply le_trans with N0; + unfold ge; apply le_trans with N0; [ apply le_trans with (max N1 N2); - [ apply le_max_l | unfold N0 in |- *; apply le_max_l ] + [ apply le_max_l | unfold N0; apply le_max_l ] | assumption ]. unfold R_dist in H2; apply H2. - unfold ge in |- *; apply le_trans with N0; + unfold ge; apply le_trans with N0; [ apply le_trans with (max N1 N2); - [ apply le_max_r | unfold N0 in |- *; apply le_max_l ] + [ apply le_max_r | unfold N0; apply le_max_l ] | assumption ]. apply Rmult_eq_reg_l with 3; - [ unfold Rdiv in |- *; repeat rewrite Rmult_plus_distr_l; + [ unfold Rdiv; repeat rewrite Rmult_plus_distr_l; do 2 rewrite (Rmult_comm 3); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | discrR ] | discrR ]. @@ -2390,8 +2390,8 @@ Proof. apply (proj2_sig (phi_sequence_prop RinvN pr3 n)). elim H1; clear H1; intros psi1 H1; elim H2; clear H2; intros psi2 H2; elim H3; clear H3; intros psi3 H3; assert (H := RinvN_cv); - unfold Un_cv in |- *; intros; assert (H4 : 0 < eps / 3). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Un_cv; intros; assert (H4 : 0 < eps / 3). + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. elim (H _ H4); clear H; intros N0 H; assert (H5 : forall n:nat, (n >= N0)%nat -> RinvN n < eps / 3). @@ -2399,11 +2399,11 @@ Proof. replace (pos (RinvN n)) with (R_dist (mkposreal (/ (INR n + 1)) (RinvN_pos n)) 0). apply H; assumption. - unfold R_dist in |- *; unfold Rminus in |- *; rewrite Ropp_0; + unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rabs_right; apply Rle_ge; left; apply (cond_pos (RinvN n)). exists N0; intros; elim (H1 n); elim (H2 n); elim (H3 n); clear H1 H2 H3; - intros; unfold R_dist in |- *; unfold Rminus in |- *; + intros; unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; set (phi1 := phi_sequence RinvN pr1 n) in H8 |- *; set (phi2 := phi_sequence RinvN pr2 n) in H3 |- *; @@ -2469,7 +2469,7 @@ Proof. (StepFun_P32 (mkStepFun (StepFun_P28 (-1) (mkStepFun H10) phi1)))) + RiemannInt_SF (mkStepFun (StepFun_P28 1 (mkStepFun H13) (psi2 n)))). apply Rplus_le_compat_l; apply StepFun_P37; try assumption. - intros; simpl in |- *; rewrite Rmult_1_l; + intros; simpl; rewrite Rmult_1_l; apply Rle_trans with (Rabs (f x - phi3 x) + Rabs (f x - phi2 x)). rewrite <- (Rabs_Ropp (f x - phi3 x)); rewrite Ropp_minus_distr; replace (phi3 x + -1 * phi2 x) with (phi3 x - f x + (f x - phi2 x)); @@ -2480,28 +2480,28 @@ Proof. replace (Rmin a c) with a. apply Rle_trans with b; try assumption. left; assumption. - unfold Rmin in |- *; case (Rle_dec a c); intro; + unfold Rmin; case (Rle_dec a c); intro; [ reflexivity | elim n0; apply Rle_trans with b; assumption ]. replace (Rmax a c) with c. left; assumption. - unfold Rmax in |- *; case (Rle_dec a c); intro; + unfold Rmax; case (Rle_dec a c); intro; [ reflexivity | elim n0; apply Rle_trans with b; assumption ]. apply H3. elim H14; intros; split. replace (Rmin b c) with b. left; assumption. - unfold Rmin in |- *; case (Rle_dec b c); intro; + unfold Rmin; case (Rle_dec b c); intro; [ reflexivity | elim n0; assumption ]. replace (Rmax b c) with c. left; assumption. - unfold Rmax in |- *; case (Rle_dec b c); intro; + unfold Rmax; case (Rle_dec b c); intro; [ reflexivity | elim n0; assumption ]. do 2 rewrite <- (Rplus_comm (RiemannInt_SF (mkStepFun (StepFun_P28 1 (mkStepFun H13) (psi2 n))))) ; apply Rplus_le_compat_l; apply StepFun_P37; try assumption. - intros; simpl in |- *; rewrite Rmult_1_l; + intros; simpl; rewrite Rmult_1_l; apply Rle_trans with (Rabs (f x - phi3 x) + Rabs (f x - phi1 x)). rewrite <- (Rabs_Ropp (f x - phi3 x)); rewrite Ropp_minus_distr; replace (phi3 x + -1 * phi1 x) with (phi3 x - f x + (f x - phi1 x)); @@ -2511,23 +2511,23 @@ Proof. elim H14; intros; split. replace (Rmin a c) with a. left; assumption. - unfold Rmin in |- *; case (Rle_dec a c); intro; + unfold Rmin; case (Rle_dec a c); intro; [ reflexivity | elim n0; apply Rle_trans with b; assumption ]. replace (Rmax a c) with c. apply Rle_trans with b. left; assumption. assumption. - unfold Rmax in |- *; case (Rle_dec a c); intro; + unfold Rmax; case (Rle_dec a c); intro; [ reflexivity | elim n0; apply Rle_trans with b; assumption ]. apply H8. elim H14; intros; split. replace (Rmin a b) with a. left; assumption. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. replace (Rmax a b) with b. left; assumption. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n0; assumption ]. do 2 rewrite StepFun_P30. do 2 rewrite Rmult_1_l; @@ -2553,7 +2553,7 @@ Proof. assumption. apply H5; assumption. apply Rmult_eq_reg_l with 3; - [ unfold Rdiv in |- *; repeat rewrite Rmult_plus_distr_l; + [ unfold Rdiv; repeat rewrite Rmult_plus_distr_l; do 2 rewrite (Rmult_comm 3); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | discrR ] | discrR ]. @@ -2608,13 +2608,13 @@ Lemma RiemannInt_P27 : Proof. intro f; intros; elim H; clear H; intros; assert (H1 : continuity_pt f x). apply C0; split; left; assumption. - unfold derivable_pt_lim in |- *; intros; assert (Hyp : 0 < eps / 2). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold derivable_pt_lim; intros; assert (Hyp : 0 < eps / 2). + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. - elim (H1 _ Hyp); unfold dist, D_x, no_cond in |- *; simpl in |- *; - unfold R_dist in |- *; intros; set (del := Rmin x0 (Rmin (b - x) (x - a))); + elim (H1 _ Hyp); unfold dist, D_x, no_cond; simpl; + unfold R_dist; intros; set (del := Rmin x0 (Rmin (b - x) (x - a))); assert (H4 : 0 < del). - unfold del in |- *; unfold Rmin in |- *; case (Rle_dec (b - x) (x - a)); + unfold del; unfold Rmin; case (Rle_dec (b - x) (x - a)); intro. case (Rle_dec x0 (b - x)); intro; [ elim H3; intros; assumption | apply Rlt_Rminus; assumption ]. @@ -2631,22 +2631,22 @@ Proof. left; apply Rlt_le_trans with (x + del). apply Rplus_lt_compat_l; apply Rle_lt_trans with (Rabs h0); [ apply RRle_abs | apply H6 ]. - unfold del in |- *; apply Rle_trans with (x + Rmin (b - x) (x - a)). + unfold del; apply Rle_trans with (x + Rmin (b - x) (x - a)). apply Rplus_le_compat_l; apply Rmin_r. - pattern b at 2 in |- *; replace b with (x + (b - x)); + pattern b at 2; replace b with (x + (b - x)); [ apply Rplus_le_compat_l; apply Rmin_l | ring ]. apply RiemannInt_P1; apply continuity_implies_RiemannInt; auto with real. intros; apply C0; elim H7; intros; split. apply Rle_trans with (x + h0). left; apply Rle_lt_trans with (x - del). - unfold del in |- *; apply Rle_trans with (x - Rmin (b - x) (x - a)). - pattern a at 1 in |- *; replace a with (x + (a - x)); [ idtac | ring ]. - unfold Rminus in |- *; apply Rplus_le_compat_l; apply Ropp_le_cancel. + unfold del; apply Rle_trans with (x - Rmin (b - x) (x - a)). + pattern a at 1; replace a with (x + (a - x)); [ idtac | ring ]. + unfold Rminus; apply Rplus_le_compat_l; apply Ropp_le_cancel. rewrite Ropp_involutive; rewrite Ropp_plus_distr; rewrite Ropp_involutive; rewrite (Rplus_comm x); apply Rmin_r. - unfold Rminus in |- *; apply Rplus_le_compat_l; apply Ropp_le_cancel. + unfold Rminus; apply Rplus_le_compat_l; apply Ropp_le_cancel. do 2 rewrite Ropp_involutive; apply Rmin_r. - unfold Rminus in |- *; apply Rplus_lt_compat_l; apply Ropp_lt_cancel. + unfold Rminus; apply Rplus_lt_compat_l; apply Ropp_lt_cancel. rewrite Ropp_involutive; apply Rle_lt_trans with (Rabs h0); [ rewrite <- Rabs_Ropp; apply RRle_abs | apply H6 ]. assumption. @@ -2659,7 +2659,7 @@ Proof. with ((RiemannInt H7 - RiemannInt (RiemannInt_P14 x (x + h0) (f x))) / h0). replace (RiemannInt H7 - RiemannInt (RiemannInt_P14 x (x + h0) (f x))) with (RiemannInt (RiemannInt_P10 (-1) H7 (RiemannInt_P14 x (x + h0) (f x)))). - unfold Rdiv in |- *; rewrite Rabs_mult; case (Rle_dec x (x + h0)); intro. + unfold Rdiv; rewrite Rabs_mult; case (Rle_dec x (x + h0)); intro. apply Rle_lt_trans with (RiemannInt (RiemannInt_P16 @@ -2678,8 +2678,8 @@ Proof. apply Rabs_pos. apply RiemannInt_P19; try assumption. intros; replace (f x1 + -1 * fct_cte (f x) x1) with (f x1 - f x). - unfold fct_cte in |- *; case (Req_dec x x1); intro. - rewrite H9; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; left; + unfold fct_cte; case (Req_dec x x1); intro. + rewrite H9; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; left; assumption. elim H3; intros; left; apply H11. repeat split. @@ -2690,16 +2690,16 @@ Proof. elim H8; intros; assumption. apply Rplus_le_compat_l; apply Rle_trans with del. left; apply Rle_lt_trans with (Rabs h0); [ apply RRle_abs | assumption ]. - unfold del in |- *; apply Rmin_l. + unfold del; apply Rmin_l. apply Rge_minus; apply Rle_ge; left; elim H8; intros; assumption. - unfold fct_cte in |- *; ring. + unfold fct_cte; ring. rewrite RiemannInt_P15. rewrite Rmult_assoc; replace ((x + h0 - x) * Rabs (/ h0)) with 1. - rewrite Rmult_1_r; unfold Rdiv in |- *; apply Rmult_lt_reg_l with 2; + rewrite Rmult_1_r; unfold Rdiv; apply Rmult_lt_reg_l with 2; [ prove_sup0 | rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; - [ rewrite Rmult_1_l; pattern eps at 1 in |- *; rewrite <- Rplus_0_r; + [ rewrite Rmult_1_l; pattern eps at 1; rewrite <- Rplus_0_r; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. rewrite Rabs_right. @@ -2709,7 +2709,7 @@ Proof. apply Rle_ge; left; apply Rinv_0_lt_compat. elim r; intro. apply Rplus_lt_reg_r with x; rewrite Rplus_0_r; assumption. - elim H5; symmetry in |- *; apply Rplus_eq_reg_l with x; rewrite Rplus_0_r; + elim H5; symmetry ; apply Rplus_eq_reg_l with x; rewrite Rplus_0_r; assumption. apply Rle_lt_trans with (RiemannInt @@ -2733,7 +2733,7 @@ Proof. (RiemannInt_P1 (RiemannInt_P10 (-1) H7 (RiemannInt_P14 x (x + h0) (f x)))))); auto with real. - symmetry in |- *; apply RiemannInt_P8. + symmetry ; apply RiemannInt_P8. apply Rle_lt_trans with (RiemannInt (RiemannInt_P14 (x + h0) x (eps / 2)) * Rabs (/ h0)). do 2 rewrite <- (Rmult_comm (Rabs (/ h0))); apply Rmult_le_compat_l. @@ -2741,8 +2741,8 @@ Proof. apply RiemannInt_P19. auto with real. intros; replace (f x1 + -1 * fct_cte (f x) x1) with (f x1 - f x). - unfold fct_cte in |- *; case (Req_dec x x1); intro. - rewrite H9; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; left; + unfold fct_cte; case (Req_dec x x1); intro. + rewrite H9; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; left; assumption. elim H3; intros; left; apply H11. repeat split. @@ -2752,22 +2752,22 @@ Proof. [ idtac | ring ]. replace (x1 - x0 + - (x1 - x)) with (x - x0); [ idtac | ring ]. apply Rle_lt_trans with (x + h0). - unfold Rminus in |- *; apply Rplus_le_compat_l; apply Ropp_le_cancel. + unfold Rminus; apply Rplus_le_compat_l; apply Ropp_le_cancel. rewrite Ropp_involutive; apply Rle_trans with (Rabs h0). rewrite <- Rabs_Ropp; apply RRle_abs. apply Rle_trans with del; - [ left; assumption | unfold del in |- *; apply Rmin_l ]. + [ left; assumption | unfold del; apply Rmin_l ]. elim H8; intros; assumption. apply Rplus_lt_reg_r with x; rewrite Rplus_0_r; replace (x + (x1 - x)) with x1; [ elim H8; intros; assumption | ring ]. - unfold fct_cte in |- *; ring. + unfold fct_cte; ring. rewrite RiemannInt_P15. rewrite Rmult_assoc; replace ((x - (x + h0)) * Rabs (/ h0)) with 1. - rewrite Rmult_1_r; unfold Rdiv in |- *; apply Rmult_lt_reg_l with 2; + rewrite Rmult_1_r; unfold Rdiv; apply Rmult_lt_reg_l with 2; [ prove_sup0 | rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; - [ rewrite Rmult_1_l; pattern eps at 1 in |- *; rewrite <- Rplus_0_r; + [ rewrite Rmult_1_l; pattern eps at 1; rewrite <- Rplus_0_r; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. rewrite Rabs_left. @@ -2784,14 +2784,14 @@ Proof. (RiemannInt_P10 (-1) H7 (RiemannInt_P14 x (x + h0) (f x)))) . ring. - unfold Rdiv, Rminus in |- *; rewrite Rmult_plus_distr_r; ring. + unfold Rdiv, Rminus; rewrite Rmult_plus_distr_r; ring. rewrite RiemannInt_P15; apply Rmult_eq_reg_l with h0; - [ unfold Rdiv in |- *; rewrite (Rmult_comm h0); repeat rewrite Rmult_assoc; + [ unfold Rdiv; rewrite (Rmult_comm h0); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | assumption ] | assumption ]. cut (a <= x + h0). cut (x + h0 <= b). - intros; unfold primitive in |- *. + intros; unfold primitive. case (Rle_dec a (x + h0)); case (Rle_dec (x + h0) b); case (Rle_dec a x); case (Rle_dec x b); intros; try (elim n; assumption || left; assumption). rewrite <- (RiemannInt_P26 (FTC_P1 h C0 r0 r) H7 (FTC_P1 h C0 r2 r1)); ring. @@ -2801,7 +2801,7 @@ Proof. apply RRle_abs. apply Rle_trans with del; [ left; assumption - | unfold del in |- *; apply Rle_trans with (Rmin (b - x) (x - a)); + | unfold del; apply Rle_trans with (Rmin (b - x) (x - a)); [ apply Rmin_r | apply Rmin_l ] ]. apply Ropp_le_cancel; apply Rplus_le_reg_l with x; replace (x + - (x + h0)) with (- h0); [ idtac | ring ]. @@ -2809,7 +2809,7 @@ Proof. [ rewrite <- Rabs_Ropp; apply RRle_abs | apply Rle_trans with del; [ left; assumption - | unfold del in |- *; apply Rle_trans with (Rmin (b - x) (x - a)); + | unfold del; apply Rle_trans with (Rmin (b - x) (x - a)); apply Rmin_r ] ]. Qed. @@ -2826,14 +2826,14 @@ Proof. (f_b := fun x:R => f b * (x - b) + RiemannInt (FTC_P1 h C0 h (Rle_refl b))); rewrite H3. assert (H4 : derivable_pt_lim f_b b (f b)). - unfold f_b in |- *; pattern (f b) at 2 in |- *; replace (f b) with (f b + 0). + unfold f_b; pattern (f b) at 2; replace (f b) with (f b + 0). change (derivable_pt_lim ((fct_cte (f b) * (id - fct_cte b))%F + fct_cte (RiemannInt (FTC_P1 h C0 h (Rle_refl b)))) b ( - f b + 0)) in |- *. + f b + 0)). apply derivable_pt_lim_plus. - pattern (f b) at 2 in |- *; + pattern (f b) at 2; replace (f b) with (0 * (id - fct_cte b)%F b + fct_cte (f b) b * 1). apply derivable_pt_lim_mult. apply derivable_pt_lim_const. @@ -2841,26 +2841,26 @@ Proof. apply derivable_pt_lim_minus. apply derivable_pt_lim_id. apply derivable_pt_lim_const. - unfold fct_cte in |- *; ring. + unfold fct_cte; ring. apply derivable_pt_lim_const. ring. - unfold derivable_pt_lim in |- *; intros; elim (H4 _ H5); intros; + unfold derivable_pt_lim; intros; elim (H4 _ H5); intros; assert (H7 : continuity_pt f b). apply C0; split; [ left; assumption | right; reflexivity ]. assert (H8 : 0 < eps / 2). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. - elim (H7 _ H8); unfold D_x, no_cond, dist in |- *; simpl in |- *; - unfold R_dist in |- *; intros; set (del := Rmin x0 (Rmin x1 (b - a))); + elim (H7 _ H8); unfold D_x, no_cond, dist; simpl; + unfold R_dist; intros; set (del := Rmin x0 (Rmin x1 (b - a))); assert (H10 : 0 < del). - unfold del in |- *; unfold Rmin in |- *; case (Rle_dec x1 (b - a)); intros. + unfold del; unfold Rmin; case (Rle_dec x1 (b - a)); intros. case (Rle_dec x0 x1); intro; [ apply (cond_pos x0) | elim H9; intros; assumption ]. case (Rle_dec x0 (b - a)); intro; [ apply (cond_pos x0) | apply Rlt_Rminus; assumption ]. split with (mkposreal _ H10); intros; case (Rcase_abs h0); intro. assert (H14 : b + h0 < b). - pattern b at 2 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; + pattern b at 2; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; assumption. assert (H13 : Riemann_integrable f (b + h0) b). apply continuity_implies_RiemannInt. @@ -2874,11 +2874,11 @@ Proof. apply Rle_trans with (Rabs h0). rewrite <- Rabs_Ropp; apply RRle_abs. left; assumption. - unfold del in |- *; apply Rle_trans with (Rmin x1 (b - a)); apply Rmin_r. + unfold del; apply Rle_trans with (Rmin x1 (b - a)); apply Rmin_r. replace (primitive h (FTC_P1 h C0) (b + h0) - primitive h (FTC_P1 h C0) b) with (- RiemannInt H13). replace (f b) with (- RiemannInt (RiemannInt_P14 (b + h0) b (f b)) / h0). - rewrite <- Rabs_Ropp; unfold Rminus in |- *; unfold Rdiv in |- *; + rewrite <- Rabs_Ropp; unfold Rminus; unfold Rdiv; rewrite Ropp_mult_distr_l_reverse; rewrite Ropp_plus_distr; repeat rewrite Ropp_involutive; replace @@ -2887,7 +2887,7 @@ Proof. ((RiemannInt H13 - RiemannInt (RiemannInt_P14 (b + h0) b (f b))) / h0). replace (RiemannInt H13 - RiemannInt (RiemannInt_P14 (b + h0) b (f b))) with (RiemannInt (RiemannInt_P10 (-1) H13 (RiemannInt_P14 (b + h0) b (f b)))). - unfold Rdiv in |- *; rewrite Rabs_mult; + unfold Rdiv; rewrite Rabs_mult; apply Rle_lt_trans with (RiemannInt (RiemannInt_P16 @@ -2907,8 +2907,8 @@ Proof. apply RiemannInt_P19. left; assumption. intros; replace (f x2 + -1 * fct_cte (f b) x2) with (f x2 - f b). - unfold fct_cte in |- *; case (Req_dec b x2); intro. - rewrite H16; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + unfold fct_cte; case (Req_dec b x2); intro. + rewrite H16; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; left; assumption. elim H9; intros; left; apply H18. repeat split. @@ -2919,22 +2919,22 @@ Proof. replace (x2 - x1 + x1) with x2; [ idtac | ring ]. apply Rlt_le_trans with (b + h0). 2: elim H15; intros; left; assumption. - unfold Rminus in |- *; apply Rplus_lt_compat_l; apply Ropp_lt_cancel; + unfold Rminus; apply Rplus_lt_compat_l; apply Ropp_lt_cancel; rewrite Ropp_involutive; apply Rle_lt_trans with (Rabs h0). rewrite <- Rabs_Ropp; apply RRle_abs. apply Rlt_le_trans with del; [ assumption - | unfold del in |- *; apply Rle_trans with (Rmin x1 (b - a)); + | unfold del; apply Rle_trans with (Rmin x1 (b - a)); [ apply Rmin_r | apply Rmin_l ] ]. apply Rle_ge; left; apply Rlt_Rminus; elim H15; intros; assumption. - unfold fct_cte in |- *; ring. + unfold fct_cte; ring. rewrite RiemannInt_P15. rewrite Rmult_assoc; replace ((b - (b + h0)) * Rabs (/ h0)) with 1. - rewrite Rmult_1_r; unfold Rdiv in |- *; apply Rmult_lt_reg_l with 2; + rewrite Rmult_1_r; unfold Rdiv; apply Rmult_lt_reg_l with 2; [ prove_sup0 | rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; - [ rewrite Rmult_1_l; pattern eps at 1 in |- *; rewrite <- Rplus_0_r; + [ rewrite Rmult_1_l; pattern eps at 1; rewrite <- Rplus_0_r; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. rewrite Rabs_left. @@ -2948,16 +2948,16 @@ Proof. (RiemannInt_P13 H13 (RiemannInt_P14 (b + h0) b (f b)) (RiemannInt_P10 (-1) H13 (RiemannInt_P14 (b + h0) b (f b)))) ; ring. - unfold Rdiv, Rminus in |- *; rewrite Rmult_plus_distr_r; ring. + unfold Rdiv, Rminus; rewrite Rmult_plus_distr_r; ring. rewrite RiemannInt_P15. rewrite <- Ropp_mult_distr_l_reverse; apply Rmult_eq_reg_l with h0; - [ repeat rewrite (Rmult_comm h0); unfold Rdiv in |- *; + [ repeat rewrite (Rmult_comm h0); unfold Rdiv; repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ ring | assumption ] | assumption ]. cut (a <= b + h0). cut (b + h0 <= b). - intros; unfold primitive in |- *; case (Rle_dec a (b + h0)); + intros; unfold primitive; case (Rle_dec a (b + h0)); case (Rle_dec (b + h0) b); case (Rle_dec a b); case (Rle_dec b b); intros; try (elim n; right; reflexivity) || (elim n; left; assumption). rewrite <- (RiemannInt_P26 (FTC_P1 h C0 r3 r2) H13 (FTC_P1 h C0 r1 r0)); ring. @@ -2970,26 +2970,26 @@ Proof. apply Rle_trans with (Rabs h0). rewrite <- Rabs_Ropp; apply RRle_abs. left; assumption. - unfold del in |- *; apply Rle_trans with (Rmin x1 (b - a)); apply Rmin_r. + unfold del; apply Rle_trans with (Rmin x1 (b - a)); apply Rmin_r. cut (primitive h (FTC_P1 h C0) b = f_b b). intro; cut (primitive h (FTC_P1 h C0) (b + h0) = f_b (b + h0)). intro; rewrite H13; rewrite H14; apply H6. assumption. apply Rlt_le_trans with del; - [ assumption | unfold del in |- *; apply Rmin_l ]. + [ assumption | unfold del; apply Rmin_l ]. assert (H14 : b < b + h0). - pattern b at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l. + pattern b at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l. assert (H14 := Rge_le _ _ r); elim H14; intro. assumption. - elim H11; symmetry in |- *; assumption. - unfold primitive in |- *; case (Rle_dec a (b + h0)); + elim H11; symmetry ; assumption. + unfold primitive; case (Rle_dec a (b + h0)); case (Rle_dec (b + h0) b); intros; [ elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r0 H14)) - | unfold f_b in |- *; reflexivity + | unfold f_b; reflexivity | elim n; left; apply Rlt_trans with b; assumption | elim n0; left; apply Rlt_trans with b; assumption ]. - unfold f_b in |- *; unfold Rminus in |- *; rewrite Rplus_opp_r; - rewrite Rmult_0_r; rewrite Rplus_0_l; unfold primitive in |- *; + unfold f_b; unfold Rminus; rewrite Rplus_opp_r; + rewrite Rmult_0_r; rewrite Rplus_0_l; unfold primitive; case (Rle_dec a b); case (Rle_dec b b); intros; [ apply RiemannInt_P5 | elim n; right; reflexivity @@ -2998,9 +2998,9 @@ Proof. (*****) set (f_a := fun x:R => f a * (x - a)); rewrite <- H2; assert (H3 : derivable_pt_lim f_a a (f a)). - unfold f_a in |- *; + unfold f_a; change (derivable_pt_lim (fct_cte (f a) * (id - fct_cte a)%F) a (f a)) - in |- *; pattern (f a) at 2 in |- *; + ; pattern (f a) at 2; replace (f a) with (0 * (id - fct_cte a)%F a + fct_cte (f a) a * 1). apply derivable_pt_lim_mult. apply derivable_pt_lim_const. @@ -3008,18 +3008,18 @@ Proof. apply derivable_pt_lim_minus. apply derivable_pt_lim_id. apply derivable_pt_lim_const. - unfold fct_cte in |- *; ring. - unfold derivable_pt_lim in |- *; intros; elim (H3 _ H4); intros. + unfold fct_cte; ring. + unfold derivable_pt_lim; intros; elim (H3 _ H4); intros. assert (H6 : continuity_pt f a). apply C0; split; [ right; reflexivity | left; assumption ]. assert (H7 : 0 < eps / 2). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. - elim (H6 _ H7); unfold D_x, no_cond, dist in |- *; simpl in |- *; - unfold R_dist in |- *; intros. + elim (H6 _ H7); unfold D_x, no_cond, dist; simpl; + unfold R_dist; intros. set (del := Rmin x0 (Rmin x1 (b - a))). assert (H9 : 0 < del). - unfold del in |- *; unfold Rmin in |- *. + unfold del; unfold Rmin. case (Rle_dec x1 (b - a)); intros. case (Rle_dec x0 x1); intro. apply (cond_pos x0). @@ -3030,9 +3030,9 @@ Proof. split with (mkposreal _ H9). intros; case (Rcase_abs h0); intro. assert (H12 : a + h0 < a). - pattern a at 2 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; + pattern a at 2; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; assumption. - unfold primitive in |- *. + unfold primitive. case (Rle_dec a (a + h0)); case (Rle_dec (a + h0) b); case (Rle_dec a a); case (Rle_dec a b); intros; try (elim n; left; assumption) || (elim n; right; reflexivity). @@ -3042,15 +3042,15 @@ Proof. replace (f a * (a + h0 - a)) with (f_a (a + h0)). apply H5; try assumption. apply Rlt_le_trans with del; - [ assumption | unfold del in |- *; apply Rmin_l ]. - unfold f_a in |- *; ring. - unfold f_a in |- *; ring. + [ assumption | unfold del; apply Rmin_l ]. + unfold f_a; ring. + unfold f_a; ring. elim n; left; apply Rlt_trans with a; assumption. assert (H12 : a < a + h0). - pattern a at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l. + pattern a at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l. assert (H12 := Rge_le _ _ r); elim H12; intro. assumption. - elim H10; symmetry in |- *; assumption. + elim H10; symmetry ; assumption. assert (H13 : Riemann_integrable f a (a + h0)). apply continuity_implies_RiemannInt. left; assumption. @@ -3062,7 +3062,7 @@ Proof. apply Ropp_le_cancel; rewrite Ropp_involutive; rewrite Ropp_minus_distr; apply Rle_trans with del. apply Rle_trans with (Rabs h0); [ apply RRle_abs | left; assumption ]. - unfold del in |- *; apply Rle_trans with (Rmin x1 (b - a)); apply Rmin_r. + unfold del; apply Rle_trans with (Rmin x1 (b - a)); apply Rmin_r. replace (primitive h (FTC_P1 h C0) (a + h0) - primitive h (FTC_P1 h C0) a) with (RiemannInt H13). replace (f a) with (RiemannInt (RiemannInt_P14 a (a + h0) (f a)) / h0). @@ -3071,7 +3071,7 @@ Proof. with ((RiemannInt H13 - RiemannInt (RiemannInt_P14 a (a + h0) (f a))) / h0). replace (RiemannInt H13 - RiemannInt (RiemannInt_P14 a (a + h0) (f a))) with (RiemannInt (RiemannInt_P10 (-1) H13 (RiemannInt_P14 a (a + h0) (f a)))). - unfold Rdiv in |- *; rewrite Rabs_mult; + unfold Rdiv; rewrite Rabs_mult; apply Rle_lt_trans with (RiemannInt (RiemannInt_P16 @@ -3091,8 +3091,8 @@ Proof. apply RiemannInt_P19. left; assumption. intros; replace (f x2 + -1 * fct_cte (f a) x2) with (f x2 - f a). - unfold fct_cte in |- *; case (Req_dec a x2); intro. - rewrite H15; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + unfold fct_cte; case (Req_dec a x2); intro. + rewrite H15; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; left; assumption. elim H8; intros; left; apply H17; repeat split. assumption. @@ -3104,42 +3104,42 @@ Proof. apply RRle_abs. apply Rlt_le_trans with del; [ assumption - | unfold del in |- *; apply Rle_trans with (Rmin x1 (b - a)); + | unfold del; apply Rle_trans with (Rmin x1 (b - a)); [ apply Rmin_r | apply Rmin_l ] ]. apply Rle_ge; left; apply Rlt_Rminus; elim H14; intros; assumption. - unfold fct_cte in |- *; ring. + unfold fct_cte; ring. rewrite RiemannInt_P15. rewrite Rmult_assoc; replace ((a + h0 - a) * Rabs (/ h0)) with 1. - rewrite Rmult_1_r; unfold Rdiv in |- *; apply Rmult_lt_reg_l with 2; + rewrite Rmult_1_r; unfold Rdiv; apply Rmult_lt_reg_l with 2; [ prove_sup0 | rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; - [ rewrite Rmult_1_l; pattern eps at 1 in |- *; rewrite <- Rplus_0_r; + [ rewrite Rmult_1_l; pattern eps at 1; rewrite <- Rplus_0_r; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. rewrite Rabs_right. - rewrite Rplus_comm; unfold Rminus in |- *; rewrite Rplus_assoc; + rewrite Rplus_comm; unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_r; rewrite Rplus_0_r; rewrite <- Rinv_r_sym; [ reflexivity | assumption ]. apply Rle_ge; left; apply Rinv_0_lt_compat; assert (H14 := Rge_le _ _ r); elim H14; intro. assumption. - elim H10; symmetry in |- *; assumption. + elim H10; symmetry ; assumption. rewrite (RiemannInt_P13 H13 (RiemannInt_P14 a (a + h0) (f a)) (RiemannInt_P10 (-1) H13 (RiemannInt_P14 a (a + h0) (f a)))) ; ring. - unfold Rdiv, Rminus in |- *; rewrite Rmult_plus_distr_r; ring. + unfold Rdiv, Rminus; rewrite Rmult_plus_distr_r; ring. rewrite RiemannInt_P15. - rewrite Rplus_comm; unfold Rminus in |- *; rewrite Rplus_assoc; - rewrite Rplus_opp_r; rewrite Rplus_0_r; unfold Rdiv in |- *; + rewrite Rplus_comm; unfold Rminus; rewrite Rplus_assoc; + rewrite Rplus_opp_r; rewrite Rplus_0_r; unfold Rdiv; rewrite Rmult_assoc; rewrite <- Rinv_r_sym; [ ring | assumption ]. cut (a <= a + h0). cut (a + h0 <= b). - intros; unfold primitive in |- *; case (Rle_dec a (a + h0)); + intros; unfold primitive; case (Rle_dec a (a + h0)); case (Rle_dec (a + h0) b); case (Rle_dec a a); case (Rle_dec a b); intros; try (elim n; right; reflexivity) || (elim n; left; assumption). - rewrite RiemannInt_P9; unfold Rminus in |- *; rewrite Ropp_0; + rewrite RiemannInt_P9; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply RiemannInt_P5. elim n; assumption. elim n; assumption. @@ -3148,15 +3148,15 @@ Proof. [ idtac | ring ]. rewrite Rplus_comm; apply Rle_trans with del; [ apply Rle_trans with (Rabs h0); [ apply RRle_abs | left; assumption ] - | unfold del in |- *; apply Rle_trans with (Rmin x1 (b - a)); apply Rmin_r ]. + | unfold del; apply Rle_trans with (Rmin x1 (b - a)); apply Rmin_r ]. (*****) assert (H1 : x = a). rewrite <- H0 in H; elim H; intros; apply Rle_antisym; assumption. set (f_a := fun x:R => f a * (x - a)). assert (H2 : derivable_pt_lim f_a a (f a)). - unfold f_a in |- *; + unfold f_a; change (derivable_pt_lim (fct_cte (f a) * (id - fct_cte a)%F) a (f a)) - in |- *; pattern (f a) at 2 in |- *; + ; pattern (f a) at 2; replace (f a) with (0 * (id - fct_cte a)%F a + fct_cte (f a) a * 1). apply derivable_pt_lim_mult. apply derivable_pt_lim_const. @@ -3164,18 +3164,18 @@ Proof. apply derivable_pt_lim_minus. apply derivable_pt_lim_id. apply derivable_pt_lim_const. - unfold fct_cte in |- *; ring. + unfold fct_cte; ring. set (f_b := fun x:R => f b * (x - b) + RiemannInt (FTC_P1 h C0 h (Rle_refl b))). assert (H3 : derivable_pt_lim f_b b (f b)). - unfold f_b in |- *; pattern (f b) at 2 in |- *; replace (f b) with (f b + 0). + unfold f_b; pattern (f b) at 2; replace (f b) with (f b + 0). change (derivable_pt_lim ((fct_cte (f b) * (id - fct_cte b))%F + fct_cte (RiemannInt (FTC_P1 h C0 h (Rle_refl b)))) b ( - f b + 0)) in |- *. + f b + 0)). apply derivable_pt_lim_plus. - pattern (f b) at 2 in |- *; + pattern (f b) at 2; replace (f b) with (0 * (id - fct_cte b)%F b + fct_cte (f b) b * 1). apply derivable_pt_lim_mult. apply derivable_pt_lim_const. @@ -3183,20 +3183,20 @@ Proof. apply derivable_pt_lim_minus. apply derivable_pt_lim_id. apply derivable_pt_lim_const. - unfold fct_cte in |- *; ring. + unfold fct_cte; ring. apply derivable_pt_lim_const. ring. - unfold derivable_pt_lim in |- *; intros; elim (H2 _ H4); intros; + unfold derivable_pt_lim; intros; elim (H2 _ H4); intros; elim (H3 _ H4); intros; set (del := Rmin x0 x1). assert (H7 : 0 < del). - unfold del in |- *; unfold Rmin in |- *; case (Rle_dec x0 x1); intro. + unfold del; unfold Rmin; case (Rle_dec x0 x1); intro. apply (cond_pos x0). apply (cond_pos x1). split with (mkposreal _ H7); intros; case (Rcase_abs h0); intro. assert (H10 : a + h0 < a). - pattern a at 2 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; + pattern a at 2; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; assumption. - rewrite H1; unfold primitive in |- *; case (Rle_dec a (a + h0)); + rewrite H1; unfold primitive; case (Rle_dec a (a + h0)); case (Rle_dec (a + h0) b); case (Rle_dec a a); case (Rle_dec a b); intros; try (elim n; right; assumption || reflexivity). elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r3 H10)). @@ -3205,27 +3205,27 @@ Proof. replace (f a * (a + h0 - a)) with (f_a (a + h0)). apply H5; try assumption. apply Rlt_le_trans with del; try assumption. - unfold del in |- *; apply Rmin_l. - unfold f_a in |- *; ring. - unfold f_a in |- *; ring. + unfold del; apply Rmin_l. + unfold f_a; ring. + unfold f_a; ring. elim n; rewrite <- H0; left; assumption. assert (H10 : a < a + h0). - pattern a at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l. + pattern a at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l. assert (H10 := Rge_le _ _ r); elim H10; intro. assumption. - elim H8; symmetry in |- *; assumption. - rewrite H0 in H1; rewrite H1; unfold primitive in |- *; + elim H8; symmetry ; assumption. + rewrite H0 in H1; rewrite H1; unfold primitive; case (Rle_dec a (b + h0)); case (Rle_dec (b + h0) b); case (Rle_dec a b); case (Rle_dec b b); intros; try (elim n; right; assumption || reflexivity). rewrite H0 in H10; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r2 H10)). repeat rewrite RiemannInt_P9. replace (RiemannInt (FTC_P1 h C0 r1 r0)) with (f_b b). - fold (f_b (b + h0)) in |- *. + fold (f_b (b + h0)). apply H6; try assumption. apply Rlt_le_trans with del; try assumption. - unfold del in |- *; apply Rmin_r. - unfold f_b in |- *; unfold Rminus in |- *; rewrite Rplus_opp_r; + unfold del; apply Rmin_r. + unfold f_b; unfold Rminus; rewrite Rplus_opp_r; rewrite Rmult_0_r; rewrite Rplus_0_l; apply RiemannInt_P5. elim n; rewrite <- H0; left; assumption. elim n0; rewrite <- H0; left; assumption. @@ -3236,11 +3236,11 @@ Lemma RiemannInt_P29 : (C0:forall x:R, a <= x <= b -> continuity_pt f x), antiderivative f (primitive h (FTC_P1 h C0)) a b. Proof. - intro f; intros; unfold antiderivative in |- *; split; try assumption; intros; + intro f; intros; unfold antiderivative; split; try assumption; intros; assert (H0 := RiemannInt_P28 h C0 H); assert (H1 : derivable_pt (primitive h (FTC_P1 h C0)) x); - [ unfold derivable_pt in |- *; split with (f x); apply H0 - | split with H1; symmetry in |- *; apply derive_pt_eq_0; apply H0 ]. + [ unfold derivable_pt; split with (f x); apply H0 + | split with H1; symmetry ; apply derive_pt_eq_0; apply H0 ]. Qed. Lemma RiemannInt_P30 : @@ -3259,7 +3259,7 @@ Lemma RiemannInt_P31 : forall (f:C1_fun) (a b:R), a <= b -> antiderivative (derive f (diff0 f)) f a b. Proof. - intro f; intros; unfold antiderivative in |- *; split; try assumption; intros; + intro f; intros; unfold antiderivative; split; try assumption; intros; split with (diff0 f x); reflexivity. Qed. diff --git a/theories/Reals/RiemannInt_SF.v b/theories/Reals/RiemannInt_SF.v index d16e7f2c..d523a1f4 100644 --- a/theories/Reals/RiemannInt_SF.v +++ b/theories/Reals/RiemannInt_SF.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -8,9 +8,9 @@ Require Import Rbase. Require Import Rfunctions. -Require Import Ranalysis. +Require Import Ranalysis_reg. Require Import Classical_Prop. -Open Local Scope R_scope. +Local Open Scope R_scope. Set Implicit Arguments. @@ -21,7 +21,7 @@ Set Implicit Arguments. Definition Nbound (I:nat -> Prop) : Prop := exists n : nat, (forall i:nat, I i -> (i <= n)%nat). -Lemma IZN_var : forall z:Z, (0 <= z)%Z -> {n : nat | z = Z_of_nat n}. +Lemma IZN_var : forall z:Z, (0 <= z)%Z -> {n : nat | z = Z.of_nat n}. Proof. intros; apply Z_of_nat_complete_inf; assumption. Qed. @@ -33,19 +33,19 @@ Lemma Nzorn : Proof. intros I H H0; set (E := fun x:R => exists i : nat, I i /\ INR i = x); assert (H1 : bound E). - unfold Nbound in H0; elim H0; intros N H1; unfold bound in |- *; - exists (INR N); unfold is_upper_bound in |- *; intros; + unfold Nbound in H0; elim H0; intros N H1; unfold bound; + exists (INR N); unfold is_upper_bound; intros; unfold E in H2; elim H2; intros; elim H3; intros; rewrite <- H5; apply le_INR; apply H1; assumption. assert (H2 : exists x : R, E x). - elim H; intros; exists (INR x); unfold E in |- *; exists x; split; + elim H; intros; exists (INR x); unfold E; exists x; split; [ assumption | reflexivity ]. assert (H3 := completeness E H1 H2); elim H3; intros; unfold is_lub in p; elim p; clear p; intros; unfold is_upper_bound in H4, H5; assert (H6 : 0 <= x). elim H2; intros; unfold E in H6; elim H6; intros; elim H7; intros; apply Rle_trans with x0; - [ rewrite <- H9; change (INR 0 <= INR x1) in |- *; apply le_INR; + [ rewrite <- H9; change (INR 0 <= INR x1); apply le_INR; apply le_O_n | apply H4; assumption ]. assert (H7 := archimed x); elim H7; clear H7; intros; @@ -88,7 +88,7 @@ Proof. [ idtac | reflexivity ]; rewrite <- minus_INR. replace (x0 - 1)%nat with (pred x0); [ reflexivity - | case x0; [ reflexivity | intro; simpl in |- *; apply minus_n_O ] ]. + | case x0; [ reflexivity | intro; simpl; apply minus_n_O ] ]. induction x0 as [| x0 Hrecx0]; [ rewrite p in H7; rewrite <- INR_IZR_INZ in H7; simpl in H7; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H6 H7)) @@ -99,10 +99,10 @@ Proof. assert (H16 : INR x0 = INR x1 + 1). rewrite H15; ring. rewrite <- S_INR in H16; assert (H17 := INR_eq _ _ H16); rewrite H17; - simpl in |- *; split. + simpl; split. assumption. intros; apply INR_le; rewrite H15; rewrite <- H15; elim H12; intros; - rewrite H20; apply H4; unfold E in |- *; exists i; + rewrite H20; apply H4; unfold E; exists i; split; [ assumption | reflexivity ]. Qed. @@ -173,7 +173,7 @@ Lemma StepFun_P1 : forall (a b:R) (f:StepFun a b), adapted_couple f a b (subdivision f) (subdivision_val f). Proof. - intros a b f; unfold subdivision_val in |- *; case (projT2 (pre f)); intros; + intros a b f; unfold subdivision_val; case (projT2 (pre f)); intros; apply a0. Qed. @@ -181,13 +181,13 @@ Lemma StepFun_P2 : forall (a b:R) (f:R -> R) (l lf:Rlist), adapted_couple f a b l lf -> adapted_couple f b a l lf. Proof. - unfold adapted_couple in |- *; intros; decompose [and] H; clear H; + unfold adapted_couple; intros; decompose [and] H; clear H; repeat split; try assumption. - rewrite H2; unfold Rmin in |- *; case (Rle_dec a b); intro; + rewrite H2; unfold Rmin; case (Rle_dec a b); intro; case (Rle_dec b a); intro; try reflexivity. apply Rle_antisym; assumption. apply Rle_antisym; auto with real. - rewrite H1; unfold Rmax in |- *; case (Rle_dec a b); intro; + rewrite H1; unfold Rmax; case (Rle_dec a b); intro; case (Rle_dec b a); intro; try reflexivity. apply Rle_antisym; assumption. apply Rle_antisym; auto with real. @@ -198,23 +198,23 @@ Lemma StepFun_P3 : a <= b -> adapted_couple (fct_cte c) a b (cons a (cons b nil)) (cons c nil). Proof. - intros; unfold adapted_couple in |- *; repeat split. - unfold ordered_Rlist in |- *; intros; simpl in H0; inversion H0; - [ simpl in |- *; assumption | elim (le_Sn_O _ H2) ]. - simpl in |- *; unfold Rmin in |- *; case (Rle_dec a b); intro; + intros; unfold adapted_couple; repeat split. + unfold ordered_Rlist; intros; simpl in H0; inversion H0; + [ simpl; assumption | elim (le_Sn_O _ H2) ]. + simpl; unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. - simpl in |- *; unfold Rmax in |- *; case (Rle_dec a b); intro; + simpl; unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. - unfold constant_D_eq, open_interval in |- *; intros; simpl in H0; + unfold constant_D_eq, open_interval; intros; simpl in H0; inversion H0; [ reflexivity | elim (le_Sn_O _ H3) ]. Qed. Lemma StepFun_P4 : forall a b c:R, IsStepFun (fct_cte c) a b. Proof. - intros; unfold IsStepFun in |- *; case (Rle_dec a b); intro. - apply existT with (cons a (cons b nil)); unfold is_subdivision in |- *; + intros; unfold IsStepFun; case (Rle_dec a b); intro. + apply existT with (cons a (cons b nil)); unfold is_subdivision; apply existT with (cons c nil); apply (StepFun_P3 c r). - apply existT with (cons b (cons a nil)); unfold is_subdivision in |- *; + apply existT with (cons b (cons a nil)); unfold is_subdivision; apply existT with (cons c nil); apply StepFun_P2; apply StepFun_P3; auto with real. Qed. @@ -232,7 +232,7 @@ Qed. Lemma StepFun_P6 : forall (f:R -> R) (a b:R), IsStepFun f a b -> IsStepFun f b a. Proof. - unfold IsStepFun in |- *; intros; elim X; intros; apply existT with x; + unfold IsStepFun; intros; elim X; intros; apply existT with x; apply StepFun_P5; assumption. Qed. @@ -242,26 +242,26 @@ Lemma StepFun_P7 : adapted_couple f a b (cons r1 (cons r2 l)) (cons r3 lf) -> adapted_couple f r2 b (cons r2 l) lf. Proof. - unfold adapted_couple in |- *; intros; decompose [and] H0; clear H0; + unfold adapted_couple; intros; decompose [and] H0; clear H0; assert (H5 : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. assert (H7 : r2 <= b). rewrite H5 in H2; rewrite <- H2; apply RList_P7; - [ assumption | simpl in |- *; right; left; reflexivity ]. + [ assumption | simpl; right; left; reflexivity ]. repeat split. apply RList_P4 with r1; assumption. - rewrite H5 in H2; unfold Rmin in |- *; case (Rle_dec r2 b); intro; + rewrite H5 in H2; unfold Rmin; case (Rle_dec r2 b); intro; [ reflexivity | elim n; assumption ]. - unfold Rmax in |- *; case (Rle_dec r2 b); intro; + unfold Rmax; case (Rle_dec r2 b); intro; [ rewrite H5 in H2; rewrite <- H2; reflexivity | elim n; assumption ]. - simpl in H4; simpl in |- *; apply INR_eq; apply Rplus_eq_reg_l with 1; + simpl in H4; simpl; apply INR_eq; apply Rplus_eq_reg_l with 1; do 2 rewrite (Rplus_comm 1); do 2 rewrite <- S_INR; rewrite H4; reflexivity. - intros; unfold constant_D_eq, open_interval in |- *; intros; + intros; unfold constant_D_eq, open_interval; intros; unfold constant_D_eq, open_interval in H6; assert (H9 : (S i < pred (Rlength (cons r1 (cons r2 l))))%nat). - simpl in |- *; simpl in H0; apply lt_n_S; assumption. + simpl; simpl in H0; apply lt_n_S; assumption. assert (H10 := H6 _ H9); apply H10; assumption. Qed. @@ -278,19 +278,19 @@ Proof. discriminate. intros; induction lf1 as [| r3 lf1 Hreclf1]. reflexivity. - simpl in |- *; cut (r = r1). + simpl; cut (r = r1). intro; rewrite H3; rewrite (H0 lf1 r b). ring. rewrite H3; apply StepFun_P7 with a r r3; [ right; assumption | assumption ]. clear H H0 Hreclf1 r0; unfold adapted_couple in H1; decompose [and] H1; - intros; simpl in H4; rewrite H4; unfold Rmin in |- *; + intros; simpl in H4; rewrite H4; unfold Rmin; case (Rle_dec a b); intro; [ assumption | reflexivity ]. unfold adapted_couple in H1; decompose [and] H1; intros; apply Rle_antisym. - apply (H3 0%nat); simpl in |- *; apply lt_O_Sn. + apply (H3 0%nat); simpl; apply lt_O_Sn. simpl in H5; rewrite H2 in H5; rewrite H5; replace (Rmin b b) with (Rmax a b); [ rewrite <- H4; apply RList_P7; - [ assumption | simpl in |- *; right; left; reflexivity ] - | unfold Rmin, Rmax in |- *; case (Rle_dec b b); case (Rle_dec a b); intros; + [ assumption | simpl; right; left; reflexivity ] + | unfold Rmin, Rmax; case (Rle_dec b b); case (Rle_dec a b); intros; try assumption || reflexivity ]. Qed. @@ -303,10 +303,10 @@ Proof. [ simpl in H4; discriminate | induction l as [| r0 l Hrecl0]; [ simpl in H3; simpl in H2; generalize H3; generalize H2; - unfold Rmin, Rmax in |- *; case (Rle_dec a b); + unfold Rmin, Rmax; case (Rle_dec a b); intros; elim H0; rewrite <- H5; rewrite <- H7; reflexivity - | simpl in |- *; do 2 apply le_n_S; apply le_O_n ] ]. + | simpl; do 2 apply le_n_S; apply le_O_n ] ]. Qed. Lemma StepFun_P10 : @@ -320,12 +320,12 @@ Proof. intros; unfold adapted_couple in H0; decompose [and] H0; simpl in H4; discriminate. intros; case (Req_dec a b); intro. - exists (cons a nil); exists nil; unfold adapted_couple_opt in |- *; - unfold adapted_couple in |- *; unfold ordered_Rlist in |- *; + exists (cons a nil); exists nil; unfold adapted_couple_opt; + unfold adapted_couple; unfold ordered_Rlist; repeat split; try (intros; simpl in H3; elim (lt_n_O _ H3)). - simpl in |- *; rewrite <- H2; unfold Rmin in |- *; case (Rle_dec a a); intro; + simpl; rewrite <- H2; unfold Rmin; case (Rle_dec a a); intro; reflexivity. - simpl in |- *; rewrite <- H2; unfold Rmax in |- *; case (Rle_dec a a); intro; + simpl; rewrite <- H2; unfold Rmax; case (Rle_dec a a); intro; reflexivity. elim (RList_P20 _ (StepFun_P9 H1 H2)); intros t1 [t2 [t3 H3]]; induction lf as [| r1 lf Hreclf]. @@ -340,32 +340,32 @@ Proof. apply H6. rewrite <- Hyp_eq; rewrite H3 in H1; unfold adapted_couple in H1; decompose [and] H1; clear H1; simpl in H9; rewrite H9; - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. elim H6; clear H6; intros l' [lf' H6]; case (Req_dec t2 b); intro. exists (cons a (cons b nil)); exists (cons r1 nil); - unfold adapted_couple_opt in |- *; unfold adapted_couple in |- *; + unfold adapted_couple_opt; unfold adapted_couple; repeat split. - unfold ordered_Rlist in |- *; intros; simpl in H8; inversion H8; - [ simpl in |- *; assumption | elim (le_Sn_O _ H10) ]. - simpl in |- *; unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold ordered_Rlist; intros; simpl in H8; inversion H8; + [ simpl; assumption | elim (le_Sn_O _ H10) ]. + simpl; unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. - simpl in |- *; unfold Rmax in |- *; case (Rle_dec a b); intro; + simpl; unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. intros; simpl in H8; inversion H8. - unfold constant_D_eq, open_interval in |- *; intros; simpl in |- *; + unfold constant_D_eq, open_interval; intros; simpl; simpl in H9; rewrite H3 in H1; unfold adapted_couple in H1; decompose [and] H1; apply (H16 0%nat). - simpl in |- *; apply lt_O_Sn. - unfold open_interval in |- *; simpl in |- *; rewrite H7; simpl in H13; - rewrite H13; unfold Rmin in |- *; case (Rle_dec a b); + simpl; apply lt_O_Sn. + unfold open_interval; simpl; rewrite H7; simpl in H13; + rewrite H13; unfold Rmin; case (Rle_dec a b); intro; [ assumption | elim n; assumption ]. elim (le_Sn_O _ H10). intros; simpl in H8; elim (lt_n_O _ H8). intros; simpl in H8; inversion H8; - [ simpl in |- *; assumption | elim (le_Sn_O _ H10) ]. + [ simpl; assumption | elim (le_Sn_O _ H10) ]. assert (Hyp_min : Rmin t2 b = t2). - unfold Rmin in |- *; case (Rle_dec t2 b); intro; + unfold Rmin; case (Rle_dec t2 b); intro; [ reflexivity | elim n; assumption ]. unfold adapted_couple in H6; elim H6; clear H6; intros; elim (RList_P20 _ (StepFun_P9 H6 H7)); intros s1 [s2 [s3 H9]]; @@ -377,141 +377,141 @@ Proof. exists (cons t1 (cons s2 s3)); exists (cons r1 lf'); rewrite H3 in H1; rewrite H9 in H6; unfold adapted_couple in H6, H1; decompose [and] H1; decompose [and] H6; clear H1 H6; - unfold adapted_couple_opt in |- *; unfold adapted_couple in |- *; + unfold adapted_couple_opt; unfold adapted_couple; repeat split. - unfold ordered_Rlist in |- *; intros; simpl in H1; + unfold ordered_Rlist; intros; simpl in H1; induction i as [| i Hreci]. - simpl in |- *; apply Rle_trans with s1. + simpl; apply Rle_trans with s1. replace s1 with t2. apply (H12 0%nat). - simpl in |- *; apply lt_O_Sn. - simpl in H19; rewrite H19; symmetry in |- *; apply Hyp_min. - apply (H16 0%nat); simpl in |- *; apply lt_O_Sn. - change (pos_Rl (cons s2 s3) i <= pos_Rl (cons s2 s3) (S i)) in |- *; - apply (H16 (S i)); simpl in |- *; assumption. - simpl in |- *; simpl in H14; rewrite H14; reflexivity. - simpl in |- *; simpl in H18; rewrite H18; unfold Rmax in |- *; + simpl; apply lt_O_Sn. + simpl in H19; rewrite H19; symmetry ; apply Hyp_min. + apply (H16 0%nat); simpl; apply lt_O_Sn. + change (pos_Rl (cons s2 s3) i <= pos_Rl (cons s2 s3) (S i)); + apply (H16 (S i)); simpl; assumption. + simpl; simpl in H14; rewrite H14; reflexivity. + simpl; simpl in H18; rewrite H18; unfold Rmax; case (Rle_dec a b); case (Rle_dec t2 b); intros; reflexivity || elim n; assumption. - simpl in |- *; simpl in H20; apply H20. - intros; simpl in H1; unfold constant_D_eq, open_interval in |- *; intros; + simpl; simpl in H20; apply H20. + intros; simpl in H1; unfold constant_D_eq, open_interval; intros; induction i as [| i Hreci]. - simpl in |- *; simpl in H6; case (total_order_T x t2); intro. + simpl; simpl in H6; case (total_order_T x t2); intro. elim s; intro. apply (H17 0%nat); - [ simpl in |- *; apply lt_O_Sn - | unfold open_interval in |- *; simpl in |- *; elim H6; intros; split; + [ simpl; apply lt_O_Sn + | unfold open_interval; simpl; elim H6; intros; split; assumption ]. rewrite b0; assumption. rewrite H10; apply (H22 0%nat); - [ simpl in |- *; apply lt_O_Sn - | unfold open_interval in |- *; simpl in |- *; replace s1 with t2; + [ simpl; apply lt_O_Sn + | unfold open_interval; simpl; replace s1 with t2; [ elim H6; intros; split; assumption | simpl in H19; rewrite H19; rewrite Hyp_min; reflexivity ] ]. - simpl in |- *; simpl in H6; apply (H22 (S i)); - [ simpl in |- *; assumption - | unfold open_interval in |- *; simpl in |- *; apply H6 ]. + simpl; simpl in H6; apply (H22 (S i)); + [ simpl; assumption + | unfold open_interval; simpl; apply H6 ]. intros; simpl in H1; rewrite H10; change (pos_Rl (cons r2 lf') i <> pos_Rl (cons r2 lf') (S i) \/ f (pos_Rl (cons s1 (cons s2 s3)) (S i)) <> pos_Rl (cons r2 lf') i) - in |- *; rewrite <- H9; elim H8; intros; apply H6; - simpl in |- *; apply H1. + ; rewrite <- H9; elim H8; intros; apply H6; + simpl; apply H1. intros; induction i as [| i Hreci]. - simpl in |- *; red in |- *; intro; elim Hyp_eq; apply Rle_antisym. - apply (H12 0%nat); simpl in |- *; apply lt_O_Sn. + simpl; red; intro; elim Hyp_eq; apply Rle_antisym. + apply (H12 0%nat); simpl; apply lt_O_Sn. rewrite <- Hyp_min; rewrite H6; simpl in H19; rewrite <- H19; - apply (H16 0%nat); simpl in |- *; apply lt_O_Sn. - elim H8; intros; rewrite H9 in H21; apply (H21 (S i)); simpl in |- *; + apply (H16 0%nat); simpl; apply lt_O_Sn. + elim H8; intros; rewrite H9 in H21; apply (H21 (S i)); simpl; simpl in H1; apply H1. exists (cons t1 l'); exists (cons r1 (cons r2 lf')); rewrite H9 in H6; rewrite H3 in H1; unfold adapted_couple in H1, H6; decompose [and] H6; decompose [and] H1; clear H6 H1; - unfold adapted_couple_opt in |- *; unfold adapted_couple in |- *; + unfold adapted_couple_opt; unfold adapted_couple; repeat split. - rewrite H9; unfold ordered_Rlist in |- *; intros; simpl in H1; + rewrite H9; unfold ordered_Rlist; intros; simpl in H1; induction i as [| i Hreci]. - simpl in |- *; replace s1 with t2. - apply (H16 0%nat); simpl in |- *; apply lt_O_Sn. + simpl; replace s1 with t2. + apply (H16 0%nat); simpl; apply lt_O_Sn. simpl in H14; rewrite H14; rewrite Hyp_min; reflexivity. change (pos_Rl (cons s1 (cons s2 s3)) i <= pos_Rl (cons s1 (cons s2 s3)) (S i)) - in |- *; apply (H12 i); simpl in |- *; apply lt_S_n; + ; apply (H12 i); simpl; apply lt_S_n; assumption. - simpl in |- *; simpl in H19; apply H19. - rewrite H9; simpl in |- *; simpl in H13; rewrite H13; unfold Rmax in |- *; + simpl; simpl in H19; apply H19. + rewrite H9; simpl; simpl in H13; rewrite H13; unfold Rmax; case (Rle_dec t2 b); case (Rle_dec a b); intros; reflexivity || elim n; assumption. - rewrite H9; simpl in |- *; simpl in H15; rewrite H15; reflexivity. - intros; simpl in H1; unfold constant_D_eq, open_interval in |- *; intros; + rewrite H9; simpl; simpl in H15; rewrite H15; reflexivity. + intros; simpl in H1; unfold constant_D_eq, open_interval; intros; induction i as [| i Hreci]. - simpl in |- *; rewrite H9 in H6; simpl in H6; apply (H22 0%nat). - simpl in |- *; apply lt_O_Sn. - unfold open_interval in |- *; simpl in |- *. + simpl; rewrite H9 in H6; simpl in H6; apply (H22 0%nat). + simpl; apply lt_O_Sn. + unfold open_interval; simpl. replace t2 with s1. assumption. simpl in H14; rewrite H14; rewrite Hyp_min; reflexivity. - change (f x = pos_Rl (cons r2 lf') i) in |- *; clear Hreci; apply (H17 i). - simpl in |- *; rewrite H9 in H1; simpl in H1; apply lt_S_n; apply H1. - rewrite H9 in H6; unfold open_interval in |- *; apply H6. + change (f x = pos_Rl (cons r2 lf') i); clear Hreci; apply (H17 i). + simpl; rewrite H9 in H1; simpl in H1; apply lt_S_n; apply H1. + rewrite H9 in H6; unfold open_interval; apply H6. intros; simpl in H1; induction i as [| i Hreci]. - simpl in |- *; rewrite H9; right; simpl in |- *; replace s1 with t2. + simpl; rewrite H9; right; simpl; replace s1 with t2. assumption. simpl in H14; rewrite H14; rewrite Hyp_min; reflexivity. elim H8; intros; apply (H6 i). - simpl in |- *; apply lt_S_n; apply H1. + simpl; apply lt_S_n; apply H1. intros; rewrite H9; induction i as [| i Hreci]. - simpl in |- *; red in |- *; intro; elim Hyp_eq; apply Rle_antisym. - apply (H16 0%nat); simpl in |- *; apply lt_O_Sn. + simpl; red; intro; elim Hyp_eq; apply Rle_antisym. + apply (H16 0%nat); simpl; apply lt_O_Sn. rewrite <- Hyp_min; rewrite H6; simpl in H14; rewrite <- H14; right; reflexivity. elim H8; intros; rewrite <- H9; apply (H21 i); rewrite H9; rewrite H9 in H1; - simpl in |- *; simpl in H1; apply lt_S_n; apply H1. + simpl; simpl in H1; apply lt_S_n; apply H1. exists (cons t1 l'); exists (cons r1 (cons r2 lf')); rewrite H9 in H6; rewrite H3 in H1; unfold adapted_couple in H1, H6; decompose [and] H6; decompose [and] H1; clear H6 H1; - unfold adapted_couple_opt in |- *; unfold adapted_couple in |- *; + unfold adapted_couple_opt; unfold adapted_couple; repeat split. - rewrite H9; unfold ordered_Rlist in |- *; intros; simpl in H1; + rewrite H9; unfold ordered_Rlist; intros; simpl in H1; induction i as [| i Hreci]. - simpl in |- *; replace s1 with t2. - apply (H15 0%nat); simpl in |- *; apply lt_O_Sn. + simpl; replace s1 with t2. + apply (H15 0%nat); simpl; apply lt_O_Sn. simpl in H13; rewrite H13; rewrite Hyp_min; reflexivity. change (pos_Rl (cons s1 (cons s2 s3)) i <= pos_Rl (cons s1 (cons s2 s3)) (S i)) - in |- *; apply (H11 i); simpl in |- *; apply lt_S_n; + ; apply (H11 i); simpl; apply lt_S_n; assumption. - simpl in |- *; simpl in H18; apply H18. - rewrite H9; simpl in |- *; simpl in H12; rewrite H12; unfold Rmax in |- *; + simpl; simpl in H18; apply H18. + rewrite H9; simpl; simpl in H12; rewrite H12; unfold Rmax; case (Rle_dec t2 b); case (Rle_dec a b); intros; reflexivity || elim n; assumption. - rewrite H9; simpl in |- *; simpl in H14; rewrite H14; reflexivity. - intros; simpl in H1; unfold constant_D_eq, open_interval in |- *; intros; + rewrite H9; simpl; simpl in H14; rewrite H14; reflexivity. + intros; simpl in H1; unfold constant_D_eq, open_interval; intros; induction i as [| i Hreci]. - simpl in |- *; rewrite H9 in H6; simpl in H6; apply (H21 0%nat). - simpl in |- *; apply lt_O_Sn. - unfold open_interval in |- *; simpl in |- *; replace t2 with s1. + simpl; rewrite H9 in H6; simpl in H6; apply (H21 0%nat). + simpl; apply lt_O_Sn. + unfold open_interval; simpl; replace t2 with s1. assumption. simpl in H13; rewrite H13; rewrite Hyp_min; reflexivity. - change (f x = pos_Rl (cons r2 lf') i) in |- *; clear Hreci; apply (H16 i). - simpl in |- *; rewrite H9 in H1; simpl in H1; apply lt_S_n; apply H1. - rewrite H9 in H6; unfold open_interval in |- *; apply H6. + change (f x = pos_Rl (cons r2 lf') i); clear Hreci; apply (H16 i). + simpl; rewrite H9 in H1; simpl in H1; apply lt_S_n; apply H1. + rewrite H9 in H6; unfold open_interval; apply H6. intros; simpl in H1; induction i as [| i Hreci]. - simpl in |- *; left; assumption. + simpl; left; assumption. elim H8; intros; apply (H6 i). - simpl in |- *; apply lt_S_n; apply H1. + simpl; apply lt_S_n; apply H1. intros; rewrite H9; induction i as [| i Hreci]. - simpl in |- *; red in |- *; intro; elim Hyp_eq; apply Rle_antisym. - apply (H15 0%nat); simpl in |- *; apply lt_O_Sn. + simpl; red; intro; elim Hyp_eq; apply Rle_antisym. + apply (H15 0%nat); simpl; apply lt_O_Sn. rewrite <- Hyp_min; rewrite H6; simpl in H13; rewrite <- H13; right; reflexivity. elim H8; intros; rewrite <- H9; apply (H20 i); rewrite H9; rewrite H9 in H1; - simpl in |- *; simpl in H1; apply lt_S_n; apply H1. + simpl; simpl in H1; apply lt_S_n; apply H1. rewrite H3 in H1; clear H4; unfold adapted_couple in H1; decompose [and] H1; clear H1; clear H H7 H9; cut (Rmax a b = b); [ intro; rewrite H in H5; rewrite <- H5; apply RList_P7; - [ assumption | simpl in |- *; right; left; reflexivity ] - | unfold Rmax in |- *; case (Rle_dec a b); intro; + [ assumption | simpl; right; left; reflexivity ] + | unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ] ]. Qed. @@ -534,7 +534,7 @@ Proof. simpl in H9; rewrite H9 in H16; cut (r1 <= Rmax a b). intro; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H17 H16)). rewrite <- H4; apply RList_P7; - [ assumption | simpl in |- *; right; left; reflexivity ]. + [ assumption | simpl; right; left; reflexivity ]. clear Hrecs3; induction lf2 as [| r5 lf2 Hreclf2]. simpl in H11; discriminate. clear Hreclf2; assert (H17 : r3 = r4). @@ -544,31 +544,31 @@ Proof. simpl in H18; rewrite <- (H17 x). rewrite <- (H18 x). reflexivity. - rewrite <- H12; unfold x in |- *; split. + rewrite <- H12; unfold x; split. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite (Rplus_comm r); rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. - unfold x in |- *; split. + unfold x; split. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. apply Rlt_trans with s2; [ apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite (Rplus_comm r); rewrite double; apply Rplus_lt_compat_l; assumption @@ -576,8 +576,8 @@ Proof. | assumption ]. assert (H18 : f s2 = r3). apply (H8 0%nat); - [ simpl in |- *; apply lt_O_Sn - | unfold open_interval in |- *; simpl in |- *; split; assumption ]. + [ simpl; apply lt_O_Sn + | unfold open_interval; simpl; split; assumption ]. assert (H19 : r3 = r5). assert (H19 := H7 1%nat); simpl in H19; assert (H20 := H19 (lt_n_S _ _ (lt_O_Sn _))); elim H20; @@ -587,18 +587,18 @@ Proof. rewrite <- (H22 (lt_O_Sn _) x). rewrite <- (H23 (lt_n_S _ _ (lt_O_Sn _)) x). reflexivity. - unfold open_interval in |- *; simpl in |- *; unfold x in |- *; split. + unfold open_interval; simpl; unfold x; split. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; - unfold Rmin in |- *; case (Rle_dec r1 r0); intro; + unfold Rmin; case (Rle_dec r1 r0); intro; assumption | discrR ] ]. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rlt_le_trans with (r0 + Rmin r1 r0); @@ -606,20 +606,20 @@ Proof. assumption | apply Rplus_le_compat_l; apply Rmin_r ] | discrR ] ]. - unfold open_interval in |- *; simpl in |- *; unfold x in |- *; split. + unfold open_interval; simpl; unfold x; split. apply Rlt_trans with s2; [ assumption | apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; - unfold Rmin in |- *; case (Rle_dec r1 r0); + unfold Rmin; case (Rle_dec r1 r0); intro; assumption | discrR ] ] ]. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rlt_le_trans with (r1 + Rmin r1 r0); @@ -636,20 +636,20 @@ Proof. | elim H24; rewrite <- H17; assumption ]. elim H2; clear H2; intros; assert (H17 := H16 0%nat); simpl in H17; elim (H17 (lt_O_Sn _)); assumption. - rewrite <- H0; rewrite H12; apply (H7 0%nat); simpl in |- *; apply lt_O_Sn. + rewrite <- H0; rewrite H12; apply (H7 0%nat); simpl; apply lt_O_Sn. Qed. Lemma StepFun_P12 : forall (a b:R) (f:R -> R) (l lf:Rlist), adapted_couple_opt f a b l lf -> adapted_couple_opt f b a l lf. Proof. - unfold adapted_couple_opt in |- *; unfold adapted_couple in |- *; intros; + unfold adapted_couple_opt; unfold adapted_couple; intros; decompose [and] H; clear H; repeat split; try assumption. - rewrite H0; unfold Rmin in |- *; case (Rle_dec a b); intro; + rewrite H0; unfold Rmin; case (Rle_dec a b); intro; case (Rle_dec b a); intro; try reflexivity. apply Rle_antisym; assumption. apply Rle_antisym; auto with real. - rewrite H3; unfold Rmax in |- *; case (Rle_dec a b); intro; + rewrite H3; unfold Rmax; case (Rle_dec a b); intro; case (Rle_dec b a); intro; try reflexivity. apply Rle_antisym; assumption. apply Rle_antisym; auto with real. @@ -689,10 +689,10 @@ Proof. case (Req_dec a b); intro. rewrite (StepFun_P8 H2 H4); rewrite (StepFun_P8 H H4); reflexivity. assert (Hyp_min : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. assert (Hyp_max : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. elim (RList_P20 _ (StepFun_P9 H H4)); intros s1 [s2 [s3 H5]]; rewrite H5 in H; rewrite H5; induction lf1 as [| r3 lf1 Hreclf1]. @@ -716,34 +716,34 @@ Proof. rewrite <- (H20 (lt_O_Sn _) x). reflexivity. assert (H21 := H13 0%nat (lt_O_Sn _)); simpl in H21; elim H21; intro; - [ idtac | elim H7; assumption ]; unfold x in |- *; + [ idtac | elim H7; assumption ]; unfold x; split. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; apply H | discrR ] ]. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite <- (Rplus_comm r1); rewrite double; apply Rplus_lt_compat_l; apply H | discrR ] ]. rewrite <- H6; assert (H21 := H13 0%nat (lt_O_Sn _)); simpl in H21; elim H21; - intro; [ idtac | elim H7; assumption ]; unfold x in |- *; + intro; [ idtac | elim H7; assumption ]; unfold x; split. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; apply H | discrR ] ]. apply Rlt_le_trans with r1; [ apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite <- (Rplus_comm r1); rewrite double; apply Rplus_lt_compat_l; apply H @@ -752,64 +752,64 @@ Proof. eapply StepFun_P13. apply H4. apply H2. - unfold adapted_couple_opt in |- *; split. + unfold adapted_couple_opt; split. apply H. rewrite H5 in H3; apply H3. assert (H8 : r1 <= s2). eapply StepFun_P13. apply H4. apply H2. - unfold adapted_couple_opt in |- *; split. + unfold adapted_couple_opt; split. apply H. rewrite H5 in H3; apply H3. elim H7; intro. - simpl in |- *; elim H8; intro. + simpl; elim H8; intro. replace (r4 * (s2 - s1)) with (r3 * (r1 - r) + r3 * (s2 - r1)); [ idtac | rewrite H9; rewrite H6; ring ]. rewrite Rplus_assoc; apply Rplus_eq_compat_l; change (Int_SF lf1 (cons r1 r2) = Int_SF (cons r3 lf2) (cons r1 (cons s2 s3))) - in |- *; apply H0 with r1 b. + ; apply H0 with r1 b. unfold adapted_couple in H2; decompose [and] H2; clear H2; replace b with (Rmax a b). rewrite <- H12; apply RList_P7; - [ assumption | simpl in |- *; right; left; reflexivity ]. + [ assumption | simpl; right; left; reflexivity ]. eapply StepFun_P7. apply H1. apply H2. - unfold adapted_couple_opt in |- *; split. + unfold adapted_couple_opt; split. apply StepFun_P7 with a a r3. apply H1. unfold adapted_couple in H2, H; decompose [and] H2; decompose [and] H; clear H H2; assert (H20 : r = a). simpl in H13; rewrite H13; apply Hyp_min. - unfold adapted_couple in |- *; repeat split. - unfold ordered_Rlist in |- *; intros; simpl in H; induction i as [| i Hreci]. - simpl in |- *; rewrite <- H20; apply (H11 0%nat). - simpl in |- *; apply lt_O_Sn. + unfold adapted_couple; repeat split. + unfold ordered_Rlist; intros; simpl in H; induction i as [| i Hreci]. + simpl; rewrite <- H20; apply (H11 0%nat). + simpl; apply lt_O_Sn. induction i as [| i Hreci0]. - simpl in |- *; assumption. - change (pos_Rl (cons s2 s3) i <= pos_Rl (cons s2 s3) (S i)) in |- *; - apply (H15 (S i)); simpl in |- *; apply lt_S_n; assumption. - simpl in |- *; symmetry in |- *; apply Hyp_min. + simpl; assumption. + change (pos_Rl (cons s2 s3) i <= pos_Rl (cons s2 s3) (S i)); + apply (H15 (S i)); simpl; apply lt_S_n; assumption. + simpl; symmetry ; apply Hyp_min. rewrite <- H17; reflexivity. - simpl in H19; simpl in |- *; rewrite H19; reflexivity. - intros; simpl in H; unfold constant_D_eq, open_interval in |- *; intros; + simpl in H19; simpl; rewrite H19; reflexivity. + intros; simpl in H; unfold constant_D_eq, open_interval; intros; induction i as [| i Hreci]. - simpl in |- *; apply (H16 0%nat). - simpl in |- *; apply lt_O_Sn. - simpl in H2; rewrite <- H20 in H2; unfold open_interval in |- *; - simpl in |- *; apply H2. + simpl; apply (H16 0%nat). + simpl; apply lt_O_Sn. + simpl in H2; rewrite <- H20 in H2; unfold open_interval; + simpl; apply H2. clear Hreci; induction i as [| i Hreci]. - simpl in |- *; simpl in H2; rewrite H9; apply (H21 0%nat). - simpl in |- *; apply lt_O_Sn. - unfold open_interval in |- *; simpl in |- *; elim H2; intros; split. + simpl; simpl in H2; rewrite H9; apply (H21 0%nat). + simpl; apply lt_O_Sn. + unfold open_interval; simpl; elim H2; intros; split. apply Rle_lt_trans with r1; try assumption; rewrite <- H6; apply (H11 0%nat); - simpl in |- *; apply lt_O_Sn. + simpl; apply lt_O_Sn. assumption. - clear Hreci; simpl in |- *; apply (H21 (S i)). - simpl in |- *; apply lt_S_n; assumption. - unfold open_interval in |- *; apply H2. + clear Hreci; simpl; apply (H21 (S i)). + simpl; apply lt_S_n; assumption. + unfold open_interval; apply H2. elim H3; clear H3; intros; split. rewrite H9; change @@ -817,64 +817,64 @@ Proof. (i < pred (Rlength (cons r4 lf2)))%nat -> pos_Rl (cons r4 lf2) i <> pos_Rl (cons r4 lf2) (S i) \/ f (pos_Rl (cons s1 (cons s2 s3)) (S i)) <> pos_Rl (cons r4 lf2) i) - in |- *; rewrite <- H5; apply H3. + ; rewrite <- H5; apply H3. rewrite H5 in H11; intros; simpl in H12; induction i as [| i Hreci]. - simpl in |- *; red in |- *; intro; rewrite H13 in H10; + simpl; red; intro; rewrite H13 in H10; elim (Rlt_irrefl _ H10). - clear Hreci; apply (H11 (S i)); simpl in |- *; apply H12. + clear Hreci; apply (H11 (S i)); simpl; apply H12. rewrite H9; rewrite H10; rewrite H6; apply Rplus_eq_compat_l; rewrite <- H10; apply H0 with r1 b. unfold adapted_couple in H2; decompose [and] H2; clear H2; replace b with (Rmax a b). rewrite <- H12; apply RList_P7; - [ assumption | simpl in |- *; right; left; reflexivity ]. + [ assumption | simpl; right; left; reflexivity ]. eapply StepFun_P7. apply H1. apply H2. - unfold adapted_couple_opt in |- *; split. + unfold adapted_couple_opt; split. apply StepFun_P7 with a a r3. apply H1. unfold adapted_couple in H2, H; decompose [and] H2; decompose [and] H; clear H H2; assert (H20 : r = a). simpl in H13; rewrite H13; apply Hyp_min. - unfold adapted_couple in |- *; repeat split. - unfold ordered_Rlist in |- *; intros; simpl in H; induction i as [| i Hreci]. - simpl in |- *; rewrite <- H20; apply (H11 0%nat); simpl in |- *; + unfold adapted_couple; repeat split. + unfold ordered_Rlist; intros; simpl in H; induction i as [| i Hreci]. + simpl; rewrite <- H20; apply (H11 0%nat); simpl; apply lt_O_Sn. - rewrite H10; apply (H15 (S i)); simpl in |- *; assumption. - simpl in |- *; symmetry in |- *; apply Hyp_min. + rewrite H10; apply (H15 (S i)); simpl; assumption. + simpl; symmetry ; apply Hyp_min. rewrite <- H17; rewrite H10; reflexivity. - simpl in H19; simpl in |- *; apply H19. - intros; simpl in H; unfold constant_D_eq, open_interval in |- *; intros; + simpl in H19; simpl; apply H19. + intros; simpl in H; unfold constant_D_eq, open_interval; intros; induction i as [| i Hreci]. - simpl in |- *; apply (H16 0%nat). - simpl in |- *; apply lt_O_Sn. - simpl in H2; rewrite <- H20 in H2; unfold open_interval in |- *; - simpl in |- *; apply H2. - clear Hreci; simpl in |- *; apply (H21 (S i)). - simpl in |- *; assumption. - rewrite <- H10; unfold open_interval in |- *; apply H2. + simpl; apply (H16 0%nat). + simpl; apply lt_O_Sn. + simpl in H2; rewrite <- H20 in H2; unfold open_interval; + simpl; apply H2. + clear Hreci; simpl; apply (H21 (S i)). + simpl; assumption. + rewrite <- H10; unfold open_interval; apply H2. elim H3; clear H3; intros; split. rewrite H5 in H3; intros; apply (H3 (S i)). - simpl in |- *; replace (Rlength lf2) with (S (pred (Rlength lf2))). + simpl; replace (Rlength lf2) with (S (pred (Rlength lf2))). apply lt_n_S; apply H12. - symmetry in |- *; apply S_pred with 0%nat; apply neq_O_lt; red in |- *; + symmetry ; apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H13 in H12; elim (lt_n_O _ H12). intros; simpl in H12; rewrite H10; rewrite H5 in H11; apply (H11 (S i)); - simpl in |- *; apply lt_n_S; apply H12. - simpl in |- *; rewrite H9; unfold Rminus in |- *; rewrite Rplus_opp_r; + simpl; apply lt_n_S; apply H12. + simpl; rewrite H9; unfold Rminus; rewrite Rplus_opp_r; rewrite Rmult_0_r; rewrite Rplus_0_l; change (Int_SF lf1 (cons r1 r2) = Int_SF (cons r4 lf2) (cons s1 (cons s2 s3))) - in |- *; eapply H0. + ; eapply H0. apply H1. - 2: rewrite H5 in H3; unfold adapted_couple_opt in |- *; split; assumption. + 2: rewrite H5 in H3; unfold adapted_couple_opt; split; assumption. assert (H10 : r = a). unfold adapted_couple in H2; decompose [and] H2; clear H2; simpl in H12; rewrite H12; apply Hyp_min. rewrite <- H9; rewrite H10; apply StepFun_P7 with a r r3; [ apply H1 - | pattern a at 2 in |- *; rewrite <- H10; pattern r at 2 in |- *; rewrite H9; + | pattern a at 2; rewrite <- H10; pattern r at 2; rewrite H9; apply H2 ]. Qed. @@ -918,12 +918,12 @@ Qed. Lemma StepFun_P18 : forall a b c:R, RiemannInt_SF (mkStepFun (StepFun_P4 a b c)) = c * (b - a). Proof. - intros; unfold RiemannInt_SF in |- *; case (Rle_dec a b); intro. + intros; unfold RiemannInt_SF; case (Rle_dec a b); intro. replace (Int_SF (subdivision_val (mkStepFun (StepFun_P4 a b c))) (subdivision (mkStepFun (StepFun_P4 a b c)))) with (Int_SF (cons c nil) (cons a (cons b nil))); - [ simpl in |- *; ring + [ simpl; ring | apply StepFun_P17 with (fct_cte c) a b; [ apply StepFun_P3; assumption | apply (StepFun_P1 (mkStepFun (StepFun_P4 a b c))) ] ]. @@ -931,7 +931,7 @@ Proof. (Int_SF (subdivision_val (mkStepFun (StepFun_P4 a b c))) (subdivision (mkStepFun (StepFun_P4 a b c)))) with (Int_SF (cons c nil) (cons b (cons a nil))); - [ simpl in |- *; ring + [ simpl; ring | apply StepFun_P17 with (fct_cte c) a b; [ apply StepFun_P2; apply StepFun_P3; auto with real | apply (StepFun_P1 (mkStepFun (StepFun_P4 a b c))) ] ]. @@ -943,8 +943,8 @@ Lemma StepFun_P19 : Int_SF (FF l1 f) l1 + l * Int_SF (FF l1 g) l1. Proof. intros; induction l1 as [| r l1 Hrecl1]; - [ simpl in |- *; ring - | induction l1 as [| r0 l1 Hrecl0]; simpl in |- *; + [ simpl; ring + | induction l1 as [| r0 l1 Hrecl0]; simpl; [ ring | simpl in Hrecl1; rewrite Hrecl1; ring ] ]. Qed. @@ -954,38 +954,38 @@ Lemma StepFun_P20 : Proof. intros l f H; induction l; [ elim (lt_irrefl _ H) - | simpl in |- *; rewrite RList_P18; rewrite RList_P14; reflexivity ]. + | simpl; rewrite RList_P18; rewrite RList_P14; reflexivity ]. Qed. Lemma StepFun_P21 : forall (a b:R) (f:R -> R) (l:Rlist), is_subdivision f a b l -> adapted_couple f a b l (FF l f). Proof. - intros; unfold adapted_couple in |- *; unfold is_subdivision in X; + intros; unfold adapted_couple; unfold is_subdivision in X; unfold adapted_couple in X; elim X; clear X; intros; decompose [and] p; clear p; repeat split; try assumption. apply StepFun_P20; rewrite H2; apply lt_O_Sn. intros; assert (H5 := H4 _ H3); unfold constant_D_eq, open_interval in H5; - unfold constant_D_eq, open_interval in |- *; intros; + unfold constant_D_eq, open_interval; intros; induction l as [| r l Hrecl]. discriminate. - unfold FF in |- *; rewrite RList_P12. - simpl in |- *; - change (f x0 = f (pos_Rl (mid_Rlist (cons r l) r) (S i))) in |- *; + unfold FF; rewrite RList_P12. + simpl; + change (f x0 = f (pos_Rl (mid_Rlist (cons r l) r) (S i))); rewrite RList_P13; try assumption; rewrite (H5 x0 H6); rewrite H5. reflexivity. split. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; elim H6; intros; apply Rlt_trans with x0; assumption | discrR ] ]. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; rewrite (Rplus_comm (pos_Rl (cons r l) i)); @@ -1001,22 +1001,22 @@ Lemma StepFun_P22 : is_subdivision f a b lf -> is_subdivision g a b lg -> is_subdivision f a b (cons_ORlist lf lg). Proof. - unfold is_subdivision in |- *; intros a b f g lf lg Hyp X X0; elim X; elim X0; + unfold is_subdivision; intros a b f g lf lg Hyp X X0; elim X; elim X0; clear X X0; intros lg0 p lf0 p0; assert (Hyp_min : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. assert (Hyp_max : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. apply existT with (FF (cons_ORlist lf lg) f); unfold adapted_couple in p, p0; decompose [and] p; decompose [and] p0; clear p p0; rewrite Hyp_min in H6; rewrite Hyp_min in H1; rewrite Hyp_max in H0; - rewrite Hyp_max in H5; unfold adapted_couple in |- *; + rewrite Hyp_max in H5; unfold adapted_couple; repeat split. apply RList_P2; assumption. - rewrite Hyp_min; symmetry in |- *; apply Rle_antisym. + rewrite Hyp_min; symmetry ; apply Rle_antisym. induction lf as [| r lf Hreclf]. - simpl in |- *; right; symmetry in |- *; assumption. + simpl; right; symmetry ; assumption. assert (H10 : In (pos_Rl (cons_ORlist (cons r lf) lg) 0) (cons_ORlist (cons r lf) lg)). @@ -1024,7 +1024,7 @@ Proof. (RList_P3 (cons_ORlist (cons r lf) lg) (pos_Rl (cons_ORlist (cons r lf) lg) 0)); intros _ H10; apply H10; exists 0%nat; split; - [ reflexivity | rewrite RList_P11; simpl in |- *; apply lt_O_Sn ]. + [ reflexivity | rewrite RList_P11; simpl; apply lt_O_Sn ]. elim (RList_P9 (cons r lf) lg (pos_Rl (cons_ORlist (cons r lf) lg) 0)); intros H12 _; assert (H13 := H12 H10); elim H13; intro. elim (RList_P3 (cons r lf) (pos_Rl (cons_ORlist (cons r lf) lg) 0)); @@ -1037,16 +1037,16 @@ Proof. clear H15; intros; rewrite H15; rewrite <- H1; elim (RList_P6 lg); intros; apply H17; [ assumption | apply le_O_n | assumption ]. induction lf as [| r lf Hreclf]. - simpl in |- *; right; assumption. + simpl; right; assumption. assert (H8 : In a (cons_ORlist (cons r lf) lg)). elim (RList_P9 (cons r lf) lg a); intros; apply H10; left; elim (RList_P3 (cons r lf) a); intros; apply H12; exists 0%nat; split; - [ symmetry in |- *; assumption | simpl in |- *; apply lt_O_Sn ]. + [ symmetry ; assumption | simpl; apply lt_O_Sn ]. apply RList_P5; [ apply RList_P2; assumption | assumption ]. rewrite Hyp_max; apply Rle_antisym. induction lf as [| r lf Hreclf]. - simpl in |- *; right; assumption. + simpl; right; assumption. assert (H8 : In @@ -1059,7 +1059,7 @@ Proof. (pred (Rlength (cons_ORlist (cons r lf) lg))))); intros _ H10; apply H10; exists (pred (Rlength (cons_ORlist (cons r lf) lg))); - split; [ reflexivity | rewrite RList_P11; simpl in |- *; apply lt_n_Sn ]. + split; [ reflexivity | rewrite RList_P11; simpl; apply lt_n_Sn ]. elim (RList_P9 (cons r lf) lg (pos_Rl (cons_ORlist (cons r lf) lg) @@ -1074,8 +1074,8 @@ Proof. elim H15; clear H15; intros; rewrite H15; rewrite <- H5; elim (RList_P6 (cons r lf)); intros; apply H17; [ assumption - | simpl in |- *; simpl in H14; apply lt_n_Sm_le; assumption - | simpl in |- *; apply lt_n_Sn ]. + | simpl; simpl in H14; apply lt_n_Sm_le; assumption + | simpl; apply lt_n_Sn ]. elim (RList_P3 lg (pos_Rl (cons_ORlist (cons r lf) lg) @@ -1083,23 +1083,23 @@ Proof. intros H13 _; assert (H14 := H13 H12); elim H14; intros; elim H15; clear H15; intros. rewrite H15; assert (H17 : Rlength lg = S (pred (Rlength lg))). - apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro; + apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H17 in H16; elim (lt_n_O _ H16). rewrite <- H0; elim (RList_P6 lg); intros; apply H18; [ assumption | rewrite H17 in H16; apply lt_n_Sm_le; assumption | apply lt_pred_n_n; rewrite H17; apply lt_O_Sn ]. induction lf as [| r lf Hreclf]. - simpl in |- *; right; symmetry in |- *; assumption. + simpl; right; symmetry ; assumption. assert (H8 : In b (cons_ORlist (cons r lf) lg)). elim (RList_P9 (cons r lf) lg b); intros; apply H10; left; elim (RList_P3 (cons r lf) b); intros; apply H12; exists (pred (Rlength (cons r lf))); split; - [ symmetry in |- *; assumption | simpl in |- *; apply lt_n_Sn ]. + [ symmetry ; assumption | simpl; apply lt_n_Sn ]. apply RList_P7; [ apply RList_P2; assumption | assumption ]. - apply StepFun_P20; rewrite RList_P11; rewrite H2; rewrite H7; simpl in |- *; + apply StepFun_P20; rewrite RList_P11; rewrite H2; rewrite H7; simpl; apply lt_O_Sn. - intros; unfold constant_D_eq, open_interval in |- *; intros; + intros; unfold constant_D_eq, open_interval; intros; cut (exists l : R, constant_D_eq f @@ -1109,10 +1109,10 @@ Proof. assert (Hyp_cons : exists r : R, (exists r0 : Rlist, cons_ORlist lf lg = cons r r0)). - apply RList_P19; red in |- *; intro; rewrite H13 in H8; elim (lt_n_O _ H8). + apply RList_P19; red; intro; rewrite H13 in H8; elim (lt_n_O _ H8). elim Hyp_cons; clear Hyp_cons; intros r [r0 Hyp_cons]; rewrite Hyp_cons; - unfold FF in |- *; rewrite RList_P12. - change (f x = f (pos_Rl (mid_Rlist (cons r r0) r) (S i))) in |- *; + unfold FF; rewrite RList_P12. + change (f x = f (pos_Rl (mid_Rlist (cons r r0) r) (S i))); rewrite <- Hyp_cons; rewrite RList_P13. assert (H13 := RList_P2 _ _ H _ H8); elim H13; intro. unfold constant_D_eq, open_interval in H11, H12; rewrite (H11 x H10); @@ -1124,13 +1124,13 @@ Proof. split. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; rewrite (Rplus_comm (pos_Rl (cons_ORlist lf lg) i)); @@ -1149,7 +1149,7 @@ Proof. apply le_O_n. apply lt_trans with (pred (Rlength (cons_ORlist lf lg))); [ assumption - | apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; + | apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H13 in H8; elim (lt_n_O _ H8) ]. assumption. assumption. @@ -1160,7 +1160,7 @@ Proof. elim (RList_P6 (cons_ORlist lf lg)); intros; apply H11. apply RList_P2; assumption. apply lt_n_Sm_le; apply lt_n_S; assumption. - apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H13 in H8; + apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H13 in H8; elim (lt_n_O _ H8). rewrite H0; assumption. set @@ -1168,24 +1168,24 @@ Proof. fun j:nat => pos_Rl lf j <= pos_Rl (cons_ORlist lf lg) i /\ (j < Rlength lf)%nat); assert (H12 : Nbound I). - unfold Nbound in |- *; exists (Rlength lf); intros; unfold I in H12; elim H12; + unfold Nbound; exists (Rlength lf); intros; unfold I in H12; elim H12; intros; apply lt_le_weak; assumption. assert (H13 : exists n : nat, I n). - exists 0%nat; unfold I in |- *; split. + exists 0%nat; unfold I; split. apply Rle_trans with (pos_Rl (cons_ORlist lf lg) 0). - right; symmetry in |- *. + right; symmetry . apply RList_P15; try assumption; rewrite H1; assumption. elim (RList_P6 (cons_ORlist lf lg)); intros; apply H13. apply RList_P2; assumption. apply le_O_n. apply lt_trans with (pred (Rlength (cons_ORlist lf lg))). assumption. - apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H15 in H8; + apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H15 in H8; elim (lt_n_O _ H8). - apply neq_O_lt; red in |- *; intro; rewrite <- H13 in H5; + apply neq_O_lt; red; intro; rewrite <- H13 in H5; rewrite <- H6 in H11; rewrite <- H5 in H11; elim (Rlt_irrefl _ H11). assert (H14 := Nzorn H13 H12); elim H14; clear H14; intros x0 H14; - exists (pos_Rl lf0 x0); unfold constant_D_eq, open_interval in |- *; + exists (pos_Rl lf0 x0); unfold constant_D_eq, open_interval; intros; assert (H16 := H9 x0); assert (H17 : (x0 < pred (Rlength lf))%nat). elim H14; clear H14; intros; unfold I in H14; elim H14; clear H14; intros; apply lt_S_n; replace (S (pred (Rlength lf))) with (Rlength lf). @@ -1203,11 +1203,11 @@ Proof. elim (RList_P6 (cons_ORlist lf lg)); intros; apply H21. apply RList_P2; assumption. apply lt_n_Sm_le; apply lt_n_S; assumption. - apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H23 in H8; + apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H23 in H8; elim (lt_n_O _ H8). right; apply RList_P16; try assumption; rewrite H0; assumption. rewrite <- H20; reflexivity. - apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro; + apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H19 in H18; elim (lt_n_O _ H18). assert (H18 := H16 H17); unfold constant_D_eq, open_interval in H18; rewrite (H18 x1). @@ -1219,11 +1219,11 @@ Proof. assert (H22 : (S x0 < Rlength lf)%nat). replace (Rlength lf) with (S (pred (Rlength lf))); [ apply lt_n_S; assumption - | symmetry in |- *; apply S_pred with 0%nat; apply neq_O_lt; red in |- *; + | symmetry ; apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H22 in H21; elim (lt_n_O _ H21) ]. elim (Rle_dec (pos_Rl lf (S x0)) (pos_Rl (cons_ORlist lf lg) i)); intro. assert (H23 : (S x0 <= x0)%nat). - apply H20; unfold I in |- *; split; assumption. + apply H20; unfold I; split; assumption. elim (le_Sn_n _ H23). assert (H23 : pos_Rl (cons_ORlist lf lg) i < pos_Rl lf (S x0)). auto with real. @@ -1253,22 +1253,22 @@ Lemma StepFun_P24 : is_subdivision f a b lf -> is_subdivision g a b lg -> is_subdivision g a b (cons_ORlist lf lg). Proof. - unfold is_subdivision in |- *; intros a b f g lf lg Hyp X X0; elim X; elim X0; + unfold is_subdivision; intros a b f g lf lg Hyp X X0; elim X; elim X0; clear X X0; intros lg0 p lf0 p0; assert (Hyp_min : Rmin a b = a). - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. assert (Hyp_max : Rmax a b = b). - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. apply existT with (FF (cons_ORlist lf lg) g); unfold adapted_couple in p, p0; decompose [and] p; decompose [and] p0; clear p p0; rewrite Hyp_min in H1; rewrite Hyp_min in H6; rewrite Hyp_max in H0; - rewrite Hyp_max in H5; unfold adapted_couple in |- *; + rewrite Hyp_max in H5; unfold adapted_couple; repeat split. apply RList_P2; assumption. - rewrite Hyp_min; symmetry in |- *; apply Rle_antisym. + rewrite Hyp_min; symmetry ; apply Rle_antisym. induction lf as [| r lf Hreclf]. - simpl in |- *; right; symmetry in |- *; assumption. + simpl; right; symmetry ; assumption. assert (H10 : In (pos_Rl (cons_ORlist (cons r lf) lg) 0) (cons_ORlist (cons r lf) lg)). @@ -1276,7 +1276,7 @@ Proof. (RList_P3 (cons_ORlist (cons r lf) lg) (pos_Rl (cons_ORlist (cons r lf) lg) 0)); intros _ H10; apply H10; exists 0%nat; split; - [ reflexivity | rewrite RList_P11; simpl in |- *; apply lt_O_Sn ]. + [ reflexivity | rewrite RList_P11; simpl; apply lt_O_Sn ]. elim (RList_P9 (cons r lf) lg (pos_Rl (cons_ORlist (cons r lf) lg) 0)); intros H12 _; assert (H13 := H12 H10); elim H13; intro. elim (RList_P3 (cons r lf) (pos_Rl (cons_ORlist (cons r lf) lg) 0)); @@ -1289,16 +1289,16 @@ Proof. clear H15; intros; rewrite H15; rewrite <- H1; elim (RList_P6 lg); intros; apply H17; [ assumption | apply le_O_n | assumption ]. induction lf as [| r lf Hreclf]. - simpl in |- *; right; assumption. + simpl; right; assumption. assert (H8 : In a (cons_ORlist (cons r lf) lg)). elim (RList_P9 (cons r lf) lg a); intros; apply H10; left; elim (RList_P3 (cons r lf) a); intros; apply H12; exists 0%nat; split; - [ symmetry in |- *; assumption | simpl in |- *; apply lt_O_Sn ]. + [ symmetry ; assumption | simpl; apply lt_O_Sn ]. apply RList_P5; [ apply RList_P2; assumption | assumption ]. rewrite Hyp_max; apply Rle_antisym. induction lf as [| r lf Hreclf]. - simpl in |- *; right; assumption. + simpl; right; assumption. assert (H8 : In @@ -1311,7 +1311,7 @@ Proof. (pred (Rlength (cons_ORlist (cons r lf) lg))))); intros _ H10; apply H10; exists (pred (Rlength (cons_ORlist (cons r lf) lg))); - split; [ reflexivity | rewrite RList_P11; simpl in |- *; apply lt_n_Sn ]. + split; [ reflexivity | rewrite RList_P11; simpl; apply lt_n_Sn ]. elim (RList_P9 (cons r lf) lg (pos_Rl (cons_ORlist (cons r lf) lg) @@ -1325,8 +1325,8 @@ Proof. elim H15; clear H15; intros; rewrite H15; rewrite <- H5; elim (RList_P6 (cons r lf)); intros; apply H17; [ assumption - | simpl in |- *; simpl in H14; apply lt_n_Sm_le; assumption - | simpl in |- *; apply lt_n_Sn ]. + | simpl; simpl in H14; apply lt_n_Sm_le; assumption + | simpl; apply lt_n_Sn ]. elim (RList_P3 lg (pos_Rl (cons_ORlist (cons r lf) lg) @@ -1334,23 +1334,23 @@ Proof. intros H13 _; assert (H14 := H13 H12); elim H14; intros; elim H15; clear H15; intros; rewrite H15; assert (H17 : Rlength lg = S (pred (Rlength lg))). - apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro; + apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H17 in H16; elim (lt_n_O _ H16). rewrite <- H0; elim (RList_P6 lg); intros; apply H18; [ assumption | rewrite H17 in H16; apply lt_n_Sm_le; assumption | apply lt_pred_n_n; rewrite H17; apply lt_O_Sn ]. induction lf as [| r lf Hreclf]. - simpl in |- *; right; symmetry in |- *; assumption. + simpl; right; symmetry ; assumption. assert (H8 : In b (cons_ORlist (cons r lf) lg)). elim (RList_P9 (cons r lf) lg b); intros; apply H10; left; elim (RList_P3 (cons r lf) b); intros; apply H12; exists (pred (Rlength (cons r lf))); split; - [ symmetry in |- *; assumption | simpl in |- *; apply lt_n_Sn ]. + [ symmetry ; assumption | simpl; apply lt_n_Sn ]. apply RList_P7; [ apply RList_P2; assumption | assumption ]. - apply StepFun_P20; rewrite RList_P11; rewrite H7; rewrite H2; simpl in |- *; + apply StepFun_P20; rewrite RList_P11; rewrite H7; rewrite H2; simpl; apply lt_O_Sn. - unfold constant_D_eq, open_interval in |- *; intros; + unfold constant_D_eq, open_interval; intros; cut (exists l : R, constant_D_eq g @@ -1360,10 +1360,10 @@ Proof. assert (Hyp_cons : exists r : R, (exists r0 : Rlist, cons_ORlist lf lg = cons r r0)). - apply RList_P19; red in |- *; intro; rewrite H13 in H8; elim (lt_n_O _ H8). + apply RList_P19; red; intro; rewrite H13 in H8; elim (lt_n_O _ H8). elim Hyp_cons; clear Hyp_cons; intros r [r0 Hyp_cons]; rewrite Hyp_cons; - unfold FF in |- *; rewrite RList_P12. - change (g x = g (pos_Rl (mid_Rlist (cons r r0) r) (S i))) in |- *; + unfold FF; rewrite RList_P12. + change (g x = g (pos_Rl (mid_Rlist (cons r r0) r) (S i))); rewrite <- Hyp_cons; rewrite RList_P13. assert (H13 := RList_P2 _ _ H _ H8); elim H13; intro. unfold constant_D_eq, open_interval in H11, H12; rewrite (H11 x H10); @@ -1375,13 +1375,13 @@ Proof. split. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; rewrite (Rplus_comm (pos_Rl (cons_ORlist lf lg) i)); @@ -1400,7 +1400,7 @@ Proof. apply le_O_n. apply lt_trans with (pred (Rlength (cons_ORlist lf lg))); [ assumption - | apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; + | apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H13 in H8; elim (lt_n_O _ H8) ]. rewrite H1; assumption. apply Rlt_le_trans with (pos_Rl (cons_ORlist lf lg) (S i)). @@ -1409,7 +1409,7 @@ Proof. elim (RList_P6 (cons_ORlist lf lg)); intros; apply H11. apply RList_P2; assumption. apply lt_n_Sm_le; apply lt_n_S; assumption. - apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H13 in H8; + apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H13 in H8; elim (lt_n_O _ H8). rewrite H0; assumption. set @@ -1417,24 +1417,24 @@ Proof. fun j:nat => pos_Rl lg j <= pos_Rl (cons_ORlist lf lg) i /\ (j < Rlength lg)%nat); assert (H12 : Nbound I). - unfold Nbound in |- *; exists (Rlength lg); intros; unfold I in H12; elim H12; + unfold Nbound; exists (Rlength lg); intros; unfold I in H12; elim H12; intros; apply lt_le_weak; assumption. assert (H13 : exists n : nat, I n). - exists 0%nat; unfold I in |- *; split. + exists 0%nat; unfold I; split. apply Rle_trans with (pos_Rl (cons_ORlist lf lg) 0). - right; symmetry in |- *; rewrite H1; rewrite <- H6; apply RList_P15; + right; symmetry ; rewrite H1; rewrite <- H6; apply RList_P15; try assumption; rewrite H1; assumption. elim (RList_P6 (cons_ORlist lf lg)); intros; apply H13; [ apply RList_P2; assumption | apply le_O_n | apply lt_trans with (pred (Rlength (cons_ORlist lf lg))); [ assumption - | apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; + | apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H15 in H8; elim (lt_n_O _ H8) ] ]. - apply neq_O_lt; red in |- *; intro; rewrite <- H13 in H0; + apply neq_O_lt; red; intro; rewrite <- H13 in H0; rewrite <- H1 in H11; rewrite <- H0 in H11; elim (Rlt_irrefl _ H11). assert (H14 := Nzorn H13 H12); elim H14; clear H14; intros x0 H14; - exists (pos_Rl lg0 x0); unfold constant_D_eq, open_interval in |- *; + exists (pos_Rl lg0 x0); unfold constant_D_eq, open_interval; intros; assert (H16 := H4 x0); assert (H17 : (x0 < pred (Rlength lg))%nat). elim H14; clear H14; intros; unfold I in H14; elim H14; clear H14; intros; apply lt_S_n; replace (S (pred (Rlength lg))) with (Rlength lg). @@ -1452,12 +1452,12 @@ Proof. elim (RList_P6 (cons_ORlist lf lg)); intros; apply H21. apply RList_P2; assumption. apply lt_n_Sm_le; apply lt_n_S; assumption. - apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H23 in H8; + apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H23 in H8; elim (lt_n_O _ H8). right; rewrite H0; rewrite <- H5; apply RList_P16; try assumption. rewrite H0; assumption. rewrite <- H20; reflexivity. - apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro; + apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H19 in H18; elim (lt_n_O _ H18). assert (H18 := H16 H17); unfold constant_D_eq, open_interval in H18; rewrite (H18 x1). @@ -1469,11 +1469,11 @@ Proof. assert (H22 : (S x0 < Rlength lg)%nat). replace (Rlength lg) with (S (pred (Rlength lg))). apply lt_n_S; assumption. - symmetry in |- *; apply S_pred with 0%nat; apply neq_O_lt; red in |- *; + symmetry ; apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H22 in H21; elim (lt_n_O _ H21). elim (Rle_dec (pos_Rl lg (S x0)) (pos_Rl (cons_ORlist lf lg) i)); intro. assert (H23 : (S x0 <= x0)%nat); - [ apply H20; unfold I in |- *; split; assumption | elim (le_Sn_n _ H23) ]. + [ apply H20; unfold I; split; assumption | elim (le_Sn_n _ H23) ]. assert (H23 : pos_Rl (cons_ORlist lf lg) i < pos_Rl lg (S x0)). auto with real. clear b0; apply RList_P17; try assumption; @@ -1509,35 +1509,35 @@ Proof. intros i H8 x1 H10; unfold open_interval in H10, H9, H4; rewrite (H9 _ H8 _ H10); rewrite (H4 _ H8 _ H10); assert (H11 : l1 <> nil). - red in |- *; intro H11; rewrite H11 in H8; elim (lt_n_O _ H8). + red; intro H11; rewrite H11 in H8; elim (lt_n_O _ H8). destruct (RList_P19 _ H11) as (r,(r0,H12)); - rewrite H12; unfold FF in |- *; + rewrite H12; unfold FF; change (pos_Rl x0 i + l * pos_Rl x i = pos_Rl (app_Rlist (mid_Rlist (cons r r0) r) (fun x2:R => f x2 + l * g x2)) - (S i)) in |- *; rewrite RList_P12. + (S i)); rewrite RList_P12. rewrite RList_P13. rewrite <- H12; rewrite (H9 _ H8); try rewrite (H4 _ H8); reflexivity || (elim H10; clear H10; intros; split; [ apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; apply Rlt_trans with x1; assumption | discrR ] ] | apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; rewrite (Rplus_comm (pos_Rl l1 i)); apply Rplus_lt_compat_l; apply Rlt_trans with x1; assumption | discrR ] ] ]). rewrite <- H12; assumption. - rewrite RList_P14; simpl in |- *; rewrite H12 in H8; simpl in H8; + rewrite RList_P14; simpl; rewrite H12 in H8; simpl in H8; apply lt_n_S; apply H8. Qed. @@ -1556,7 +1556,7 @@ Qed. Lemma StepFun_P28 : forall (a b l:R) (f g:StepFun a b), IsStepFun (fun x:R => f x + l * g x) a b. Proof. - intros a b l f g; unfold IsStepFun in |- *; assert (H := pre f); + intros a b l f g; unfold IsStepFun; assert (H := pre f); assert (H0 := pre g); unfold IsStepFun in H, H0; elim H; elim H0; intros; apply existT with (cons_ORlist x0 x); apply StepFun_P27; assumption. @@ -1565,7 +1565,7 @@ Qed. Lemma StepFun_P29 : forall (a b:R) (f:StepFun a b), is_subdivision f a b (subdivision f). Proof. - intros a b f; unfold is_subdivision in |- *; + intros a b f; unfold is_subdivision; apply existT with (subdivision_val f); apply StepFun_P1. Qed. @@ -1574,7 +1574,7 @@ Lemma StepFun_P30 : RiemannInt_SF (mkStepFun (StepFun_P28 l f g)) = RiemannInt_SF f + l * RiemannInt_SF g. Proof. - intros a b l f g; unfold RiemannInt_SF in |- *; case (Rle_dec a b); + intros a b l f g; unfold RiemannInt_SF; case (Rle_dec a b); (intro; replace (Int_SF (subdivision_val (mkStepFun (StepFun_P28 l f g))) @@ -1611,10 +1611,10 @@ Lemma StepFun_P31 : adapted_couple f a b l lf -> adapted_couple (fun x:R => Rabs (f x)) a b l (app_Rlist lf Rabs). Proof. - unfold adapted_couple in |- *; intros; decompose [and] H; clear H; + unfold adapted_couple; intros; decompose [and] H; clear H; repeat split; try assumption. - symmetry in |- *; rewrite H3; rewrite RList_P18; reflexivity. - intros; unfold constant_D_eq, open_interval in |- *; + symmetry ; rewrite H3; rewrite RList_P18; reflexivity. + intros; unfold constant_D_eq, open_interval; unfold constant_D_eq, open_interval in H5; intros; rewrite (H5 _ H _ H4); rewrite RList_P12; [ reflexivity | rewrite H3 in H; simpl in H; apply H ]. @@ -1623,8 +1623,8 @@ Qed. Lemma StepFun_P32 : forall (a b:R) (f:StepFun a b), IsStepFun (fun x:R => Rabs (f x)) a b. Proof. - intros a b f; unfold IsStepFun in |- *; apply existT with (subdivision f); - unfold is_subdivision in |- *; + intros a b f; unfold IsStepFun; apply existT with (subdivision f); + unfold is_subdivision; apply existT with (app_Rlist (subdivision_val f) Rabs); apply StepFun_P31; apply StepFun_P1. Qed. @@ -1634,8 +1634,8 @@ Lemma StepFun_P33 : ordered_Rlist l1 -> Rabs (Int_SF l2 l1) <= Int_SF (app_Rlist l2 Rabs) l1. Proof. simple induction l2; intros. - simpl in |- *; rewrite Rabs_R0; right; reflexivity. - simpl in |- *; induction l1 as [| r1 l1 Hrecl1]. + simpl; rewrite Rabs_R0; right; reflexivity. + simpl; induction l1 as [| r1 l1 Hrecl1]. rewrite Rabs_R0; right; reflexivity. induction l1 as [| r2 l1 Hrecl0]. rewrite Rabs_R0; right; reflexivity. @@ -1643,7 +1643,7 @@ Proof. apply Rabs_triang. rewrite Rabs_mult; rewrite (Rabs_right (r2 - r1)); [ apply Rplus_le_compat_l; apply H; apply RList_P4 with r1; assumption - | apply Rge_minus; apply Rle_ge; apply (H0 0%nat); simpl in |- *; + | apply Rge_minus; apply Rle_ge; apply (H0 0%nat); simpl; apply lt_O_Sn ]. Qed. @@ -1652,7 +1652,7 @@ Lemma StepFun_P34 : a <= b -> Rabs (RiemannInt_SF f) <= RiemannInt_SF (mkStepFun (StepFun_P32 f)). Proof. - intros; unfold RiemannInt_SF in |- *; case (Rle_dec a b); intro. + intros; unfold RiemannInt_SF; case (Rle_dec a b); intro. replace (Int_SF (subdivision_val (mkStepFun (StepFun_P32 f))) (subdivision (mkStepFun (StepFun_P32 f)))) with @@ -1676,18 +1676,18 @@ Lemma StepFun_P35 : Proof. simple induction l; intros. right; reflexivity. - simpl in |- *; induction r0 as [| r0 r1 Hrecr0]. + simpl; induction r0 as [| r0 r1 Hrecr0]. right; reflexivity. - simpl in |- *; apply Rplus_le_compat. + simpl; apply Rplus_le_compat. case (Req_dec r r0); intro. rewrite H4; right; ring. do 2 rewrite <- (Rmult_comm (r0 - r)); apply Rmult_le_compat_l. - apply Rge_le; apply Rge_minus; apply Rle_ge; apply (H0 0%nat); simpl in |- *; + apply Rge_le; apply Rge_minus; apply Rle_ge; apply (H0 0%nat); simpl; apply lt_O_Sn. apply H3; split. apply Rmult_lt_reg_l with 2. prove_sup0. - unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. assert (H5 : r = a). apply H1. @@ -1700,7 +1700,7 @@ Proof. discrR. apply Rmult_lt_reg_l with 2. prove_sup0. - unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_l; rewrite double; assert (H5 : r0 <= b). replace b with @@ -1708,9 +1708,9 @@ Proof. replace r0 with (pos_Rl (cons r (cons r0 r1)) 1). elim (RList_P6 (cons r (cons r0 r1))); intros; apply H5. assumption. - simpl in |- *; apply le_n_S. + simpl; apply le_n_S. apply le_O_n. - simpl in |- *; apply lt_n_Sn. + simpl; apply lt_n_Sn. reflexivity. apply Rle_lt_trans with (r + b). apply Rplus_le_compat_l; assumption. @@ -1730,7 +1730,7 @@ Proof. intros; apply H3; elim H4; intros; split; try assumption. apply Rle_lt_trans with r0; try assumption. rewrite <- H1. - simpl in |- *; apply (H0 0%nat); simpl in |- *; apply lt_O_Sn. + simpl; apply (H0 0%nat); simpl; apply lt_O_Sn. Qed. Lemma StepFun_P36 : @@ -1741,16 +1741,16 @@ Lemma StepFun_P36 : (forall x:R, a < x < b -> f x <= g x) -> RiemannInt_SF f <= RiemannInt_SF g. Proof. - intros; unfold RiemannInt_SF in |- *; case (Rle_dec a b); intro. + intros; unfold RiemannInt_SF; case (Rle_dec a b); intro. replace (Int_SF (subdivision_val f) (subdivision f)) with (Int_SF (FF l f) l). replace (Int_SF (subdivision_val g) (subdivision g)) with (Int_SF (FF l g) l). unfold is_subdivision in X; elim X; clear X; intros; unfold adapted_couple in p; decompose [and] p; clear p; assert (H5 : Rmin a b = a); - [ unfold Rmin in |- *; case (Rle_dec a b); intro; + [ unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ] | assert (H7 : Rmax a b = b); - [ unfold Rmax in |- *; case (Rle_dec a b); intro; + [ unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ] | rewrite H5 in H3; rewrite H7 in H2; eapply StepFun_P35 with a b; assumption ] ]. @@ -1809,27 +1809,27 @@ Proof. assert (H7 : r1 <= b). rewrite <- H4; apply RList_P7; [ assumption | left; reflexivity ]. assert (H8 : IsStepFun g' a b). - unfold IsStepFun in |- *; assert (H8 := pre g); unfold IsStepFun in H8; + unfold IsStepFun; assert (H8 := pre g); unfold IsStepFun in H8; elim H8; intros lg H9; unfold is_subdivision in H9; elim H9; clear H9; intros lg2 H9; split with (cons a lg); - unfold is_subdivision in |- *; split with (cons (f a) lg2); + unfold is_subdivision; split with (cons (f a) lg2); unfold adapted_couple in H9; decompose [and] H9; clear H9; - unfold adapted_couple in |- *; repeat split. - unfold ordered_Rlist in |- *; intros; simpl in H9; + unfold adapted_couple; repeat split. + unfold ordered_Rlist; intros; simpl in H9; induction i as [| i Hreci]. - simpl in |- *; rewrite H12; replace (Rmin r1 b) with r1. - simpl in H0; rewrite <- H0; apply (H 0%nat); simpl in |- *; apply lt_O_Sn. - unfold Rmin in |- *; case (Rle_dec r1 b); intro; + simpl; rewrite H12; replace (Rmin r1 b) with r1. + simpl in H0; rewrite <- H0; apply (H 0%nat); simpl; apply lt_O_Sn. + unfold Rmin; case (Rle_dec r1 b); intro; [ reflexivity | elim n; assumption ]. apply (H10 i); apply lt_S_n. replace (S (pred (Rlength lg))) with (Rlength lg). apply H9. apply S_pred with 0%nat; apply neq_O_lt; intro; rewrite <- H14 in H9; elim (lt_n_O _ H9). - simpl in |- *; assert (H14 : a <= b). + simpl; assert (H14 : a <= b). rewrite <- H1; simpl in H0; rewrite <- H0; apply RList_P7; [ assumption | left; reflexivity ]. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. assert (H14 : a <= b). rewrite <- H1; simpl in H0; rewrite <- H0; apply RList_P7; @@ -1838,30 +1838,30 @@ Proof. rewrite <- H11; induction lg as [| r0 lg Hreclg]. simpl in H13; discriminate. reflexivity. - unfold Rmax in |- *; case (Rle_dec a b); case (Rle_dec r1 b); intros; + unfold Rmax; case (Rle_dec a b); case (Rle_dec r1 b); intros; reflexivity || elim n; assumption. - simpl in |- *; rewrite H13; reflexivity. + simpl; rewrite H13; reflexivity. intros; simpl in H9; induction i as [| i Hreci]. - unfold constant_D_eq, open_interval in |- *; simpl in |- *; intros; + unfold constant_D_eq, open_interval; simpl; intros; assert (H16 : Rmin r1 b = r1). - unfold Rmin in |- *; case (Rle_dec r1 b); intro; + unfold Rmin; case (Rle_dec r1 b); intro; [ reflexivity | elim n; assumption ]. rewrite H16 in H12; rewrite H12 in H14; elim H14; clear H14; intros _ H14; - unfold g' in |- *; case (Rle_dec r1 x); intro r3. + unfold g'; case (Rle_dec r1 x); intro r3. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r3 H14)). reflexivity. change (constant_D_eq g' (open_interval (pos_Rl lg i) (pos_Rl lg (S i))) - (pos_Rl lg2 i)) in |- *; clear Hreci; assert (H16 := H15 i); + (pos_Rl lg2 i)); clear Hreci; assert (H16 := H15 i); assert (H17 : (i < pred (Rlength lg))%nat). apply lt_S_n. replace (S (pred (Rlength lg))) with (Rlength lg). assumption. - apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro; + apply S_pred with 0%nat; apply neq_O_lt; red; intro; rewrite <- H14 in H9; elim (lt_n_O _ H9). assert (H18 := H16 H17); unfold constant_D_eq, open_interval in H18; - unfold constant_D_eq, open_interval in |- *; intros; - assert (H19 := H18 _ H14); rewrite <- H19; unfold g' in |- *; + unfold constant_D_eq, open_interval; intros; + assert (H19 := H18 _ H14); rewrite <- H19; unfold g'; case (Rle_dec r1 x); intro. reflexivity. elim n; replace r1 with (Rmin r1 b). @@ -1872,17 +1872,17 @@ Proof. elim (RList_P3 lg (pos_Rl lg i)); intros; apply H21; exists i; split. reflexivity. apply lt_trans with (pred (Rlength lg)); try assumption. - apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H22 in H17; + apply lt_pred_n_n; apply neq_O_lt; red; intro; rewrite <- H22 in H17; elim (lt_n_O _ H17). - unfold Rmin in |- *; case (Rle_dec r1 b); intro; + unfold Rmin; case (Rle_dec r1 b); intro; [ reflexivity | elim n0; assumption ]. exists (mkStepFun H8); split. - simpl in |- *; unfold g' in |- *; case (Rle_dec r1 b); intro. + simpl; unfold g'; case (Rle_dec r1 b); intro. assumption. elim n; assumption. intros; simpl in H9; induction i as [| i Hreci]. - unfold constant_D_eq, co_interval in |- *; simpl in |- *; intros; simpl in H0; - rewrite H0; elim H10; clear H10; intros; unfold g' in |- *; + unfold constant_D_eq, co_interval; simpl; intros; simpl in H0; + rewrite H0; elim H10; clear H10; intros; unfold g'; case (Rle_dec r1 x); intro r3. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r3 H11)). reflexivity. @@ -1890,21 +1890,21 @@ Proof. change (constant_D_eq (mkStepFun H8) (co_interval (pos_Rl (cons r1 l) i) (pos_Rl (cons r1 l) (S i))) - (f (pos_Rl (cons r1 l) i))) in |- *; assert (H10 := H6 i); + (f (pos_Rl (cons r1 l) i))); assert (H10 := H6 i); assert (H11 : (i < pred (Rlength (cons r1 l)))%nat). - simpl in |- *; apply lt_S_n; assumption. + simpl; apply lt_S_n; assumption. assert (H12 := H10 H11); unfold constant_D_eq, co_interval in H12; - unfold constant_D_eq, co_interval in |- *; intros; - rewrite <- (H12 _ H13); simpl in |- *; unfold g' in |- *; + unfold constant_D_eq, co_interval; intros; + rewrite <- (H12 _ H13); simpl; unfold g'; case (Rle_dec r1 x); intro. reflexivity. elim n; elim H13; clear H13; intros; apply Rle_trans with (pos_Rl (cons r1 l) i); try assumption; - change (pos_Rl (cons r1 l) 0 <= pos_Rl (cons r1 l) i) in |- *; + change (pos_Rl (cons r1 l) 0 <= pos_Rl (cons r1 l) i); elim (RList_P6 (cons r1 l)); intros; apply H15; [ assumption | apply le_O_n - | simpl in |- *; apply lt_trans with (Rlength l); + | simpl; apply lt_trans with (Rlength l); [ apply lt_S_n; assumption | apply lt_n_Sn ] ]. Qed. @@ -1912,7 +1912,7 @@ Lemma StepFun_P39 : forall (a b:R) (f:StepFun a b), RiemannInt_SF f = - RiemannInt_SF (mkStepFun (StepFun_P6 (pre f))). Proof. - intros; unfold RiemannInt_SF in |- *; case (Rle_dec a b); case (Rle_dec b a); + intros; unfold RiemannInt_SF; case (Rle_dec a b); case (Rle_dec b a); intros. assert (H : adapted_couple f a b (subdivision f) (subdivision_val f)); [ apply StepFun_P1 @@ -1925,16 +1925,16 @@ Proof. | assert (H1 : a = b); [ apply Rle_antisym; assumption | rewrite (StepFun_P8 H H1); assert (H2 : b = a); - [ symmetry in |- *; apply H1 | rewrite (StepFun_P8 H0 H2); ring ] ] ] ]. + [ symmetry ; apply H1 | rewrite (StepFun_P8 H0 H2); ring ] ] ] ]. rewrite Ropp_involutive; eapply StepFun_P17; [ apply StepFun_P1 | apply StepFun_P2; set (H := StepFun_P6 (pre f)); unfold IsStepFun in H; - elim H; intros; unfold is_subdivision in |- *; + elim H; intros; unfold is_subdivision; elim p; intros; apply p0 ]. apply Ropp_eq_compat; eapply StepFun_P17; [ apply StepFun_P1 | apply StepFun_P2; set (H := StepFun_P6 (pre f)); unfold IsStepFun in H; - elim H; intros; unfold is_subdivision in |- *; + elim H; intros; unfold is_subdivision; elim p; intros; apply p0 ]. assert (H : a < b); [ auto with real @@ -1951,34 +1951,34 @@ Lemma StepFun_P40 : adapted_couple f a c (cons_Rlist l1 l2) (FF (cons_Rlist l1 l2) f). Proof. intros f a b c l1 l2 lf1 lf2 H H0 H1 H2; unfold adapted_couple in H1, H2; - unfold adapted_couple in |- *; decompose [and] H1; + unfold adapted_couple; decompose [and] H1; decompose [and] H2; clear H1 H2; repeat split. apply RList_P25; try assumption. - rewrite H10; rewrite H4; unfold Rmin, Rmax in |- *; case (Rle_dec a b); + rewrite H10; rewrite H4; unfold Rmin, Rmax; case (Rle_dec a b); case (Rle_dec b c); intros; (right; reflexivity) || (elim n; left; assumption). rewrite RList_P22. - rewrite H5; unfold Rmin, Rmax in |- *; case (Rle_dec a b); case (Rle_dec a c); + rewrite H5; unfold Rmin, Rmax; case (Rle_dec a b); case (Rle_dec a c); intros; [ reflexivity | elim n; apply Rle_trans with b; left; assumption | elim n; left; assumption | elim n0; left; assumption ]. - red in |- *; intro; rewrite H1 in H6; discriminate. + red; intro; rewrite H1 in H6; discriminate. rewrite RList_P24. - rewrite H9; unfold Rmin, Rmax in |- *; case (Rle_dec b c); case (Rle_dec a c); + rewrite H9; unfold Rmin, Rmax; case (Rle_dec b c); case (Rle_dec a c); intros; [ reflexivity | elim n; apply Rle_trans with b; left; assumption | elim n; left; assumption | elim n0; left; assumption ]. - red in |- *; intro; rewrite H1 in H11; discriminate. + red; intro; rewrite H1 in H11; discriminate. apply StepFun_P20. - rewrite RList_P23; apply neq_O_lt; red in |- *; intro. + rewrite RList_P23; apply neq_O_lt; red; intro. assert (H2 : (Rlength l1 + Rlength l2)%nat = 0%nat). - symmetry in |- *; apply H1. + symmetry ; apply H1. elim (plus_is_O _ _ H2); intros; rewrite H12 in H6; discriminate. - unfold constant_D_eq, open_interval in |- *; intros; + unfold constant_D_eq, open_interval; intros; elim (le_or_lt (S (S i)) (Rlength l1)); intro. assert (H14 : pos_Rl (cons_Rlist l1 l2) i = pos_Rl l1 i). apply RList_P26; apply lt_S_n; apply le_lt_n_Sm; apply le_S_n; @@ -1991,28 +1991,28 @@ Proof. elim (RList_P20 _ H16); intros r1 [r2 [r3 H17]]; rewrite H17; change (f x = pos_Rl (app_Rlist (mid_Rlist (cons_Rlist (cons r2 r3) l2) r1) f) i) - in |- *; rewrite RList_P12. + ; rewrite RList_P12. induction i as [| i Hreci]. - simpl in |- *; assert (H18 := H8 0%nat); + simpl; assert (H18 := H8 0%nat); unfold constant_D_eq, open_interval in H18; assert (H19 : (0 < pred (Rlength l1))%nat). - rewrite H17; simpl in |- *; apply lt_O_Sn. + rewrite H17; simpl; apply lt_O_Sn. assert (H20 := H18 H19); repeat rewrite H20. reflexivity. assert (H21 : r1 <= r2). rewrite H17 in H3; apply (H3 0%nat). - simpl in |- *; apply lt_O_Sn. + simpl; apply lt_O_Sn. elim H21; intro. split. - rewrite H17; simpl in |- *; apply Rmult_lt_reg_l with 2; + rewrite H17; simpl; apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. - rewrite H17; simpl in |- *; apply Rmult_lt_reg_l with 2; + rewrite H17; simpl; apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite (Rplus_comm r1); rewrite double; apply Rplus_lt_compat_l; assumption @@ -2041,13 +2041,13 @@ Proof. split. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite (Rplus_comm (pos_Rl l1 (S i))); rewrite double; apply Rplus_lt_compat_l; assumption @@ -2055,21 +2055,21 @@ Proof. elim H2; intros; rewrite H22 in H23; elim (Rlt_irrefl _ (Rlt_trans _ _ _ H23 H24)). assumption. - simpl in |- *; rewrite H17 in H1; simpl in H1; apply lt_S_n; assumption. + simpl; rewrite H17 in H1; simpl in H1; apply lt_S_n; assumption. rewrite RList_P14; rewrite H17 in H1; simpl in H1; apply H1. inversion H12. assert (H16 : pos_Rl (cons_Rlist l1 l2) (S i) = b). rewrite RList_P29. - rewrite H15; rewrite <- minus_n_n; rewrite H10; unfold Rmin in |- *; + rewrite H15; rewrite <- minus_n_n; rewrite H10; unfold Rmin; case (Rle_dec b c); intro; [ reflexivity | elim n; left; assumption ]. rewrite H15; apply le_n. induction l1 as [| r l1 Hrecl1]. simpl in H15; discriminate. - clear Hrecl1; simpl in H1; simpl in |- *; apply lt_n_S; assumption. + clear Hrecl1; simpl in H1; simpl; apply lt_n_S; assumption. assert (H17 : pos_Rl (cons_Rlist l1 l2) i = b). rewrite RList_P26. replace i with (pred (Rlength l1)); - [ rewrite H4; unfold Rmax in |- *; case (Rle_dec a b); intro; + [ rewrite H4; unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; left; assumption ] | rewrite H15; reflexivity ]. rewrite H15; apply lt_n_Sn. @@ -2087,22 +2087,22 @@ Proof. apply le_S_n; apply le_trans with (S i); [ assumption | apply le_n_Sn ]. induction l1 as [| r l1 Hrecl1]. simpl in H6; discriminate. - clear Hrecl1; simpl in H1; simpl in |- *; apply lt_n_S; assumption. - symmetry in |- *; apply minus_Sn_m; apply le_S_n; assumption. + clear Hrecl1; simpl in H1; simpl; apply lt_n_S; assumption. + symmetry ; apply minus_Sn_m; apply le_S_n; assumption. assert (H18 : (2 <= Rlength l1)%nat). clear f c l2 lf2 H0 H3 H8 H7 H10 H9 H11 H13 i H1 x H2 H12 m H14 H15 H16 H17; induction l1 as [| r l1 Hrecl1]. discriminate. clear Hrecl1; induction l1 as [| r0 l1 Hrecl1]. simpl in H5; simpl in H4; assert (H0 : Rmin a b < Rmax a b). - unfold Rmin, Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmin, Rmax; case (Rle_dec a b); intro; [ assumption | elim n; left; assumption ]. rewrite <- H5 in H0; rewrite <- H4 in H0; elim (Rlt_irrefl _ H0). - clear Hrecl1; simpl in |- *; repeat apply le_n_S; apply le_O_n. + clear Hrecl1; simpl; repeat apply le_n_S; apply le_O_n. elim (RList_P20 _ H18); intros r1 [r2 [r3 H19]]; rewrite H19; change (f x = pos_Rl (app_Rlist (mid_Rlist (cons_Rlist (cons r2 r3) l2) r1) f) i) - in |- *; rewrite RList_P12. + ; rewrite RList_P12. induction i as [| i Hreci]. assert (H20 := le_S_n _ _ H15); assert (H21 := le_trans _ _ _ H18 H20); elim (le_Sn_O _ H21). @@ -2120,7 +2120,7 @@ Proof. assert (H21 : (S i - Rlength l1 < pred (Rlength l2))%nat). apply lt_pred; rewrite minus_Sn_m. apply plus_lt_reg_l with (Rlength l1); rewrite <- le_plus_minus. - rewrite H19 in H1; simpl in H1; rewrite H19; simpl in |- *; + rewrite H19 in H1; simpl in H1; rewrite H19; simpl; rewrite RList_P23 in H1; apply lt_n_S; assumption. apply le_trans with (S i); [ apply le_S_n; assumption | apply le_n_Sn ]. apply le_S_n; assumption. @@ -2132,7 +2132,7 @@ Proof. apply H7; apply lt_pred. rewrite minus_Sn_m. apply plus_lt_reg_l with (Rlength l1); rewrite <- le_plus_minus. - rewrite H19 in H1; simpl in H1; rewrite H19; simpl in |- *; + rewrite H19 in H1; simpl in H1; rewrite H19; simpl; rewrite RList_P23 in H1; apply lt_n_S; assumption. apply le_trans with (S i); [ apply le_S_n; assumption | apply le_n_Sn ]. apply le_S_n; assumption. @@ -2140,13 +2140,13 @@ Proof. split. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption | discrR ] ]. apply Rmult_lt_reg_l with 2; [ prove_sup0 - | unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + | unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym; [ rewrite Rmult_1_l; rewrite (Rplus_comm (pos_Rl l2 (S i - Rlength l1))); rewrite double; apply Rplus_lt_compat_l; assumption @@ -2157,14 +2157,14 @@ Proof. rewrite H17 in H26; simpl in H24; rewrite H24 in H25; elim (Rlt_irrefl _ (Rlt_trans _ _ _ H25 H26)). assert (H23 : pos_Rl (cons_Rlist l1 l2) (S i) = pos_Rl l2 (S i - Rlength l1)). - rewrite H19; simpl in |- *; simpl in H16; apply H16. + rewrite H19; simpl; simpl in H16; apply H16. assert (H24 : pos_Rl (cons_Rlist l1 l2) (S (S i)) = pos_Rl l2 (S (S i - Rlength l1))). - rewrite H19; simpl in |- *; simpl in H17; apply H17. + rewrite H19; simpl; simpl in H17; apply H17. rewrite <- H23; rewrite <- H24; assumption. - simpl in |- *; rewrite H19 in H1; simpl in H1; apply lt_S_n; assumption. - rewrite RList_P14; rewrite H19 in H1; simpl in H1; simpl in |- *; apply H1. + simpl; rewrite H19 in H1; simpl in H1; apply lt_S_n; assumption. + rewrite RList_P14; rewrite H19 in H1; simpl in H1; simpl; apply H1. Qed. Lemma StepFun_P41 : @@ -2189,11 +2189,11 @@ Lemma StepFun_P42 : Int_SF (FF l1 f) l1 + Int_SF (FF l2 f) l2. Proof. intros l1 l2 f; induction l1 as [| r l1 IHl1]; intros H; - [ simpl in |- *; ring + [ simpl; ring | destruct l1 as [| r0 r1]; - [ simpl in H; simpl in |- *; destruct l2 as [| r0 r1]; - [ simpl in |- *; ring | simpl in |- *; simpl in H; rewrite H; ring ] - | simpl in |- *; rewrite Rplus_assoc; apply Rplus_eq_compat_l; apply IHl1; + [ simpl in H; simpl; destruct l2 as [| r0 r1]; + [ simpl; ring | simpl; simpl in H; rewrite H; ring ] + | simpl; rewrite Rplus_assoc; apply Rplus_eq_compat_l; apply IHl1; rewrite <- H; reflexivity ] ]. Qed. @@ -2229,27 +2229,27 @@ Proof. (Int_SF (FF (cons_Rlist l1 l2) f) (cons_Rlist l1 l2)). replace (Int_SF lf1 l1) with (Int_SF (FF l1 f) l1). replace (Int_SF lf2 l2) with (Int_SF (FF l2 f) l2). - symmetry in |- *; apply StepFun_P42. + symmetry ; apply StepFun_P42. unfold adapted_couple in H1, H2; decompose [and] H1; decompose [and] H2; - clear H1 H2; rewrite H11; rewrite H5; unfold Rmax, Rmin in |- *; + clear H1 H2; rewrite H11; rewrite H5; unfold Rmax, Rmin; case (Rle_dec a b); case (Rle_dec b c); intros; reflexivity || elim n; assumption. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf2; apply H2; + [ apply StepFun_P21; unfold is_subdivision; split with lf2; apply H2; assumption | assumption ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf1; apply H1 + [ apply StepFun_P21; unfold is_subdivision; split with lf1; apply H1 | assumption ]. eapply StepFun_P17; [ apply (StepFun_P40 H H0 H1 H2) | apply H3 ]. replace (Int_SF lf2 l2) with 0. rewrite Rplus_0_r; eapply StepFun_P17; [ apply H1 | rewrite <- H0 in H3; apply H3 ]. - symmetry in |- *; eapply StepFun_P8; [ apply H2 | assumption ]. + symmetry ; eapply StepFun_P8; [ apply H2 | assumption ]. replace (Int_SF lf1 l1) with 0. rewrite Rplus_0_l; eapply StepFun_P17; [ apply H2 | rewrite H in H3; apply H3 ]. - symmetry in |- *; eapply StepFun_P8; [ apply H1 | assumption ]. + symmetry ; eapply StepFun_P8; [ apply H1 | assumption ]. elim n; apply Rle_trans with b; assumption. apply Rplus_eq_reg_l with (Int_SF lf2 l2); replace (Int_SF lf2 l2 + (Int_SF lf1 l1 + - Int_SF lf2 l2)) with @@ -2264,24 +2264,24 @@ Proof. replace (Int_SF lf2 l2) with (Int_SF (FF l2 f) l2). apply StepFun_P42. unfold adapted_couple in H2, H3; decompose [and] H2; decompose [and] H3; - clear H3 H2; rewrite H10; rewrite H6; unfold Rmax, Rmin in |- *; + clear H3 H2; rewrite H10; rewrite H6; unfold Rmax, Rmin; case (Rle_dec a c); case (Rle_dec b c); intros; [ elim n; assumption | reflexivity | elim n0; assumption | elim n1; assumption ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf2; apply H2 + [ apply StepFun_P21; unfold is_subdivision; split with lf2; apply H2 | assumption ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf3; apply H3 + [ apply StepFun_P21; unfold is_subdivision; split with lf3; apply H3 | assumption ]. eapply StepFun_P17; [ apply (StepFun_P40 H0 H H3 (StepFun_P2 H2)) | apply H1 ]. replace (Int_SF lf3 l3) with 0. rewrite Rplus_0_r; eapply StepFun_P17; [ apply H1 | apply StepFun_P2; rewrite <- H0 in H2; apply H2 ]. - symmetry in |- *; eapply StepFun_P8; [ apply H3 | assumption ]. + symmetry ; eapply StepFun_P8; [ apply H3 | assumption ]. replace (Int_SF lf2 l2) with (Int_SF lf3 l3 + Int_SF lf1 l1). ring. elim r; intro. @@ -2289,19 +2289,19 @@ Proof. (Int_SF (FF (cons_Rlist l3 l1) f) (cons_Rlist l3 l1)). replace (Int_SF lf3 l3) with (Int_SF (FF l3 f) l3). replace (Int_SF lf1 l1) with (Int_SF (FF l1 f) l1). - symmetry in |- *; apply StepFun_P42. + symmetry ; apply StepFun_P42. unfold adapted_couple in H1, H3; decompose [and] H1; decompose [and] H3; - clear H3 H1; rewrite H9; rewrite H5; unfold Rmax, Rmin in |- *; + clear H3 H1; rewrite H9; rewrite H5; unfold Rmax, Rmin; case (Rle_dec a c); case (Rle_dec a b); intros; [ elim n; assumption | elim n1; assumption | reflexivity | elim n1; assumption ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf1; apply H1 + [ apply StepFun_P21; unfold is_subdivision; split with lf1; apply H1 | assumption ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf3; apply H3 + [ apply StepFun_P21; unfold is_subdivision; split with lf3; apply H3 | assumption ]. eapply StepFun_P17. assert (H0 : c < a). @@ -2311,7 +2311,7 @@ Proof. replace (Int_SF lf1 l1) with 0. rewrite Rplus_0_r; eapply StepFun_P17; [ apply H3 | rewrite <- H in H2; apply H2 ]. - symmetry in |- *; eapply StepFun_P8; [ apply H1 | assumption ]. + symmetry ; eapply StepFun_P8; [ apply H1 | assumption ]. assert (H : b < a). auto with real. replace (Int_SF lf2 l2) with (Int_SF lf3 l3 + Int_SF lf1 l1). @@ -2321,19 +2321,19 @@ Proof. (Int_SF (FF (cons_Rlist l1 l3) f) (cons_Rlist l1 l3)). replace (Int_SF lf3 l3) with (Int_SF (FF l3 f) l3). replace (Int_SF lf1 l1) with (Int_SF (FF l1 f) l1). - symmetry in |- *; apply StepFun_P42. + symmetry ; apply StepFun_P42. unfold adapted_couple in H1, H3; decompose [and] H1; decompose [and] H3; - clear H3 H1; rewrite H11; rewrite H5; unfold Rmax, Rmin in |- *; + clear H3 H1; rewrite H11; rewrite H5; unfold Rmax, Rmin; case (Rle_dec a c); case (Rle_dec a b); intros; [ elim n; assumption | reflexivity | elim n0; assumption | elim n1; assumption ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf1; apply H1 + [ apply StepFun_P21; unfold is_subdivision; split with lf1; apply H1 | assumption ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf3; apply H3 + [ apply StepFun_P21; unfold is_subdivision; split with lf3; apply H3 | assumption ]. eapply StepFun_P17. apply (StepFun_P40 H H0 (StepFun_P2 H1) H3). @@ -2341,7 +2341,7 @@ Proof. replace (Int_SF lf3 l3) with 0. rewrite Rplus_0_r; eapply StepFun_P17; [ apply H1 | rewrite <- H0 in H2; apply StepFun_P2; apply H2 ]. - symmetry in |- *; eapply StepFun_P8; [ apply H3 | assumption ]. + symmetry ; eapply StepFun_P8; [ apply H3 | assumption ]. assert (H : c < a). auto with real. replace (Int_SF lf1 l1) with (Int_SF lf2 l2 + Int_SF lf3 l3). @@ -2351,19 +2351,19 @@ Proof. (Int_SF (FF (cons_Rlist l2 l3) f) (cons_Rlist l2 l3)). replace (Int_SF lf3 l3) with (Int_SF (FF l3 f) l3). replace (Int_SF lf2 l2) with (Int_SF (FF l2 f) l2). - symmetry in |- *; apply StepFun_P42. + symmetry ; apply StepFun_P42. unfold adapted_couple in H2, H3; decompose [and] H2; decompose [and] H3; - clear H3 H2; rewrite H11; rewrite H5; unfold Rmax, Rmin in |- *; + clear H3 H2; rewrite H11; rewrite H5; unfold Rmax, Rmin; case (Rle_dec a c); case (Rle_dec b c); intros; [ elim n; assumption | elim n1; assumption | reflexivity | elim n1; assumption ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf2; apply H2 + [ apply StepFun_P21; unfold is_subdivision; split with lf2; apply H2 | assumption ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf3; apply H3 + [ apply StepFun_P21; unfold is_subdivision; split with lf3; apply H3 | assumption ]. eapply StepFun_P17. apply (StepFun_P40 H0 H H2 (StepFun_P2 H3)). @@ -2371,7 +2371,7 @@ Proof. replace (Int_SF lf2 l2) with 0. rewrite Rplus_0_l; eapply StepFun_P17; [ apply H3 | rewrite H0 in H1; apply H1 ]. - symmetry in |- *; eapply StepFun_P8; [ apply H2 | assumption ]. + symmetry ; eapply StepFun_P8; [ apply H2 | assumption ]. elim n; apply Rle_trans with a; try assumption. auto with real. assert (H : c < b). @@ -2384,56 +2384,56 @@ Proof. (Int_SF (FF (cons_Rlist l2 l1) f) (cons_Rlist l2 l1)). replace (Int_SF lf1 l1) with (Int_SF (FF l1 f) l1). replace (Int_SF lf2 l2) with (Int_SF (FF l2 f) l2). - symmetry in |- *; apply StepFun_P42. + symmetry ; apply StepFun_P42. unfold adapted_couple in H2, H1; decompose [and] H2; decompose [and] H1; - clear H1 H2; rewrite H11; rewrite H5; unfold Rmax, Rmin in |- *; + clear H1 H2; rewrite H11; rewrite H5; unfold Rmax, Rmin; case (Rle_dec a b); case (Rle_dec b c); intros; [ elim n1; assumption | elim n1; assumption | elim n0; assumption | reflexivity ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf2; apply H2 + [ apply StepFun_P21; unfold is_subdivision; split with lf2; apply H2 | assumption ]. eapply StepFun_P17; - [ apply StepFun_P21; unfold is_subdivision in |- *; split with lf1; apply H1 + [ apply StepFun_P21; unfold is_subdivision; split with lf1; apply H1 | assumption ]. eapply StepFun_P17. apply (StepFun_P40 H H0 (StepFun_P2 H2) (StepFun_P2 H1)). apply StepFun_P2; apply H3. - unfold RiemannInt_SF in |- *; case (Rle_dec a c); intro. + unfold RiemannInt_SF; case (Rle_dec a c); intro. eapply StepFun_P17. apply H3. change (adapted_couple (mkStepFun pr3) a c (subdivision (mkStepFun pr3)) - (subdivision_val (mkStepFun pr3))) in |- *; apply StepFun_P1. + (subdivision_val (mkStepFun pr3))); apply StepFun_P1. apply Ropp_eq_compat; eapply StepFun_P17. apply H3. change (adapted_couple (mkStepFun pr3) a c (subdivision (mkStepFun pr3)) - (subdivision_val (mkStepFun pr3))) in |- *; apply StepFun_P1. - unfold RiemannInt_SF in |- *; case (Rle_dec b c); intro. + (subdivision_val (mkStepFun pr3))); apply StepFun_P1. + unfold RiemannInt_SF; case (Rle_dec b c); intro. eapply StepFun_P17. apply H2. change (adapted_couple (mkStepFun pr2) b c (subdivision (mkStepFun pr2)) - (subdivision_val (mkStepFun pr2))) in |- *; apply StepFun_P1. + (subdivision_val (mkStepFun pr2))); apply StepFun_P1. apply Ropp_eq_compat; eapply StepFun_P17. apply H2. change (adapted_couple (mkStepFun pr2) b c (subdivision (mkStepFun pr2)) - (subdivision_val (mkStepFun pr2))) in |- *; apply StepFun_P1. - unfold RiemannInt_SF in |- *; case (Rle_dec a b); intro. + (subdivision_val (mkStepFun pr2))); apply StepFun_P1. + unfold RiemannInt_SF; case (Rle_dec a b); intro. eapply StepFun_P17. apply H1. change (adapted_couple (mkStepFun pr1) a b (subdivision (mkStepFun pr1)) - (subdivision_val (mkStepFun pr1))) in |- *; apply StepFun_P1. + (subdivision_val (mkStepFun pr1))); apply StepFun_P1. apply Ropp_eq_compat; eapply StepFun_P17. apply H1. change (adapted_couple (mkStepFun pr1) a b (subdivision (mkStepFun pr1)) - (subdivision_val (mkStepFun pr1))) in |- *; apply StepFun_P1. + (subdivision_val (mkStepFun pr1))); apply StepFun_P1. Qed. Lemma StepFun_P44 : @@ -2449,7 +2449,7 @@ Proof. adapted_couple f a b l1 lf1 -> a <= c <= b -> { l:Rlist & { l0:Rlist & adapted_couple f a c l l0 } }). - intro X; unfold IsStepFun in |- *; unfold is_subdivision in |- *; eapply X. + intro X; unfold IsStepFun; unfold is_subdivision; eapply X. apply H2. split; assumption. clear f a b c H0 H H1 H2 l1 lf1; simple induction l1. @@ -2461,11 +2461,11 @@ Proof. simpl in H2; assert (H7 : a <= b). elim H0; intros; apply Rle_trans with c; assumption. replace a with (Rmin a b). - pattern b at 2 in |- *; replace b with (Rmax a b). + pattern b at 2; replace b with (Rmax a b). rewrite <- H2; rewrite H3; reflexivity. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. split with (cons r nil); split with lf1; assert (H2 : c = b). rewrite H1 in H0; elim H0; intros; apply Rle_antisym; assumption. @@ -2479,22 +2479,22 @@ Proof. split with (cons r (cons c nil)); split with (cons r3 nil); unfold adapted_couple in H; decompose [and] H; clear H; assert (H6 : r = a). - simpl in H4; rewrite H4; unfold Rmin in |- *; case (Rle_dec a b); intro; + simpl in H4; rewrite H4; unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; elim H0; intros; apply Rle_trans with c; assumption ]. - elim H0; clear H0; intros; unfold adapted_couple in |- *; repeat split. - rewrite H6; unfold ordered_Rlist in |- *; intros; simpl in H8; inversion H8; - [ simpl in |- *; assumption | elim (le_Sn_O _ H10) ]. - simpl in |- *; unfold Rmin in |- *; case (Rle_dec a c); intro; + elim H0; clear H0; intros; unfold adapted_couple; repeat split. + rewrite H6; unfold ordered_Rlist; intros; simpl in H8; inversion H8; + [ simpl; assumption | elim (le_Sn_O _ H10) ]. + simpl; unfold Rmin; case (Rle_dec a c); intro; [ assumption | elim n; assumption ]. - simpl in |- *; unfold Rmax in |- *; case (Rle_dec a c); intro; + simpl; unfold Rmax; case (Rle_dec a c); intro; [ reflexivity | elim n; assumption ]. - unfold constant_D_eq, open_interval in |- *; intros; simpl in H8; + unfold constant_D_eq, open_interval; intros; simpl in H8; inversion H8. - simpl in |- *; assert (H10 := H7 0%nat); + simpl; assert (H10 := H7 0%nat); assert (H12 : (0 < pred (Rlength (cons r (cons r1 r2))))%nat). - simpl in |- *; apply lt_O_Sn. - apply (H10 H12); unfold open_interval in |- *; simpl in |- *; + simpl; apply lt_O_Sn. + apply (H10 H12); unfold open_interval; simpl; rewrite H11 in H9; simpl in H9; elim H9; clear H9; intros; split; try assumption. apply Rlt_le_trans with c; assumption. @@ -2508,42 +2508,42 @@ Proof. assert (H14 : a <= b). elim H0; intros; apply Rle_trans with c; assumption. assert (H16 : r = a). - simpl in H7; rewrite H7; unfold Rmin in |- *; case (Rle_dec a b); intro; + simpl in H7; rewrite H7; unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. induction l1' as [| r4 l1' Hrecl1']. simpl in H13; discriminate. - clear Hrecl1'; unfold adapted_couple in |- *; repeat split. - unfold ordered_Rlist in |- *; intros; simpl in H; induction i as [| i Hreci]. - simpl in |- *; replace r4 with r1. + clear Hrecl1'; unfold adapted_couple; repeat split. + unfold ordered_Rlist; intros; simpl in H; induction i as [| i Hreci]. + simpl; replace r4 with r1. apply (H5 0%nat). - simpl in |- *; apply lt_O_Sn. - simpl in H12; rewrite H12; unfold Rmin in |- *; case (Rle_dec r1 c); intro; + simpl; apply lt_O_Sn. + simpl in H12; rewrite H12; unfold Rmin; case (Rle_dec r1 c); intro; [ reflexivity | elim n; left; assumption ]. - apply (H9 i); simpl in |- *; apply lt_S_n; assumption. - simpl in |- *; unfold Rmin in |- *; case (Rle_dec a c); intro; + apply (H9 i); simpl; apply lt_S_n; assumption. + simpl; unfold Rmin; case (Rle_dec a c); intro; [ assumption | elim n; elim H0; intros; assumption ]. replace (Rmax a c) with (Rmax r1 c). rewrite <- H11; reflexivity. - unfold Rmax in |- *; case (Rle_dec r1 c); case (Rle_dec a c); intros; + unfold Rmax; case (Rle_dec r1 c); case (Rle_dec a c); intros; [ reflexivity | elim n; elim H0; intros; assumption | elim n; left; assumption | elim n0; left; assumption ]. - simpl in |- *; simpl in H13; rewrite H13; reflexivity. - intros; simpl in H; unfold constant_D_eq, open_interval in |- *; intros; + simpl; simpl in H13; rewrite H13; reflexivity. + intros; simpl in H; unfold constant_D_eq, open_interval; intros; induction i as [| i Hreci]. - simpl in |- *; assert (H17 := H10 0%nat); + simpl; assert (H17 := H10 0%nat); assert (H18 : (0 < pred (Rlength (cons r (cons r1 r2))))%nat). - simpl in |- *; apply lt_O_Sn. - apply (H17 H18); unfold open_interval in |- *; simpl in |- *; simpl in H4; + simpl; apply lt_O_Sn. + apply (H17 H18); unfold open_interval; simpl; simpl in H4; elim H4; clear H4; intros; split; try assumption; replace r1 with r4. assumption. - simpl in H12; rewrite H12; unfold Rmin in |- *; case (Rle_dec r1 c); intro; + simpl in H12; rewrite H12; unfold Rmin; case (Rle_dec r1 c); intro; [ reflexivity | elim n; left; assumption ]. - clear Hreci; simpl in |- *; apply H15. - simpl in |- *; apply lt_S_n; assumption. - unfold open_interval in |- *; apply H4. + clear Hreci; simpl; apply H15. + simpl; apply lt_S_n; assumption. + unfold open_interval; apply H4. split. left; assumption. elim H0; intros; assumption. @@ -2565,7 +2565,7 @@ Proof. adapted_couple f a b l1 lf1 -> a <= c <= b -> { l:Rlist & { l0:Rlist & adapted_couple f c b l l0 } }). - intro X; unfold IsStepFun in |- *; unfold is_subdivision in |- *; eapply X; + intro X; unfold IsStepFun; unfold is_subdivision; eapply X; [ apply H2 | split; assumption ]. clear f a b c H0 H H1 H2 l1 lf1; simple induction l1. intros; unfold adapted_couple in H; decompose [and] H; clear H; simpl in H4; @@ -2576,11 +2576,11 @@ Proof. simpl in H2; assert (H7 : a <= b). elim H0; intros; apply Rle_trans with c; assumption. replace a with (Rmin a b). - pattern b at 2 in |- *; replace b with (Rmax a b). + pattern b at 2; replace b with (Rmax a b). rewrite <- H2; rewrite H3; reflexivity. - unfold Rmax in |- *; case (Rle_dec a b); intro; + unfold Rmax; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. - unfold Rmin in |- *; case (Rle_dec a b); intro; + unfold Rmin; case (Rle_dec a b); intro; [ reflexivity | elim n; assumption ]. split with (cons r nil); split with lf1; assert (H2 : c = b). rewrite H1 in H0; elim H0; intros; apply Rle_antisym; assumption. @@ -2593,32 +2593,32 @@ Proof. elim H1; intro. split with (cons c (cons r1 r2)); split with (cons r3 lf1); unfold adapted_couple in H; decompose [and] H; clear H; - unfold adapted_couple in |- *; repeat split. - unfold ordered_Rlist in |- *; intros; simpl in H; induction i as [| i Hreci]. - simpl in |- *; assumption. - clear Hreci; apply (H2 (S i)); simpl in |- *; assumption. - simpl in |- *; unfold Rmin in |- *; case (Rle_dec c b); intro; + unfold adapted_couple; repeat split. + unfold ordered_Rlist; intros; simpl in H; induction i as [| i Hreci]. + simpl; assumption. + clear Hreci; apply (H2 (S i)); simpl; assumption. + simpl; unfold Rmin; case (Rle_dec c b); intro; [ reflexivity | elim n; elim H0; intros; assumption ]. replace (Rmax c b) with (Rmax a b). rewrite <- H3; reflexivity. - unfold Rmax in |- *; case (Rle_dec a b); case (Rle_dec c b); intros; + unfold Rmax; case (Rle_dec a b); case (Rle_dec c b); intros; [ reflexivity | elim n; elim H0; intros; assumption | elim n; elim H0; intros; apply Rle_trans with c; assumption | elim n0; elim H0; intros; apply Rle_trans with c; assumption ]. - simpl in |- *; simpl in H5; apply H5. + simpl; simpl in H5; apply H5. intros; simpl in H; induction i as [| i Hreci]. - unfold constant_D_eq, open_interval in |- *; intros; simpl in |- *; + unfold constant_D_eq, open_interval; intros; simpl; apply (H7 0%nat). - simpl in |- *; apply lt_O_Sn. - unfold open_interval in |- *; simpl in |- *; simpl in H6; elim H6; clear H6; + simpl; apply lt_O_Sn. + unfold open_interval; simpl; simpl in H6; elim H6; clear H6; intros; split; try assumption; apply Rle_lt_trans with c; try assumption; replace r with a. elim H0; intros; assumption. - simpl in H4; rewrite H4; unfold Rmin in |- *; case (Rle_dec a b); intros; + simpl in H4; rewrite H4; unfold Rmin; case (Rle_dec a b); intros; [ reflexivity | elim n; elim H0; intros; apply Rle_trans with c; assumption ]. - clear Hreci; apply (H7 (S i)); simpl in |- *; assumption. + clear Hreci; apply (H7 (S i)); simpl; assumption. cut (adapted_couple f r1 b (cons r1 r2) lf1). cut (r1 <= c <= b). intros; elim (X0 _ _ _ _ _ H3 H2); intros l1' [lf1' H4]; split with l1'; diff --git a/theories/Reals/Rlimit.v b/theories/Reals/Rlimit.v index 5c864de3..c5ee828a 100644 --- a/theories/Reals/Rlimit.v +++ b/theories/Reals/Rlimit.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -14,7 +14,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import Fourier. -Open Local Scope R_scope. +Local Open Scope R_scope. (*******************************) (** * Calculus *) @@ -31,7 +31,7 @@ Proof. intro esp. assert (H := double_var esp). unfold Rdiv in H. - symmetry in |- *; exact H. + symmetry ; exact H. Qed. (*********) @@ -39,9 +39,9 @@ Lemma eps4 : forall eps:R, eps * / (2 + 2) + eps * / (2 + 2) = eps * / 2. Proof. intro eps. replace (2 + 2) with 4. - pattern eps at 3 in |- *; rewrite double_var. + pattern eps at 3; rewrite double_var. rewrite (Rmult_plus_distr_r (eps / 2) (eps / 2) (/ 2)). - unfold Rdiv in |- *. + unfold Rdiv. repeat rewrite Rmult_assoc. rewrite <- Rinv_mult_distr. reflexivity. @@ -54,7 +54,7 @@ Qed. Lemma Rlt_eps2_eps : forall eps:R, eps > 0 -> eps * / 2 < eps. Proof. intros. - pattern eps at 2 in |- *; rewrite <- Rmult_1_r. + pattern eps at 2; rewrite <- Rmult_1_r. repeat rewrite (Rmult_comm eps). apply Rmult_lt_compat_r. exact H. @@ -70,7 +70,7 @@ Lemma Rlt_eps4_eps : forall eps:R, eps > 0 -> eps * / (2 + 2) < eps. Proof. intros. replace (2 + 2) with 4. - pattern eps at 2 in |- *; rewrite <- Rmult_1_r. + pattern eps at 2; rewrite <- Rmult_1_r. repeat rewrite (Rmult_comm eps). apply Rmult_lt_compat_r. exact H. @@ -113,10 +113,10 @@ Qed. (*********) Lemma mul_factor_gt : forall eps l l':R, eps > 0 -> eps * mul_factor l l' > 0. Proof. - intros; unfold Rgt in |- *; rewrite <- (Rmult_0_r eps); + intros; unfold Rgt; rewrite <- (Rmult_0_r eps); apply Rmult_lt_compat_l. assumption. - unfold mul_factor in |- *; apply Rinv_0_lt_compat; + unfold mul_factor; apply Rinv_0_lt_compat; cut (1 <= 1 + (Rabs l + Rabs l')). cut (0 < 1). exact (Rlt_le_trans _ _ _). @@ -196,7 +196,7 @@ Proof. case (H0 (dist R_met (f x0) l)); auto. intros alpha1 [H2 H3]; apply H3; auto; split; auto. case (dist_refl R_met x0 x0); intros Hr1 Hr2; rewrite Hr2; auto. - case (dist_refl R_met (f x0) l); intros Hr1 Hr2; apply sym_eq; auto. + case (dist_refl R_met (f x0) l); intros Hr1 Hr2; symmetry; auto. Qed. (*********) @@ -210,7 +210,7 @@ Qed. (*********) Lemma lim_x : forall (D:R -> Prop) (x0:R), limit1_in (fun x:R => x) D x0 x0. Proof. - unfold limit1_in in |- *; unfold limit_in in |- *; simpl in |- *; intros; + unfold limit1_in; unfold limit_in; simpl; intros; split with eps; split; auto; intros; elim H0; intros; auto. Qed. @@ -221,9 +221,9 @@ Lemma limit_plus : limit1_in f D l x0 -> limit1_in g D l' x0 -> limit1_in (fun x:R => f x + g x) D (l + l') x0. Proof. - intros; unfold limit1_in in |- *; unfold limit_in in |- *; simpl in |- *; + intros; unfold limit1_in; unfold limit_in; simpl; intros; elim (H (eps * / 2) (eps2_Rgt_R0 eps H1)); - elim (H0 (eps * / 2) (eps2_Rgt_R0 eps H1)); simpl in |- *; + elim (H0 (eps * / 2) (eps2_Rgt_R0 eps H1)); simpl; clear H H0; intros; elim H; elim H0; clear H H0; intros; split with (Rmin x1 x); split. exact (Rmin_Rgt_r x1 x 0 (conj H H2)). @@ -244,12 +244,12 @@ Lemma limit_Ropp : forall (f:R -> R) (D:R -> Prop) (l x0:R), limit1_in f D l x0 -> limit1_in (fun x:R => - f x) D (- l) x0. Proof. - unfold limit1_in in |- *; unfold limit_in in |- *; simpl in |- *; intros; + unfold limit1_in; unfold limit_in; simpl; intros; elim (H eps H0); clear H; intros; elim H; clear H; intros; split with x; split; auto; intros; generalize (H1 x1 H2); - clear H1; intro; unfold R_dist in |- *; unfold Rminus in |- *; + clear H1; intro; unfold R_dist; unfold Rminus; rewrite (Ropp_involutive l); rewrite (Rplus_comm (- f x1) l); - fold (l - f x1) in |- *; fold (R_dist l (f x1)) in |- *; + fold (l - f x1); fold (R_dist l (f x1)); rewrite R_dist_sym; assumption. Qed. @@ -259,7 +259,7 @@ Lemma limit_minus : limit1_in f D l x0 -> limit1_in g D l' x0 -> limit1_in (fun x:R => f x - g x) D (l - l') x0. Proof. - intros; unfold Rminus in |- *; generalize (limit_Ropp g D l' x0 H0); intro; + intros; unfold Rminus; generalize (limit_Ropp g D l' x0 H0); intro; exact (limit_plus f (fun x:R => - g x) D l (- l') x0 H H1). Qed. @@ -268,9 +268,9 @@ Lemma limit_free : forall (f:R -> R) (D:R -> Prop) (x x0:R), limit1_in (fun h:R => f x) D (f x) x0. Proof. - unfold limit1_in in |- *; unfold limit_in in |- *; simpl in |- *; intros; + unfold limit1_in; unfold limit_in; simpl; intros; split with eps; split; auto; intros; elim (R_dist_refl (f x) (f x)); - intros a b; rewrite (b (refl_equal (f x))); unfold Rgt in H; + intros a b; rewrite (b (eq_refl (f x))); unfold Rgt in H; assumption. Qed. @@ -280,14 +280,14 @@ Lemma limit_mul : limit1_in f D l x0 -> limit1_in g D l' x0 -> limit1_in (fun x:R => f x * g x) D (l * l') x0. Proof. - intros; unfold limit1_in in |- *; unfold limit_in in |- *; simpl in |- *; + intros; unfold limit1_in; unfold limit_in; simpl; intros; elim (H (Rmin 1 (eps * mul_factor l l')) (mul_factor_gt_f eps l l' H1)); elim (H0 (eps * mul_factor l l') (mul_factor_gt eps l l' H1)); - clear H H0; simpl in |- *; intros; elim H; elim H0; + clear H H0; simpl; intros; elim H; elim H0; clear H H0; intros; split with (Rmin x1 x); split. exact (Rmin_Rgt_r x1 x 0 (conj H H2)). - intros; elim H4; clear H4; intros; unfold R_dist in |- *; + intros; elim H4; clear H4; intros; unfold R_dist; replace (f x2 * g x2 - l * l') with (f x2 * (g x2 - l') + l' * (f x2 - l)). cut (Rabs (f x2 * (g x2 - l')) + Rabs (l' * (f x2 - l)) < eps). cut @@ -309,7 +309,7 @@ Proof. apply Rmult_ge_0_gt_0_lt_compat. apply Rle_ge. exact (Rabs_pos (g x2 - l')). - rewrite (Rplus_comm 1 (Rabs l)); unfold Rgt in |- *; apply Rle_lt_0_plus_1; + rewrite (Rplus_comm 1 (Rabs l)); unfold Rgt; apply Rle_lt_0_plus_1; exact (Rabs_pos l). unfold R_dist in H9; apply (Rplus_lt_reg_r (- Rabs l) (Rabs (f x2)) (1 + Rabs l)). @@ -323,13 +323,13 @@ Proof. generalize (H3 x2 (conj H4 H6)); trivial. apply Rmult_le_compat_l. exact (Rabs_pos l'). - unfold Rle in |- *; left; assumption. + unfold Rle; left; assumption. rewrite (Rmult_comm (1 + Rabs l) (eps * mul_factor l l')); rewrite (Rmult_comm (Rabs l') (eps * mul_factor l l')); rewrite <- (Rmult_plus_distr_l (eps * mul_factor l l') (1 + Rabs l) (Rabs l')) ; rewrite (Rmult_assoc eps (mul_factor l l') (1 + Rabs l + Rabs l')); - rewrite (Rplus_assoc 1 (Rabs l) (Rabs l')); unfold mul_factor in |- *; + rewrite (Rplus_assoc 1 (Rabs l) (Rabs l')); unfold mul_factor; rewrite (Rinv_l (1 + (Rabs l + Rabs l')) (mul_factor_wd l l')); rewrite (proj1 (Rmult_ne eps)); apply Req_le; trivial. ring. @@ -344,10 +344,10 @@ Lemma single_limit : forall (f:R -> R) (D:R -> Prop) (l l' x0:R), adhDa D x0 -> limit1_in f D l x0 -> limit1_in f D l' x0 -> l = l'. Proof. - unfold limit1_in in |- *; unfold limit_in in |- *; intros. + unfold limit1_in; unfold limit_in; intros. cut (forall eps:R, eps > 0 -> dist R_met l l' < 2 * eps). - clear H0 H1; unfold dist in |- *; unfold R_met in |- *; unfold R_dist in |- *; - unfold Rabs in |- *; case (Rcase_abs (l - l')); intros. + clear H0 H1; unfold dist; unfold R_met; unfold R_dist; + unfold Rabs; case (Rcase_abs (l - l')); intros. cut (forall eps:R, eps > 0 -> - (l - l') < eps). intro; generalize (prop_eps (- (l - l')) H1); intro; generalize (Ropp_gt_lt_0_contravar (l - l') r); intro; @@ -358,10 +358,10 @@ Proof. rewrite <- (Rmult_assoc 2 (/ 2) eps); rewrite (Rinv_r 2). elim (Rmult_ne eps); intros a b; rewrite b; clear a b; trivial. apply (Rlt_dichotomy_converse 2 0); right; generalize Rlt_0_1; intro; - unfold Rgt in |- *; generalize (Rplus_lt_compat_l 1 0 1 H3); + unfold Rgt; generalize (Rplus_lt_compat_l 1 0 1 H3); intro; elim (Rplus_ne 1); intros a b; rewrite a in H4; clear a b; apply (Rlt_trans 0 1 2 H3 H4). - unfold Rgt in |- *; unfold Rgt in H1; rewrite (Rmult_comm eps (/ 2)); + unfold Rgt; unfold Rgt in H1; rewrite (Rmult_comm eps (/ 2)); rewrite <- (Rmult_0_r (/ 2)); apply (Rmult_lt_compat_l (/ 2) 0 eps); auto. apply (Rinv_0_lt_compat 2); cut (1 < 2). @@ -380,10 +380,10 @@ Proof. rewrite <- (Rmult_assoc 2 (/ 2) eps); rewrite (Rinv_r 2). elim (Rmult_ne eps); intros a b; rewrite b; clear a b; trivial. apply (Rlt_dichotomy_converse 2 0); right; generalize Rlt_0_1; intro; - unfold Rgt in |- *; generalize (Rplus_lt_compat_l 1 0 1 H3); + unfold Rgt; generalize (Rplus_lt_compat_l 1 0 1 H3); intro; elim (Rplus_ne 1); intros a b; rewrite a in H4; clear a b; apply (Rlt_trans 0 1 2 H3 H4). - unfold Rgt in |- *; unfold Rgt in H1; rewrite (Rmult_comm eps (/ 2)); + unfold Rgt; unfold Rgt in H1; rewrite (Rmult_comm eps (/ 2)); rewrite <- (Rmult_0_r (/ 2)); apply (Rmult_lt_compat_l (/ 2) 0 eps); auto. apply (Rinv_0_lt_compat 2); cut (1 < 2). @@ -393,7 +393,7 @@ Proof. (**) intros; unfold adhDa in H; elim (H0 eps H2); intros; elim (H1 eps H2); intros; clear H0 H1; elim H3; elim H4; clear H3 H4; intros; - simpl in |- *; simpl in H1, H4; generalize (Rmin_Rgt x x1 0); + simpl; simpl in H1, H4; generalize (Rmin_Rgt x x1 0); intro; elim H5; intros; clear H5; elim (H (Rmin x x1) (H7 (conj H3 H0))); intros; elim H5; intros; clear H5 H H6 H7; generalize (Rmin_Rgt x x1 (R_dist x2 x0)); intro; @@ -403,10 +403,10 @@ Proof. intros; generalize (Rplus_lt_compat (R_dist (f x2) l) eps (R_dist (f x2) l') eps H H0); - unfold R_dist in |- *; intros; rewrite (Rabs_minus_sym (f x2) l) in H1; + unfold R_dist; intros; rewrite (Rabs_minus_sym (f x2) l) in H1; rewrite (Rmult_comm 2 eps); rewrite (Rmult_plus_distr_l eps 1 1); elim (Rmult_ne eps); intros a b; rewrite a; clear a b; - generalize (R_dist_tri l l' (f x2)); unfold R_dist in |- *; + generalize (R_dist_tri l l' (f x2)); unfold R_dist; intros; apply (Rle_lt_trans (Rabs (l - l')) (Rabs (l - f x2) + Rabs (f x2 - l')) @@ -419,7 +419,7 @@ Lemma limit_comp : limit1_in f Df l x0 -> limit1_in g Dg l' l -> limit1_in (fun x:R => g (f x)) (Dgf Df Dg f) l' x0. Proof. - unfold limit1_in, limit_in, Dgf in |- *; simpl in |- *. + unfold limit1_in, limit_in, Dgf; simpl. intros f g Df Dg l l' x0 Hf Hg eps eps_pos. elim (Hg eps eps_pos). intros alpg lg. @@ -436,12 +436,12 @@ Lemma limit_inv : forall (f:R -> R) (D:R -> Prop) (l x0:R), limit1_in f D l x0 -> l <> 0 -> limit1_in (fun x:R => / f x) D (/ l) x0. Proof. - unfold limit1_in in |- *; unfold limit_in in |- *; simpl in |- *; - unfold R_dist in |- *; intros; elim (H (Rabs l / 2)). + unfold limit1_in; unfold limit_in; simpl; + unfold R_dist; intros; elim (H (Rabs l / 2)). intros delta1 H2; elim (H (eps * (Rsqr l / 2))). intros delta2 H3; elim H2; elim H3; intros; exists (Rmin delta1 delta2); split. - unfold Rmin in |- *; case (Rle_dec delta1 delta2); intro; assumption. + unfold Rmin; case (Rle_dec delta1 delta2); intro; assumption. intro; generalize (H5 x); clear H5; intro H5; generalize (H7 x); clear H7; intro H7; intro H10; elim H10; intros; cut (D x /\ Rabs (x - x0) < delta1). cut (D x /\ Rabs (x - x0) < delta2). @@ -455,7 +455,7 @@ Proof. (Rplus_lt_compat_l (Rabs (f x) - Rabs l / 2) (Rabs l - Rabs (f x)) (Rabs l / 2) H14); replace (Rabs (f x) - Rabs l / 2 + (Rabs l - Rabs (f x))) with (Rabs l / 2). - unfold Rminus in |- *; rewrite Rplus_assoc; rewrite Rplus_opp_l; + unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; intro; cut (f x <> 0). intro; replace (/ f x + - / l) with ((l - f x) * / (l * f x)). rewrite Rabs_mult; rewrite Rabs_Rinv. @@ -467,7 +467,7 @@ Proof. (/ Rabs (l * f x)) (2 / Rsqr l) (Rabs_pos (l - f x)) H18 H5 H17); replace (eps * (Rsqr l / 2) * (2 / Rsqr l)) with eps. intro; assumption. - unfold Rdiv in |- *; unfold Rsqr in |- *; rewrite Rinv_mult_distr. + unfold Rdiv; unfold Rsqr; rewrite Rinv_mult_distr. repeat rewrite Rmult_assoc. rewrite (Rmult_comm l). repeat rewrite Rmult_assoc. @@ -487,7 +487,7 @@ Proof. left; apply Rinv_0_lt_compat; apply Rabs_pos_lt; apply prod_neq_R0; assumption. rewrite Rmult_comm; rewrite Rabs_mult; rewrite Rinv_mult_distr. - rewrite (Rsqr_abs l); unfold Rsqr in |- *; unfold Rdiv in |- *; + rewrite (Rsqr_abs l); unfold Rsqr; unfold Rdiv; rewrite Rinv_mult_distr. repeat rewrite <- Rmult_assoc; apply Rmult_lt_compat_r. apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption. @@ -496,7 +496,7 @@ Proof. apply Rabs_pos_lt; assumption. apply Rabs_pos_lt; assumption. apply Rinv_0_lt_compat; cut (0%nat <> 2%nat); - [ intro H17; generalize (lt_INR_0 2 (neq_O_lt 2 H17)); unfold INR in |- *; + [ intro H17; generalize (lt_INR_0 2 (neq_O_lt 2 H17)); unfold INR; intro H18; assumption | discriminate ]. replace (Rabs (f x) * Rabs l * / 2 * / Rabs (f x)) with (Rabs l / 2). @@ -512,7 +512,7 @@ Proof. discrR. apply Rabs_no_R0. assumption. - unfold Rdiv in |- *. + unfold Rdiv. repeat rewrite Rmult_assoc. rewrite (Rmult_comm (Rabs (f x))). repeat rewrite Rmult_assoc. @@ -526,7 +526,7 @@ Proof. apply Rabs_no_R0; assumption. apply prod_neq_R0; assumption. rewrite (Rinv_mult_distr _ _ H0 H16). - unfold Rminus in |- *; rewrite Rmult_plus_distr_r. + unfold Rminus; rewrite Rmult_plus_distr_r. rewrite <- Rmult_assoc. rewrite <- Rinv_r_sym. rewrite Rmult_1_l. @@ -538,16 +538,16 @@ Proof. reflexivity. assumption. assumption. - red in |- *; intro; rewrite H16 in H15; rewrite Rabs_R0 in H15; + red; intro; rewrite H16 in H15; rewrite Rabs_R0 in H15; cut (0 < Rabs l / 2). intro; elim (Rlt_irrefl 0 (Rlt_trans 0 (Rabs l / 2) 0 H17 H15)). - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. apply Rabs_pos_lt; assumption. apply Rinv_0_lt_compat; cut (0%nat <> 2%nat); - [ intro H17; generalize (lt_INR_0 2 (neq_O_lt 2 H17)); unfold INR in |- *; + [ intro H17; generalize (lt_INR_0 2 (neq_O_lt 2 H17)); unfold INR; intro; assumption | discriminate ]. - pattern (Rabs l) at 3 in |- *; rewrite double_var. + pattern (Rabs l) at 3; rewrite double_var. ring. split; [ assumption @@ -557,18 +557,18 @@ Proof. [ assumption | apply Rlt_le_trans with (Rmin delta1 delta2); [ assumption | apply Rmin_l ] ]. - change (0 < eps * (Rsqr l / 2)) in |- *; unfold Rdiv in |- *; + change (0 < eps * (Rsqr l / 2)); unfold Rdiv; repeat rewrite Rmult_assoc; apply Rmult_lt_0_compat. assumption. apply Rmult_lt_0_compat. apply Rsqr_pos_lt; assumption. apply Rinv_0_lt_compat; cut (0%nat <> 2%nat); - [ intro H3; generalize (lt_INR_0 2 (neq_O_lt 2 H3)); unfold INR in |- *; + [ intro H3; generalize (lt_INR_0 2 (neq_O_lt 2 H3)); unfold INR; intro; assumption | discriminate ]. - change (0 < Rabs l / 2) in |- *; unfold Rdiv in |- *; apply Rmult_lt_0_compat; + change (0 < Rabs l / 2); unfold Rdiv; apply Rmult_lt_0_compat; [ apply Rabs_pos_lt; assumption | apply Rinv_0_lt_compat; cut (0%nat <> 2%nat); - [ intro H3; generalize (lt_INR_0 2 (neq_O_lt 2 H3)); unfold INR in |- *; + [ intro H3; generalize (lt_INR_0 2 (neq_O_lt 2 H3)); unfold INR; intro; assumption | discriminate ] ]. Qed. diff --git a/theories/Reals/Rlogic.v b/theories/Reals/Rlogic.v index 2237ea6e..0b892a76 100644 --- a/theories/Reals/Rlogic.v +++ b/theories/Reals/Rlogic.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -271,10 +271,10 @@ assert (H2 : ~ is_upper_bound E M'). intro H5. assert (M <= M')%R by (apply H4; exact H5). apply (Rlt_not_le M M'). - unfold M' in |- *. - pattern M at 2 in |- *. + unfold M'. + pattern M at 2. rewrite <- Rplus_0_l. - pattern (0 + M)%R in |- *. + pattern (0 + M)%R. rewrite Rplus_comm. rewrite <- (Rplus_opp_r 1). apply Rplus_lt_compat_l. @@ -284,7 +284,7 @@ assert (H2 : ~ is_upper_bound E M'). apply H2. intros N (n,H7). rewrite H7. -unfold M' in |- *. +unfold M'. assert (H5 : (INR (S n) <= M)%R) by (apply H3; exists (S n); reflexivity). rewrite S_INR in H5. assert (H6 : (INR n + 1 + -1 <= M + -1)%R). diff --git a/theories/Reals/Rminmax.v b/theories/Reals/Rminmax.v index 8f8207d7..da3c6ddd 100644 --- a/theories/Reals/Rminmax.v +++ b/theories/Reals/Rminmax.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) diff --git a/theories/Reals/Rpow_def.v b/theories/Reals/Rpow_def.v index 026153b7..cd94169f 100644 --- a/theories/Reals/Rpow_def.v +++ b/theories/Reals/Rpow_def.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) diff --git a/theories/Reals/Rpower.v b/theories/Reals/Rpower.v index 593e54c6..43f326a0 100644 --- a/theories/Reals/Rpower.v +++ b/theories/Reals/Rpower.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -15,25 +15,25 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. -Require Import Rtrigo. +Require Import Rtrigo1. Require Import Ranalysis1. Require Import Exp_prop. Require Import Rsqrt_def. Require Import R_sqrt. Require Import MVT. Require Import Ranalysis4. -Open Local Scope R_scope. +Local Open Scope R_scope. Lemma P_Rmin : forall (P:R -> Prop) (x y:R), P x -> P y -> P (Rmin x y). Proof. - intros P x y H1 H2; unfold Rmin in |- *; case (Rle_dec x y); intro; + intros P x y H1 H2; unfold Rmin; case (Rle_dec x y); intro; assumption. Qed. Lemma exp_le_3 : exp 1 <= 3. Proof. assert (exp_1 : exp 1 <> 0). - assert (H0 := exp_pos 1); red in |- *; intro; rewrite H in H0; + assert (H0 := exp_pos 1); red; intro; rewrite H in H0; elim (Rlt_irrefl _ H0). apply Rmult_le_reg_l with (/ exp 1). apply Rinv_0_lt_compat; apply exp_pos. @@ -43,7 +43,7 @@ Proof. rewrite Rmult_1_r; rewrite <- (Rmult_comm 3); rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_l; replace (/ exp 1) with (exp (-1)). - unfold exp in |- *; case (exist_exp (-1)); intros; simpl in |- *; + unfold exp; case (exist_exp (-1)); intros; simpl; unfold exp_in in e; assert (H := alternated_series_ineq (fun i:nat => / INR (fact i)) x 1). cut @@ -73,7 +73,7 @@ Proof. ring. discrR. apply H. - unfold Un_decreasing in |- *; intros; + unfold Un_decreasing; intros; apply Rmult_le_reg_l with (INR (fact n)). apply INR_fact_lt_0. apply Rmult_le_reg_l with (INR (fact (S n))). @@ -84,13 +84,13 @@ Proof. rewrite Rmult_1_r; apply le_INR; apply fact_le; apply le_n_Sn. apply INR_fact_neq_0. apply INR_fact_neq_0. - assert (H0 := cv_speed_pow_fact 1); unfold Un_cv in |- *; unfold Un_cv in H0; + assert (H0 := cv_speed_pow_fact 1); unfold Un_cv; unfold Un_cv in H0; intros; elim (H0 _ H1); intros; exists x0; intros; - unfold R_dist in H2; unfold R_dist in |- *; + unfold R_dist in H2; unfold R_dist; replace (/ INR (fact n)) with (1 ^ n / INR (fact n)). apply (H2 _ H3). - unfold Rdiv in |- *; rewrite pow1; rewrite Rmult_1_l; reflexivity. - unfold infinite_sum in e; unfold Un_cv, tg_alt in |- *; intros; elim (e _ H0); + unfold Rdiv; rewrite pow1; rewrite Rmult_1_l; reflexivity. + unfold infinite_sum in e; unfold Un_cv, tg_alt; intros; elim (e _ H0); intros; exists x0; intros; replace (sum_f_R0 (fun i:nat => (-1) ^ i * / INR (fact i)) n) with (sum_f_R0 (fun i:nat => / INR (fact i) * (-1) ^ i) n). @@ -121,7 +121,7 @@ Proof. intro. replace (derive_pt exp x0 (H0 x0)) with (exp x0). apply exp_pos. - symmetry in |- *; apply derive_pt_eq_0. + symmetry ; apply derive_pt_eq_0. apply (derivable_pt_lim_exp x0). apply H. Qed. @@ -143,11 +143,11 @@ Proof. rewrite Ropp_0; rewrite Rplus_0_r; replace (derive_pt exp x0 (derivable_exp x0)) with (exp x0). rewrite exp_0; rewrite <- Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_l; - pattern x at 1 in |- *; rewrite <- Rmult_1_r; rewrite (Rmult_comm (exp x0)); + pattern x at 1; rewrite <- Rmult_1_r; rewrite (Rmult_comm (exp x0)); apply Rmult_lt_compat_l. apply H. rewrite <- exp_0; apply exp_increasing; elim H3; intros; assumption. - symmetry in |- *; apply derive_pt_eq_0; apply derivable_pt_lim_exp. + symmetry ; apply derive_pt_eq_0; apply derivable_pt_lim_exp. Qed. Lemma ln_exists1 : forall y:R, 1 <= y -> { z:R | y = exp z }. @@ -160,18 +160,18 @@ Proof. cut (f 0 * f y <= 0); [intro H4|]. pose proof (IVT_cor f 0 y H2 (Rlt_le _ _ H0) H4) as (t,(_,H7)); exists t; unfold f in H7; apply Rminus_diag_uniq_sym; exact H7. - pattern 0 at 2 in |- *; rewrite <- (Rmult_0_r (f y)); + pattern 0 at 2; rewrite <- (Rmult_0_r (f y)); rewrite (Rmult_comm (f 0)); apply Rmult_le_compat_l; assumption. - unfold f in |- *; apply Rplus_le_reg_l with y; left; + unfold f; apply Rplus_le_reg_l with y; left; apply Rlt_trans with (1 + y). rewrite <- (Rplus_comm y); apply Rplus_lt_compat_l; apply Rlt_0_1. replace (y + (exp y - y)) with (exp y); [ apply (exp_ineq1 y H0) | ring ]. - unfold f in |- *; change (continuity (exp - fct_cte y)) in |- *; + unfold f; change (continuity (exp - fct_cte y)); apply continuity_minus; [ apply derivable_continuous; apply derivable_exp | apply derivable_continuous; apply derivable_const ]. - unfold f in |- *; rewrite exp_0; apply Rplus_le_reg_l with y; + unfold f; rewrite exp_0; apply Rplus_le_reg_l with y; rewrite Rplus_0_r; replace (y + (1 - y)) with 1; [ apply H | ring ]. Qed. @@ -185,18 +185,18 @@ Proof. apply H. rewrite <- Rinv_r_sym. rewrite Rmult_1_r; left; apply (Rnot_le_lt _ _ n). - red in |- *; intro; rewrite H0 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H0 in H; elim (Rlt_irrefl _ H). destruct (ln_exists1 _ H0) as (x,p); exists (- x); apply Rmult_eq_reg_l with (exp x / y). - unfold Rdiv in |- *; rewrite Rmult_assoc; rewrite <- Rinv_l_sym. + unfold Rdiv; rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r; rewrite <- (Rmult_comm (/ y)); rewrite Rmult_assoc; rewrite <- exp_plus; rewrite Rplus_opp_r; rewrite exp_0; - rewrite Rmult_1_r; symmetry in |- *; apply p. - red in |- *; intro H3; rewrite H3 in H; elim (Rlt_irrefl _ H). - unfold Rdiv in |- *; apply prod_neq_R0. - assert (H3 := exp_pos x); red in |- *; intro H4; rewrite H4 in H3; + rewrite Rmult_1_r; symmetry ; apply p. + red; intro H3; rewrite H3 in H; elim (Rlt_irrefl _ H). + unfold Rdiv; apply prod_neq_R0. + assert (H3 := exp_pos x); red; intro H4; rewrite H4 in H3; elim (Rlt_irrefl _ H3). - apply Rinv_neq_0_compat; red in |- *; intro H3; rewrite H3 in H; + apply Rinv_neq_0_compat; red; intro H3; rewrite H3 in H; elim (Rlt_irrefl _ H). Qed. @@ -213,11 +213,11 @@ Definition ln (x:R) : R := Lemma exp_ln : forall x:R, 0 < x -> exp (ln x) = x. Proof. - intros; unfold ln in |- *; case (Rlt_dec 0 x); intro. - unfold Rln in |- *; + intros; unfold ln; case (Rlt_dec 0 x); intro. + unfold Rln; case (ln_exists (mkposreal x r) (cond_pos (mkposreal x r))); intros. - simpl in e; symmetry in |- *; apply e. + simpl in e; symmetry ; apply e. elim n; apply H. Qed. @@ -231,7 +231,7 @@ Qed. Theorem exp_Ropp : forall x:R, exp (- x) = / exp x. Proof. intros x; assert (H : exp x <> 0). - assert (H := exp_pos x); red in |- *; intro; rewrite H0 in H; + assert (H := exp_pos x); red; intro; rewrite H0 in H; elim (Rlt_irrefl _ H). apply Rmult_eq_reg_l with (r := exp x). rewrite <- exp_plus; rewrite Rplus_opp_r; rewrite exp_0. @@ -306,11 +306,11 @@ Theorem ln_continue : forall y:R, 0 < y -> continue_in ln (fun x:R => 0 < x) y. Proof. intros y H. - unfold continue_in, limit1_in, limit_in in |- *; intros eps Heps. + unfold continue_in, limit1_in, limit_in; intros eps Heps. cut (1 < exp eps); [ intros H1 | idtac ]. cut (exp (- eps) < 1); [ intros H2 | idtac ]. exists (Rmin (y * (exp eps - 1)) (y * (1 - exp (- eps)))); split. - red in |- *; apply P_Rmin. + red; apply P_Rmin. apply Rmult_lt_0_compat. assumption. apply Rplus_lt_reg_r with 1. @@ -321,7 +321,7 @@ Proof. apply Rplus_lt_reg_r with (exp (- eps)). rewrite Rplus_0_r; replace (exp (- eps) + (1 - exp (- eps))) with 1; [ apply H2 | ring ]. - unfold dist, R_met, R_dist in |- *; simpl in |- *. + unfold dist, R_met, R_dist; simpl. intros x [[H3 H4] H5]. cut (y * (x * / y) = x). intro Hxyy. @@ -351,7 +351,7 @@ Proof. rewrite Hxyy; rewrite Rmult_1_r; apply Hxy. rewrite Hxy; rewrite Rinv_r. rewrite ln_1; rewrite Rabs_R0; apply Heps. - red in |- *; intro; rewrite H0 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H0 in H; elim (Rlt_irrefl _ H). rewrite Rabs_right. apply exp_lt_inv. rewrite exp_ln. @@ -366,7 +366,7 @@ Proof. left; apply (Rgt_minus _ _ Hxy). apply Rmult_lt_0_compat; [ apply H3 | apply (Rinv_0_lt_compat _ H) ]. rewrite <- ln_1. - apply Rgt_ge; red in |- *; apply ln_increasing. + apply Rgt_ge; red; apply ln_increasing. apply Rlt_0_1. apply Rmult_lt_reg_l with (r := y). apply H. @@ -379,7 +379,7 @@ Proof. apply Rinv_0_lt_compat; assumption. rewrite (Rmult_comm x); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. ring. - red in |- *; intro; rewrite H0 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H0 in H; elim (Rlt_irrefl _ H). apply Rmult_lt_reg_l with (exp eps). apply exp_pos. rewrite <- exp_plus; rewrite Rmult_1_r; rewrite Rplus_opp_r; rewrite exp_0; @@ -394,7 +394,7 @@ Qed. Definition Rpower (x y:R) := exp (y * ln x). -Infix Local "^R" := Rpower (at level 30, right associativity) : R_scope. +Local Infix "^R" := Rpower (at level 30, right associativity) : R_scope. (******************************************************************) (** * Properties of Rpower *) @@ -412,13 +412,13 @@ Infix Local "^R" := Rpower (at level 30, right associativity) : R_scope. Theorem Rpower_plus : forall x y z:R, z ^R (x + y) = z ^R x * z ^R y. Proof. - intros x y z; unfold Rpower in |- *. + intros x y z; unfold Rpower. rewrite Rmult_plus_distr_r; rewrite exp_plus; auto. Qed. Theorem Rpower_mult : forall x y z:R, (x ^R y) ^R z = x ^R (y * z). Proof. - intros x y z; unfold Rpower in |- *. + intros x y z; unfold Rpower. rewrite ln_exp. replace (z * (y * ln x)) with (y * z * ln x). reflexivity. @@ -427,22 +427,22 @@ Qed. Theorem Rpower_O : forall x:R, 0 < x -> x ^R 0 = 1. Proof. - intros x _; unfold Rpower in |- *. + intros x _; unfold Rpower. rewrite Rmult_0_l; apply exp_0. Qed. Theorem Rpower_1 : forall x:R, 0 < x -> x ^R 1 = x. Proof. - intros x H; unfold Rpower in |- *. + intros x H; unfold Rpower. rewrite Rmult_1_l; apply exp_ln; apply H. Qed. Theorem Rpower_pow : forall (n:nat) (x:R), 0 < x -> x ^R INR n = x ^ n. Proof. - intros n; elim n; simpl in |- *; auto; fold INR in |- *. + intros n; elim n; simpl; auto; fold INR. intros x H; apply Rpower_O; auto. intros n1; case n1. - intros H x H0; simpl in |- *; rewrite Rmult_1_r; apply Rpower_1; auto. + intros H x H0; simpl; rewrite Rmult_1_r; apply Rpower_1; auto. intros n0 H x H0; rewrite Rpower_plus; rewrite H; try rewrite Rpower_1; try apply Rmult_comm || assumption. Qed. @@ -451,7 +451,7 @@ Theorem Rpower_lt : forall x y z:R, 1 < x -> 0 <= y -> y < z -> x ^R y < x ^R z. Proof. intros x y z H H0 H1. - unfold Rpower in |- *. + unfold Rpower. apply exp_increasing. apply Rmult_lt_compat_r. rewrite <- ln_1; apply ln_increasing. @@ -464,18 +464,18 @@ Theorem Rpower_sqrt : forall x:R, 0 < x -> x ^R (/ 2) = sqrt x. Proof. intros x H. apply ln_inv. - unfold Rpower in |- *; apply exp_pos. + unfold Rpower; apply exp_pos. apply sqrt_lt_R0; apply H. apply Rmult_eq_reg_l with (INR 2). apply exp_inv. - fold Rpower in |- *. + fold Rpower. cut ((x ^R (/ INR 2)) ^R INR 2 = sqrt x ^R INR 2). - unfold Rpower in |- *; auto. + unfold Rpower; auto. rewrite Rpower_mult. rewrite Rinv_l. replace 1 with (INR 1); auto. - repeat rewrite Rpower_pow; simpl in |- *. - pattern x at 1 in |- *; rewrite <- (sqrt_sqrt x (Rlt_le _ _ H)). + repeat rewrite Rpower_pow; simpl. + pattern x at 1; rewrite <- (sqrt_sqrt x (Rlt_le _ _ H)). ring. apply sqrt_lt_R0; apply H. apply H. @@ -485,7 +485,7 @@ Qed. Theorem Rpower_Ropp : forall x y:R, x ^R (- y) = / x ^R y. Proof. - unfold Rpower in |- *. + unfold Rpower. intros x y; rewrite Ropp_mult_distr_l_reverse. apply exp_Ropp. Qed. @@ -505,11 +505,11 @@ Proof. rewrite Rinv_r. apply exp_lt_inv. apply Rle_lt_trans with (1 := exp_le_3). - change (3 < 2 ^R 2) in |- *. + change (3 < 2 ^R 2). repeat rewrite Rpower_plus; repeat rewrite Rpower_1. repeat rewrite Rmult_plus_distr_r; repeat rewrite Rmult_plus_distr_l; repeat rewrite Rmult_1_l. - pattern 3 at 1 in |- *; rewrite <- Rplus_0_r; replace (2 + 2) with (3 + 1); + pattern 3 at 1; rewrite <- Rplus_0_r; replace (2 + 2) with (3 + 1); [ apply Rplus_lt_compat_l; apply Rlt_0_1 | ring ]. prove_sup0. discrR. @@ -523,7 +523,7 @@ Theorem limit1_ext : forall (f g:R -> R) (D:R -> Prop) (l x:R), (forall x:R, D x -> f x = g x) -> limit1_in f D l x -> limit1_in g D l x. Proof. - intros f g D l x H; unfold limit1_in, limit_in in |- *. + intros f g D l x H; unfold limit1_in, limit_in. intros H0 eps H1; case (H0 eps); auto. intros x0 [H2 H3]; exists x0; split; auto. intros x1 [H4 H5]; rewrite <- H; auto. @@ -533,7 +533,7 @@ Theorem limit1_imp : forall (f:R -> R) (D D1:R -> Prop) (l x:R), (forall x:R, D1 x -> D x) -> limit1_in f D l x -> limit1_in f D1 l x. Proof. - intros f D D1 l x H; unfold limit1_in, limit_in in |- *. + intros f D D1 l x H; unfold limit1_in, limit_in. intros H0 eps H1; case (H0 eps H1); auto. intros alpha [H2 H3]; exists alpha; split; auto. intros d [H4 H5]; apply H3; split; auto. @@ -541,7 +541,7 @@ Qed. Theorem Rinv_Rdiv : forall x y:R, x <> 0 -> y <> 0 -> / (x / y) = y / x. Proof. - intros x y H1 H2; unfold Rdiv in |- *; rewrite Rinv_mult_distr. + intros x y H1 H2; unfold Rdiv; rewrite Rinv_mult_distr. rewrite Rinv_involutive. apply Rmult_comm. assumption. @@ -551,18 +551,18 @@ Qed. Theorem Dln : forall y:R, 0 < y -> D_in ln Rinv (fun x:R => 0 < x) y. Proof. - intros y Hy; unfold D_in in |- *. + intros y Hy; unfold D_in. apply limit1_ext with (f := fun x:R => / ((exp (ln x) - exp (ln y)) / (ln x - ln y))). intros x [HD1 HD2]; repeat rewrite exp_ln. - unfold Rdiv in |- *; rewrite Rinv_mult_distr. + unfold Rdiv; rewrite Rinv_mult_distr. rewrite Rinv_involutive. apply Rmult_comm. apply Rminus_eq_contra. - red in |- *; intros H2; case HD2. - symmetry in |- *; apply (ln_inv _ _ HD1 Hy H2). - apply Rminus_eq_contra; apply (sym_not_eq HD2). - apply Rinv_neq_0_compat; apply Rminus_eq_contra; red in |- *; intros H2; + red; intros H2; case HD2. + symmetry ; apply (ln_inv _ _ HD1 Hy H2). + apply Rminus_eq_contra; apply (not_eq_sym HD2). + apply Rinv_neq_0_compat; apply Rminus_eq_contra; red; intros H2; case HD2; apply ln_inv; auto. assumption. assumption. @@ -574,62 +574,62 @@ Proof. intros x [H1 H2]; split. split; auto. split; auto. - red in |- *; intros H3; case H2; apply ln_inv; auto. + red; intros H3; case H2; apply ln_inv; auto. apply limit_comp with (l := ln y) (g := fun x:R => (exp x - exp (ln y)) / (x - ln y)) (f := ln). apply ln_continue; auto. assert (H0 := derivable_pt_lim_exp (ln y)); unfold derivable_pt_lim in H0; - unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold R_dist in |- *; intros; elim (H0 _ H); + unfold limit1_in; unfold limit_in; + simpl; unfold R_dist; intros; elim (H0 _ H); intros; exists (pos x); split. apply (cond_pos x). - intros; pattern y at 3 in |- *; rewrite <- exp_ln. - pattern x0 at 1 in |- *; replace x0 with (ln y + (x0 - ln y)); + intros; pattern y at 3; rewrite <- exp_ln. + pattern x0 at 1; replace x0 with (ln y + (x0 - ln y)); [ idtac | ring ]. apply H1. elim H2; intros H3 _; unfold D_x in H3; elim H3; clear H3; intros _ H3; - apply Rminus_eq_contra; apply (sym_not_eq (A:=R)); + apply Rminus_eq_contra; apply (not_eq_sym (A:=R)); apply H3. elim H2; clear H2; intros _ H2; apply H2. assumption. - red in |- *; intro; rewrite H in Hy; elim (Rlt_irrefl _ Hy). + red; intro; rewrite H in Hy; elim (Rlt_irrefl _ Hy). Qed. Lemma derivable_pt_lim_ln : forall x:R, 0 < x -> derivable_pt_lim ln x (/ x). Proof. intros; assert (H0 := Dln x H); unfold D_in in H0; unfold limit1_in in H0; unfold limit_in in H0; simpl in H0; unfold R_dist in H0; - unfold derivable_pt_lim in |- *; intros; elim (H0 _ H1); + unfold derivable_pt_lim; intros; elim (H0 _ H1); intros; elim H2; clear H2; intros; set (alp := Rmin x0 (x / 2)); assert (H4 : 0 < alp). - unfold alp in |- *; unfold Rmin in |- *; case (Rle_dec x0 (x / 2)); intro. + unfold alp; unfold Rmin; case (Rle_dec x0 (x / 2)); intro. apply H2. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. - exists (mkposreal _ H4); intros; pattern h at 2 in |- *; + exists (mkposreal _ H4); intros; pattern h at 2; replace h with (x + h - x); [ idtac | ring ]. apply H3; split. - unfold D_x in |- *; split. + unfold D_x; split. case (Rcase_abs h); intro. assert (H7 : Rabs h < x / 2). apply Rlt_le_trans with alp. apply H6. - unfold alp in |- *; apply Rmin_r. + unfold alp; apply Rmin_r. apply Rlt_trans with (x / 2). - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. rewrite Rabs_left in H7. apply Rplus_lt_reg_r with (- h - x / 2). replace (- h - x / 2 + x / 2) with (- h); [ idtac | ring ]. - pattern x at 2 in |- *; rewrite double_var. + pattern x at 2; rewrite double_var. replace (- h - x / 2 + (x / 2 + x / 2 + h)) with (x / 2); [ apply H7 | ring ]. apply r. apply Rplus_lt_le_0_compat; [ assumption | apply Rge_le; apply r ]. - apply (sym_not_eq (A:=R)); apply Rminus_not_eq; replace (x + h - x) with h; + apply (not_eq_sym (A:=R)); apply Rminus_not_eq; replace (x + h - x) with h; [ apply H5 | ring ]. replace (x + h - x) with h; [ apply Rlt_le_trans with alp; - [ apply H6 | unfold alp in |- *; apply Rmin_l ] + [ apply H6 | unfold alp; apply Rmin_l ] | ring ]. Qed. @@ -637,7 +637,7 @@ Theorem D_in_imp : forall (f g:R -> R) (D D1:R -> Prop) (x:R), (forall x:R, D1 x -> D x) -> D_in f g D x -> D_in f g D1 x. Proof. - intros f g D D1 x H; unfold D_in in |- *. + intros f g D D1 x H; unfold D_in. intros H0; apply limit1_imp with (D := D_x D x); auto. intros x1 [H1 H2]; split; auto. Qed. @@ -646,7 +646,7 @@ Theorem D_in_ext : forall (f g h:R -> R) (D:R -> Prop) (x:R), f x = g x -> D_in h f D x -> D_in h g D x. Proof. - intros f g h D x H; unfold D_in in |- *. + intros f g h D x H; unfold D_in. rewrite H; auto. Qed. @@ -661,7 +661,7 @@ Proof. intros x H0; repeat split. assumption. apply D_in_ext with (f := fun x:R => / x * (z * exp (z * ln x))). - unfold Rminus in |- *; rewrite Rpower_plus; rewrite Rpower_Ropp; + unfold Rminus; rewrite Rpower_plus; rewrite Rpower_Ropp; rewrite (Rpower_1 _ H); unfold Rpower; ring. apply Dcomp with (f := ln) @@ -674,7 +674,7 @@ Proof. intros x H1; repeat split; auto. apply (Dcomp (fun _:R => True) (fun _:R => True) (fun x => z) exp - (fun x:R => z * x) exp); simpl in |- *. + (fun x:R => z * x) exp); simpl. apply D_in_ext with (f := fun x:R => z * 1). apply Rmult_1_r. apply (Dmult_const (fun x => True) (fun x => x) (fun x => 1)); apply Dx. @@ -687,16 +687,16 @@ Theorem derivable_pt_lim_power : 0 < x -> derivable_pt_lim (fun x => x ^R y) x (y * x ^R (y - 1)). Proof. intros x y H. - unfold Rminus in |- *; rewrite Rpower_plus. + unfold Rminus; rewrite Rpower_plus. rewrite Rpower_Ropp. rewrite Rpower_1; auto. rewrite <- Rmult_assoc. - unfold Rpower in |- *. + unfold Rpower. apply derivable_pt_lim_comp with (f1 := ln) (f2 := fun x => exp (y * x)). apply derivable_pt_lim_ln; assumption. rewrite (Rmult_comm y). apply derivable_pt_lim_comp with (f1 := fun x => y * x) (f2 := exp). - pattern y at 2 in |- *; replace y with (0 * ln x + y * 1). + pattern y at 2; replace y with (0 * ln x + y * 1). apply derivable_pt_lim_mult with (f1 := fun x:R => y) (f2 := fun x:R => x). apply derivable_pt_lim_const with (a := y). apply derivable_pt_lim_id. diff --git a/theories/Reals/Rprod.v b/theories/Reals/Rprod.v index 12258d6b..88c4de23 100644 --- a/theories/Reals/Rprod.v +++ b/theories/Reals/Rprod.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -12,7 +12,7 @@ Require Import Rfunctions. Require Import Rseries. Require Import PartSum. Require Import Binomial. -Open Local Scope R_scope. +Local Open Scope R_scope. (** TT Ak; 0<=k<=N *) Fixpoint prod_f_R0 (f:nat -> R) (N:nat) : R := @@ -36,7 +36,7 @@ Proof. replace (S n - k - 1)%nat with O; [rewrite H1; simpl|omega]. replace (n+1+0)%nat with (S n); ring. replace (S n - k-1)%nat with (S (n - k-1));[idtac|omega]. - simpl in |- *; replace (k + S (n - k))%nat with (S n). + simpl; replace (k + S (n - k))%nat with (S n). replace (k + 1 + S (n - k - 1))%nat with (S n). rewrite Hrecn; [ ring | assumption ]. omega. @@ -49,8 +49,8 @@ Lemma prod_SO_pos : (forall n:nat, (n <= N)%nat -> 0 <= An n) -> 0 <= prod_f_R0 An N. Proof. intros; induction N as [| N HrecN]. - simpl in |- *; apply H; trivial. - simpl in |- *; apply Rmult_le_pos. + simpl; apply H; trivial. + simpl; apply Rmult_le_pos. apply HrecN; intros; apply H; apply le_trans with N; [ assumption | apply le_n_Sn ]. apply H; apply le_n. @@ -64,7 +64,7 @@ Lemma prod_SO_Rle : Proof. intros; induction N as [| N HrecN]. elim H with O; trivial. - simpl in |- *; apply Rle_trans with (prod_f_R0 An N * Bn (S N)). + simpl; apply Rle_trans with (prod_f_R0 An N * Bn (S N)). apply Rmult_le_compat_l. apply prod_SO_pos; intros; elim (H n (le_trans _ _ _ H0 (le_n_Sn N))); intros; assumption. @@ -114,7 +114,7 @@ Proof. (if eq_nat_dec n 0 then 1 else INR n) = INR n). intros n; case (eq_nat_dec n 0); auto with real. intros; absurd (0 < n)%nat; omega. - intros; unfold Rsqr in |- *; repeat rewrite fact_prodSO. + intros; unfold Rsqr; repeat rewrite fact_prodSO. cut ((k=N)%nat \/ (k < N)%nat \/ (N < k)%nat). intro H2; elim H2; intro H3. rewrite H3; replace (2*N-N)%nat with N;[right; ring|omega]. @@ -164,14 +164,14 @@ Qed. (**********) Lemma INR_fact_lt_0 : forall n:nat, 0 < INR (fact n). Proof. - intro; apply lt_INR_0; apply neq_O_lt; red in |- *; intro; - elim (fact_neq_0 n); symmetry in |- *; assumption. + intro; apply lt_INR_0; apply neq_O_lt; red; intro; + elim (fact_neq_0 n); symmetry ; assumption. Qed. (** We have the following inequality : (C 2N k) <= (C 2N N) forall k in [|O;2N|] *) Lemma C_maj : forall N k:nat, (k <= 2 * N)%nat -> C (2 * N) k <= C (2 * N) N. Proof. - intros; unfold C in |- *; unfold Rdiv in |- *; apply Rmult_le_compat_l. + intros; unfold C; unfold Rdiv; apply Rmult_le_compat_l. apply pos_INR. replace (2 * N - N)%nat with N. apply Rmult_le_reg_l with (INR (fact N) * INR (fact N)). diff --git a/theories/Reals/Rseries.v b/theories/Reals/Rseries.v index 479d381d..3c10725b 100644 --- a/theories/Reals/Rseries.v +++ b/theories/Reals/Rseries.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,7 +9,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import Compare. -Open Local Scope R_scope. +Local Open Scope R_scope. Implicit Type r : R. @@ -54,20 +54,20 @@ Section sequence. (*********) Lemma EUn_noempty : exists r : R, EUn r. Proof. - unfold EUn in |- *; split with (Un 0); split with 0%nat; trivial. + unfold EUn; split with (Un 0); split with 0%nat; trivial. Qed. (*********) Lemma Un_in_EUn : forall n:nat, EUn (Un n). Proof. - intro; unfold EUn in |- *; split with n; trivial. + intro; unfold EUn; split with n; trivial. Qed. (*********) Lemma Un_bound_imp : forall x:R, (forall n:nat, Un n <= x) -> is_upper_bound EUn x. Proof. - intros; unfold is_upper_bound in |- *; intros; unfold EUn in H0; elim H0; + intros; unfold is_upper_bound; intros; unfold EUn in H0; elim H0; clear H0; intros; generalize (H x1); intro; rewrite <- H0 in H1; trivial. Qed. @@ -77,7 +77,7 @@ Section sequence. forall n m:nat, Un_growing -> (n >= m)%nat -> Un n >= Un m. Proof. double induction n m; intros. - unfold Rge in |- *; right; trivial. + unfold Rge; right; trivial. exfalso; unfold ge in H1; generalize (le_Sn_O n0); intro; auto. cut (n0 >= 0)%nat. generalize H0; intros; unfold Un_growing in H0; @@ -89,7 +89,7 @@ Section sequence. elim y; clear y; intro y. unfold ge in H2; generalize (le_not_lt n0 n1 (le_S_n n0 n1 H2)); intro; exfalso; auto. - rewrite y; unfold Rge in |- *; right; trivial. + rewrite y; unfold Rge; right; trivial. unfold ge in H0; generalize (H0 (S n0) H1 (lt_le_S n0 n1 y)); intro; unfold Un_growing in H1; apply @@ -182,13 +182,13 @@ Section sequence. assert (Hs0: forall n, sum n = 0). intros n. - specialize (Hm1 (sum n) (ex_intro _ _ (refl_equal _))). + specialize (Hm1 (sum n) (ex_intro _ _ (eq_refl _))). apply Rle_antisym with (2 := proj1 (Hsum n)). now rewrite <- Hm. assert (Hub: forall n, Un n <= l - eps). intros n. - generalize (refl_equal (sum (S n))). + generalize (eq_refl (sum (S n))). simpl sum at 1. rewrite 2!Hs0, Rplus_0_l. unfold test. @@ -238,7 +238,7 @@ Section sequence. rewrite (IHN H6), Rplus_0_l. unfold test. destruct Rle_lt_dec. - apply refl_equal. + apply eq_refl. now elim Rlt_not_le with (1 := r). destruct (le_or_lt N n) as [Hn|Hn]. @@ -272,20 +272,20 @@ Section sequence. Proof. intro; induction N as [| N HrecN]. split with (Un 0); intros; rewrite (le_n_O_eq n H); - apply (Req_le (Un n) (Un n) (refl_equal (Un n))). + apply (Req_le (Un n) (Un n) (eq_refl (Un n))). elim HrecN; clear HrecN; intros; split with (Rmax (Un (S N)) x); intros; elim (Rmax_Rle (Un (S N)) x (Un n)); intros; clear H1; inversion H0. rewrite <- H1; rewrite <- H1 in H2; apply - (H2 (or_introl (Un n <= x) (Req_le (Un n) (Un n) (refl_equal (Un n))))). + (H2 (or_introl (Un n <= x) (Req_le (Un n) (Un n) (eq_refl (Un n))))). apply (H2 (or_intror (Un n <= Un (S N)) (H n H3))). Qed. (*********) Lemma cauchy_bound : Cauchy_crit -> bound EUn. Proof. - unfold Cauchy_crit, bound in |- *; intros; unfold is_upper_bound in |- *; + unfold Cauchy_crit, bound; intros; unfold is_upper_bound; unfold Rgt in H; elim (H 1 Rlt_0_1); clear H; intros; generalize (H x); intro; generalize (le_dec x); intro; elim (finite_greater x); intros; split with (Rmax x0 (Un x + 1)); @@ -324,12 +324,12 @@ End Isequence. Lemma GP_infinite : forall x:R, Rabs x < 1 -> Pser (fun n:nat => 1) x (/ (1 - x)). Proof. - intros; unfold Pser in |- *; unfold infinite_sum in |- *; intros; + intros; unfold Pser; unfold infinite_sum; intros; elim (Req_dec x 0). intros; exists 0%nat; intros; rewrite H1; rewrite Rminus_0_r; rewrite Rinv_1; cut (sum_f_R0 (fun n0:nat => 1 * 0 ^ n0) n = 1). intros; rewrite H3; rewrite R_dist_eq; auto. - elim n; simpl in |- *. + elim n; simpl. ring. intros; rewrite H3; ring. intro; cut (0 < eps * (Rabs (1 - x) * Rabs (/ x))). @@ -344,11 +344,11 @@ Proof. apply Rabs_pos_lt. apply Rminus_eq_contra. apply Rlt_dichotomy_converse. - right; unfold Rgt in |- *. + right; unfold Rgt. apply (Rle_lt_trans x (Rabs x) 1). apply RRle_abs. assumption. - unfold R_dist in |- *; rewrite <- Rabs_mult. + unfold R_dist; rewrite <- Rabs_mult. rewrite Rmult_minus_distr_l. cut ((1 - x) * sum_f_R0 (fun n0:nat => x ^ n0) n = @@ -359,7 +359,7 @@ Proof. cut (- (x ^ (n + 1) - 1) - 1 = - x ^ (n + 1)). intro; rewrite H7. rewrite Rabs_Ropp; cut ((n + 1)%nat = S n); auto. - intro H8; rewrite H8; simpl in |- *; rewrite Rabs_mult; + intro H8; rewrite H8; simpl; rewrite Rabs_mult; apply (Rlt_le_trans (Rabs x * Rabs (x ^ n)) (Rabs x * (eps * (Rabs (1 - x) * Rabs (/ x)))) ( @@ -373,7 +373,7 @@ Proof. Rabs x * Rabs (/ x) * (eps * Rabs (1 - x))). clear H8; intros; rewrite H8; rewrite <- Rabs_mult; rewrite Rinv_r. rewrite Rabs_R1; cut (1 * (eps * Rabs (1 - x)) = Rabs (1 - x) * eps). - intros; rewrite H9; unfold Rle in |- *; right; reflexivity. + intros; rewrite H9; unfold Rle; right; reflexivity. ring. assumption. ring. @@ -381,12 +381,12 @@ Proof. ring. apply Rminus_eq_contra. apply Rlt_dichotomy_converse. - right; unfold Rgt in |- *. + right; unfold Rgt. apply (Rle_lt_trans x (Rabs x) 1). apply RRle_abs. assumption. ring; ring. - elim n; simpl in |- *. + elim n; simpl. ring. intros; rewrite H5. ring. @@ -396,7 +396,7 @@ Proof. apply Rabs_pos_lt. apply Rminus_eq_contra. apply Rlt_dichotomy_converse. - right; unfold Rgt in |- *. + right; unfold Rgt. apply (Rle_lt_trans x (Rabs x) 1). apply RRle_abs. assumption. diff --git a/theories/Reals/Rsigma.v b/theories/Reals/Rsigma.v index 0027c274..76b44d96 100644 --- a/theories/Reals/Rsigma.v +++ b/theories/Reals/Rsigma.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -10,7 +10,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import Rseries. Require Import PartSum. -Open Local Scope R_scope. +Local Open Scope R_scope. Set Implicit Arguments. @@ -28,8 +28,8 @@ Section Sigma. Proof. intros; induction k as [| k Hreck]. cut (low = 0%nat). - intro; rewrite H1; unfold sigma in |- *; rewrite <- minus_n_n; - rewrite <- minus_n_O; simpl in |- *; replace (high - 1)%nat with (pred high). + intro; rewrite H1; unfold sigma; rewrite <- minus_n_n; + rewrite <- minus_n_O; simpl; replace (high - 1)%nat with (pred high). apply (decomp_sum (fun k:nat => f k)). assumption. apply pred_of_minus. @@ -42,8 +42,8 @@ Section Sigma. apply Hreck. assumption. apply lt_trans with (S k); [ apply lt_n_Sn | assumption ]. - unfold sigma in |- *; replace (high - S (S k))%nat with (pred (high - S k)). - pattern (S k) at 3 in |- *; replace (S k) with (S k + 0)%nat; + unfold sigma; replace (high - S (S k))%nat with (pred (high - S k)). + pattern (S k) at 3; replace (S k) with (S k + 0)%nat; [ idtac | ring ]. replace (sum_f_R0 (fun k0:nat => f (S (S k) + k0)) (pred (high - S k))) with (sum_f_R0 (fun k0:nat => f (S k + S k0)) (pred (high - S k))). @@ -55,12 +55,12 @@ Section Sigma. replace (high - S (S k))%nat with (high - S k - 1)%nat. apply pred_of_minus. omega. - unfold sigma in |- *; replace (S k - low)%nat with (S (k - low)). - pattern (S k) at 1 in |- *; replace (S k) with (low + S (k - low))%nat. - symmetry in |- *; apply (tech5 (fun i:nat => f (low + i))). + unfold sigma; replace (S k - low)%nat with (S (k - low)). + pattern (S k) at 1; replace (S k) with (low + S (k - low))%nat. + symmetry ; apply (tech5 (fun i:nat => f (low + i))). omega. omega. - rewrite <- H2; unfold sigma in |- *; rewrite <- minus_n_n; simpl in |- *; + rewrite <- H2; unfold sigma; rewrite <- minus_n_n; simpl; replace (high - S low)%nat with (pred (high - low)). replace (sum_f_R0 (fun k0:nat => f (S (low + k0))) (pred (high - low))) with (sum_f_R0 (fun k0:nat => f (low + S k0)) (pred (high - low))). @@ -79,7 +79,7 @@ Section Sigma. (low <= k)%nat -> (k < high)%nat -> sigma low high - sigma low k = sigma (S k) high. Proof. - intros low high k H1 H2; symmetry in |- *; rewrite (sigma_split H1 H2); ring. + intros low high k H1 H2; symmetry ; rewrite (sigma_split H1 H2); ring. Qed. Theorem sigma_diff_neg : @@ -100,8 +100,8 @@ Section Sigma. apply sigma_split. apply le_n. assumption. - unfold sigma in |- *; rewrite <- minus_n_n. - simpl in |- *. + unfold sigma; rewrite <- minus_n_n. + simpl. replace (low + 0)%nat with low; [ reflexivity | ring ]. Qed. @@ -113,20 +113,20 @@ Section Sigma. generalize (lt_le_weak low high H1); intro H3; replace (f high) with (sigma high high). rewrite Rplus_comm; cut (high = S (pred high)). - intro; pattern high at 3 in |- *; rewrite H. + intro; pattern high at 3; rewrite H. apply sigma_split. apply le_S_n; rewrite <- H; apply lt_le_S; assumption. apply lt_pred_n_n; apply le_lt_trans with low; [ apply le_O_n | assumption ]. apply S_pred with 0%nat; apply le_lt_trans with low; [ apply le_O_n | assumption ]. - unfold sigma in |- *; rewrite <- minus_n_n; simpl in |- *; + unfold sigma; rewrite <- minus_n_n; simpl; replace (high + 0)%nat with high; [ reflexivity | ring ]. Qed. Theorem sigma_eq_arg : forall low:nat, sigma low low = f low. Proof. - intro; unfold sigma in |- *; rewrite <- minus_n_n. - simpl in |- *; replace (low + 0)%nat with low; [ reflexivity | ring ]. + intro; unfold sigma; rewrite <- minus_n_n. + simpl; replace (low + 0)%nat with low; [ reflexivity | ring ]. Qed. End Sigma. diff --git a/theories/Reals/Rsqrt_def.v b/theories/Reals/Rsqrt_def.v index 7c3b4699..a6e48f83 100644 --- a/theories/Reals/Rsqrt_def.v +++ b/theories/Reals/Rsqrt_def.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -11,7 +11,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. Require Import Ranalysis1. -Open Local Scope R_scope. +Local Open Scope R_scope. Fixpoint Dichotomy_lb (x y:R) (P:R -> bool) (N:nat) {struct N} : R := match N with @@ -41,18 +41,18 @@ Lemma dicho_comp : Proof. intros. induction n as [| n Hrecn]. - simpl in |- *; assumption. - simpl in |- *. + simpl; assumption. + simpl. case (P ((Dichotomy_lb x y P n + Dichotomy_ub x y P n) / 2)). - unfold Rdiv in |- *; apply Rmult_le_reg_l with 2. + unfold Rdiv; apply Rmult_le_reg_l with 2. prove_sup0. - pattern 2 at 1 in |- *; rewrite Rmult_comm. + pattern 2 at 1; rewrite Rmult_comm. rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ idtac | discrR ]. rewrite Rmult_1_r. rewrite double. apply Rplus_le_compat_l. assumption. - unfold Rdiv in |- *; apply Rmult_le_reg_l with 2. + unfold Rdiv; apply Rmult_le_reg_l with 2. prove_sup0. rewrite Rmult_comm. rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ idtac | discrR ]. @@ -67,14 +67,14 @@ Lemma dicho_lb_growing : forall (x y:R) (P:R -> bool), x <= y -> Un_growing (dicho_lb x y P). Proof. intros. - unfold Un_growing in |- *. + unfold Un_growing. intro. - simpl in |- *. + simpl. case (P ((Dichotomy_lb x y P n + Dichotomy_ub x y P n) / 2)). right; reflexivity. - unfold Rdiv in |- *; apply Rmult_le_reg_l with 2. + unfold Rdiv; apply Rmult_le_reg_l with 2. prove_sup0. - pattern 2 at 1 in |- *; rewrite Rmult_comm. + pattern 2 at 1; rewrite Rmult_comm. rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ idtac | discrR ]. rewrite Rmult_1_r. rewrite double. @@ -87,11 +87,11 @@ Lemma dicho_up_decreasing : forall (x y:R) (P:R -> bool), x <= y -> Un_decreasing (dicho_up x y P). Proof. intros. - unfold Un_decreasing in |- *. + unfold Un_decreasing. intro. - simpl in |- *. + simpl. case (P ((Dichotomy_lb x y P n + Dichotomy_ub x y P n) / 2)). - unfold Rdiv in |- *; apply Rmult_le_reg_l with 2. + unfold Rdiv; apply Rmult_le_reg_l with 2. prove_sup0. rewrite Rmult_comm. rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ idtac | discrR ]. @@ -112,17 +112,17 @@ Lemma dicho_lb_maj_y : Proof. intros. induction n as [| n Hrecn]. - simpl in |- *; assumption. - simpl in |- *. + simpl; assumption. + simpl. case (P ((Dichotomy_lb x y P n + Dichotomy_ub x y P n) / 2)). assumption. - unfold Rdiv in |- *; apply Rmult_le_reg_l with 2. + unfold Rdiv; apply Rmult_le_reg_l with 2. prove_sup0. rewrite Rmult_comm. rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ rewrite Rmult_1_r | discrR ]. rewrite double; apply Rplus_le_compat. assumption. - pattern y at 2 in |- *; replace y with (Dichotomy_ub x y P 0); + pattern y at 2; replace y with (Dichotomy_ub x y P 0); [ idtac | reflexivity ]. apply decreasing_prop. assert (H0 := dicho_up_decreasing x y P H). @@ -136,10 +136,10 @@ Proof. intros. cut (forall n:nat, dicho_lb x y P n <= y). intro. - unfold has_ub in |- *. - unfold bound in |- *. + unfold has_ub. + unfold bound. exists y. - unfold is_upper_bound in |- *. + unfold is_upper_bound. intros. elim H1; intros. rewrite H2; apply H0. @@ -151,15 +151,15 @@ Lemma dicho_up_min_x : Proof. intros. induction n as [| n Hrecn]. - simpl in |- *; assumption. - simpl in |- *. + simpl; assumption. + simpl. case (P ((Dichotomy_lb x y P n + Dichotomy_ub x y P n) / 2)). - unfold Rdiv in |- *; apply Rmult_le_reg_l with 2. + unfold Rdiv; apply Rmult_le_reg_l with 2. prove_sup0. - pattern 2 at 1 in |- *; rewrite Rmult_comm. + pattern 2 at 1; rewrite Rmult_comm. rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ rewrite Rmult_1_r | discrR ]. rewrite double; apply Rplus_le_compat. - pattern x at 1 in |- *; replace x with (Dichotomy_lb x y P 0); + pattern x at 1; replace x with (Dichotomy_lb x y P 0); [ idtac | reflexivity ]. apply tech9. assert (H0 := dicho_lb_growing x y P H). @@ -175,14 +175,14 @@ Proof. intros. cut (forall n:nat, x <= dicho_up x y P n). intro. - unfold has_lb in |- *. - unfold bound in |- *. + unfold has_lb. + unfold bound. exists (- x). - unfold is_upper_bound in |- *. + unfold is_upper_bound. intros. elim H1; intros. rewrite H2. - unfold opp_seq in |- *. + unfold opp_seq. apply Ropp_le_contravar. apply H0. apply dicho_up_min_x; assumption. @@ -214,35 +214,35 @@ Lemma dicho_lb_dicho_up : Proof. intros. induction n as [| n Hrecn]. - simpl in |- *. - unfold Rdiv in |- *; rewrite Rinv_1; ring. - simpl in |- *. + simpl. + unfold Rdiv; rewrite Rinv_1; ring. + simpl. case (P ((Dichotomy_lb x y P n + Dichotomy_ub x y P n) / 2)). - unfold Rdiv in |- *. + unfold Rdiv. replace ((Dichotomy_lb x y P n + Dichotomy_ub x y P n) * / 2 - Dichotomy_lb x y P n) with ((dicho_up x y P n - dicho_lb x y P n) / 2). - unfold Rdiv in |- *; rewrite Hrecn. - unfold Rdiv in |- *. + unfold Rdiv; rewrite Hrecn. + unfold Rdiv. rewrite Rinv_mult_distr. ring. discrR. apply pow_nonzero; discrR. - pattern (Dichotomy_lb x y P n) at 2 in |- *; + pattern (Dichotomy_lb x y P n) at 2; rewrite (double_var (Dichotomy_lb x y P n)); - unfold dicho_up, dicho_lb, Rminus, Rdiv in |- *; ring. + unfold dicho_up, dicho_lb, Rminus, Rdiv; ring. replace (Dichotomy_ub x y P n - (Dichotomy_lb x y P n + Dichotomy_ub x y P n) / 2) with ((dicho_up x y P n - dicho_lb x y P n) / 2). - unfold Rdiv in |- *; rewrite Hrecn. - unfold Rdiv in |- *. + unfold Rdiv; rewrite Hrecn. + unfold Rdiv. rewrite Rinv_mult_distr. ring. discrR. apply pow_nonzero; discrR. - pattern (Dichotomy_ub x y P n) at 1 in |- *; + pattern (Dichotomy_ub x y P n) at 1; rewrite (double_var (Dichotomy_ub x y P n)); - unfold dicho_up, dicho_lb, Rminus, Rdiv in |- *; ring. + unfold dicho_up, dicho_lb, Rminus, Rdiv; ring. Qed. Definition pow_2_n (n:nat) := 2 ^ n. @@ -250,23 +250,23 @@ Definition pow_2_n (n:nat) := 2 ^ n. Lemma pow_2_n_neq_R0 : forall n:nat, pow_2_n n <> 0. Proof. intro. - unfold pow_2_n in |- *. + unfold pow_2_n. apply pow_nonzero. discrR. Qed. Lemma pow_2_n_growing : Un_growing pow_2_n. Proof. - unfold Un_growing in |- *. + unfold Un_growing. intro. replace (S n) with (n + 1)%nat; - [ unfold pow_2_n in |- *; rewrite pow_add | ring ]. - pattern (2 ^ n) at 1 in |- *; rewrite <- Rmult_1_r. + [ unfold pow_2_n; rewrite pow_add | ring ]. + pattern (2 ^ n) at 1; rewrite <- Rmult_1_r. apply Rmult_le_compat_l. left; apply pow_lt; prove_sup0. - simpl in |- *. + simpl. rewrite Rmult_1_r. - pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; + pattern 1 at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; apply Rlt_0_1. Qed. @@ -274,7 +274,7 @@ Lemma pow_2_n_infty : cv_infty pow_2_n. Proof. cut (forall N:nat, INR N <= 2 ^ N). intros. - unfold cv_infty in |- *. + unfold cv_infty. intro. case (total_order_T 0 M); intro. elim s; intro. @@ -287,41 +287,41 @@ Proof. apply Rlt_le_trans with (INR N0). rewrite INR_IZR_INZ. rewrite <- H1. - unfold N in |- *. + unfold N. assert (H3 := archimed M). elim H3; intros; assumption. apply Rle_trans with (pow_2_n N0). - unfold pow_2_n in |- *; apply H. + unfold pow_2_n; apply H. apply Rge_le. apply growing_prop. apply pow_2_n_growing. assumption. apply le_IZR. - unfold N in |- *. - simpl in |- *. + unfold N. + simpl. assert (H0 := archimed M); elim H0; intros. left; apply Rlt_trans with M; assumption. exists 0%nat; intros. rewrite <- b. - unfold pow_2_n in |- *; apply pow_lt; prove_sup0. + unfold pow_2_n; apply pow_lt; prove_sup0. exists 0%nat; intros. apply Rlt_trans with 0. assumption. - unfold pow_2_n in |- *; apply pow_lt; prove_sup0. + unfold pow_2_n; apply pow_lt; prove_sup0. simple induction N. - simpl in |- *. + simpl. left; apply Rlt_0_1. intros. - pattern (S n) at 2 in |- *; replace (S n) with (n + 1)%nat; [ idtac | ring ]. + pattern (S n) at 2; replace (S n) with (n + 1)%nat; [ idtac | ring ]. rewrite S_INR; rewrite pow_add. - simpl in |- *. + simpl. rewrite Rmult_1_r. apply Rle_trans with (2 ^ n). rewrite <- (Rplus_comm 1). rewrite <- (Rmult_1_r (INR n)). apply (poly n 1). apply Rlt_0_1. - pattern (2 ^ n) at 1 in |- *; rewrite <- Rplus_0_r. + pattern (2 ^ n) at 1; rewrite <- Rplus_0_r. rewrite <- (Rmult_comm 2). rewrite double. apply Rplus_le_compat_l. @@ -338,8 +338,8 @@ Proof. cut (Un_cv (fun i:nat => dicho_lb x y P i - dicho_up x y P i) 0). intro. assert (H4 := UL_sequence _ _ _ H2 H3). - symmetry in |- *; apply Rminus_diag_uniq_sym; assumption. - unfold Un_cv in |- *; unfold R_dist in |- *. + symmetry ; apply Rminus_diag_uniq_sym; assumption. + unfold Un_cv; unfold R_dist. intros. assert (H4 := cv_infty_cv_R0 pow_2_n pow_2_n_neq_R0 pow_2_n_infty). case (total_order_T x y); intro. @@ -356,7 +356,7 @@ Proof. rewrite <- Rabs_Ropp. rewrite Ropp_minus_distr'. rewrite dicho_lb_dicho_up. - unfold Rdiv in |- *; rewrite Rabs_mult. + unfold Rdiv; rewrite Rabs_mult. rewrite (Rabs_right (y - x)). apply Rmult_lt_reg_l with (/ (y - x)). apply Rinv_0_lt_compat; assumption. @@ -366,12 +366,12 @@ Proof. [ unfold pow_2_n, Rdiv in H6; rewrite <- (Rmult_comm eps); apply H6; assumption | ring ]. - red in |- *; intro; rewrite H8 in Hyp; elim (Rlt_irrefl _ Hyp). + red; intro; rewrite H8 in Hyp; elim (Rlt_irrefl _ Hyp). apply Rle_ge. apply Rplus_le_reg_l with x; rewrite Rplus_0_r. replace (x + (y - x)) with y; [ assumption | ring ]. assumption. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; assumption ]. apply Rplus_lt_reg_r with x; rewrite Rplus_0_r. replace (x + (y - x)) with y; [ assumption | ring ]. @@ -382,7 +382,7 @@ Proof. rewrite Ropp_minus_distr'. rewrite dicho_lb_dicho_up. rewrite b. - unfold Rminus, Rdiv in |- *; rewrite Rplus_opp_r; rewrite Rmult_0_l; + unfold Rminus, Rdiv; rewrite Rplus_opp_r; rewrite Rmult_0_l; rewrite Rabs_R0; assumption. assumption. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H r)). @@ -399,26 +399,26 @@ Lemma continuity_seq : forall (f:R -> R) (Un:nat -> R) (l:R), continuity_pt f l -> Un_cv Un l -> Un_cv (fun i:nat => f (Un i)) (f l). Proof. - unfold continuity_pt, Un_cv in |- *; unfold continue_in in |- *. - unfold limit1_in in |- *. - unfold limit_in in |- *. - unfold dist in |- *. - simpl in |- *. - unfold R_dist in |- *. + unfold continuity_pt, Un_cv; unfold continue_in. + unfold limit1_in. + unfold limit_in. + unfold dist. + simpl. + unfold R_dist. intros. elim (H eps H1); intros alp H2. elim H2; intros. elim (H0 alp H3); intros N H5. exists N; intros. case (Req_dec (Un n) l); intro. - rewrite H7; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + rewrite H7; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. apply H4. split. - unfold D_x, no_cond in |- *. + unfold D_x, no_cond. split. trivial. - apply (sym_not_eq (A:=R)); assumption. + apply (not_eq_sym (A:=R)); assumption. apply H5; assumption. Qed. @@ -428,9 +428,9 @@ Lemma dicho_lb_car : Proof. intros. induction n as [| n Hrecn]. - simpl in |- *. + simpl. assumption. - simpl in |- *. + simpl. assert (X := sumbool_of_bool (P ((Dichotomy_lb x y P n + Dichotomy_ub x y P n) / 2))). @@ -447,9 +447,9 @@ Lemma dicho_up_car : Proof. intros. induction n as [| n Hrecn]. - simpl in |- *. + simpl. assumption. - simpl in |- *. + simpl. assert (X := sumbool_of_bool (P ((Dichotomy_lb x y P n + Dichotomy_ub x y P n) / 2))). @@ -480,7 +480,7 @@ Proof. split. split. apply Rle_trans with (dicho_lb x y (fun z:R => cond_positivity (f z)) 0). - simpl in |- *. + simpl. right; reflexivity. apply growing_ineq. apply dicho_lb_growing; assumption. @@ -503,7 +503,7 @@ Proof. assert (H10 := H5 H7). apply Rle_antisym; assumption. intro. - unfold Wn in |- *. + unfold Wn. cut (forall z:R, cond_positivity z = true <-> 0 <= z). intro. assert (H8 := dicho_up_car x y (fun z:R => cond_positivity (f z)) n). @@ -514,7 +514,7 @@ Proof. apply H12. left; assumption. intro. - unfold cond_positivity in |- *. + unfold cond_positivity. case (Rle_dec 0 z); intro. split. intro; assumption. @@ -523,7 +523,7 @@ Proof. intro feqt;discriminate feqt. intro. elim n0; assumption. - unfold Vn in |- *. + unfold Vn. cut (forall z:R, cond_positivity z = false <-> z < 0). intros. assert (H8 := dicho_lb_car x y (fun z:R => cond_positivity (f z)) n). @@ -535,7 +535,7 @@ Proof. apply H12. assumption. intro. - unfold cond_positivity in |- *. + unfold cond_positivity. case (Rle_dec 0 z); intro. split. intro feqt; discriminate feqt. @@ -554,7 +554,7 @@ Proof. cut (0 < - f x0). intro. elim (H7 (- f x0) H8); intros. - cut (x2 >= x2)%nat; [ intro | unfold ge in |- *; apply le_n ]. + cut (x2 >= x2)%nat; [ intro | unfold ge; apply le_n ]. assert (H11 := H9 x2 H10). rewrite Rabs_right in H11. pattern (- f x0) at 1 in H11; rewrite <- Rplus_0_r in H11. @@ -562,11 +562,11 @@ Proof. assert (H12 := Rplus_lt_reg_r _ _ _ H11). assert (H13 := H6 x2). elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H13 H12)). - apply Rle_ge; left; unfold Rminus in |- *; apply Rplus_le_lt_0_compat. + apply Rle_ge; left; unfold Rminus; apply Rplus_le_lt_0_compat. apply H6. exact H8. apply Ropp_0_gt_lt_contravar; assumption. - unfold Wn in |- *; assumption. + unfold Wn; assumption. cut (Un_cv Vn x0). intros. assert (H7 := continuity_seq f Vn x0 (H x0) H5). @@ -574,7 +574,7 @@ Proof. elim s; intro. unfold Un_cv in H7; unfold R_dist in H7. elim (H7 (f x0) a); intros. - cut (x2 >= x2)%nat; [ intro | unfold ge in |- *; apply le_n ]. + cut (x2 >= x2)%nat; [ intro | unfold ge; apply le_n ]. assert (H10 := H8 x2 H9). rewrite Rabs_left in H10. pattern (f x0) at 2 in H10; rewrite <- Rplus_0_r in H10. @@ -589,12 +589,12 @@ Proof. apply Ropp_0_gt_lt_contravar; assumption. apply Rplus_lt_reg_r with (f x0 - f (Vn x2)). rewrite Rplus_0_r; replace (f x0 - f (Vn x2) + (f (Vn x2) - f x0)) with 0; - [ unfold Rminus in |- *; apply Rplus_lt_le_0_compat | ring ]. + [ unfold Rminus; apply Rplus_lt_le_0_compat | ring ]. assumption. apply Ropp_0_ge_le_contravar; apply Rle_ge; apply H6. right; rewrite <- b; reflexivity. left; assumption. - unfold Vn in |- *; assumption. + unfold Vn; assumption. Qed. Lemma IVT_cor : @@ -613,11 +613,11 @@ Proof. exists y. split. split; [ assumption | right; reflexivity ]. - symmetry in |- *; exact b. + symmetry ; exact b. exists x. split. split; [ right; reflexivity | assumption ]. - symmetry in |- *; exact b. + symmetry ; exact b. elim s; intro. cut (x < y). intro. @@ -633,8 +633,8 @@ Proof. unfold opp_fct in H7. rewrite <- (Ropp_involutive (f x0)). apply Ropp_eq_0_compat; assumption. - unfold opp_fct in |- *; apply Ropp_0_gt_lt_contravar; assumption. - unfold opp_fct in |- *. + unfold opp_fct; apply Ropp_0_gt_lt_contravar; assumption. + unfold opp_fct. apply Rplus_lt_reg_r with (f x); rewrite Rplus_opp_r; rewrite Rplus_0_r; assumption. inversion H0. @@ -644,7 +644,7 @@ Proof. exists x. split. split; [ right; reflexivity | assumption ]. - symmetry in |- *; assumption. + symmetry ; assumption. case (total_order_T 0 (f y)); intro. elim s; intro. cut (x < y). @@ -657,7 +657,7 @@ Proof. exists y. split. split; [ assumption | right; reflexivity ]. - symmetry in |- *; assumption. + symmetry ; assumption. cut (0 < f x * f y). intro. elim (Rlt_irrefl _ (Rlt_le_trans _ _ _ H2 H1)). @@ -690,18 +690,18 @@ Proof. elim H5; intros; assumption. unfold f in H6. apply Rminus_diag_uniq_sym; exact H6. - rewrite Rmult_comm; pattern 0 at 2 in |- *; rewrite <- (Rmult_0_r (f 1)). + rewrite Rmult_comm; pattern 0 at 2; rewrite <- (Rmult_0_r (f 1)). apply Rmult_le_compat_l; assumption. - unfold f in |- *. + unfold f. rewrite Rsqr_1. apply Rplus_le_reg_l with y. - rewrite Rplus_0_r; rewrite Rplus_comm; unfold Rminus in |- *; + rewrite Rplus_0_r; rewrite Rplus_comm; unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; left; assumption. exists 1. split. left; apply Rlt_0_1. - rewrite b; symmetry in |- *; apply Rsqr_1. + rewrite b; symmetry ; apply Rsqr_1. cut (0 <= f y). intro. cut (f 0 * f y <= 0). @@ -714,14 +714,14 @@ Proof. elim H5; intros; assumption. unfold f in H6. apply Rminus_diag_uniq_sym; exact H6. - rewrite Rmult_comm; pattern 0 at 2 in |- *; rewrite <- (Rmult_0_r (f y)). + rewrite Rmult_comm; pattern 0 at 2; rewrite <- (Rmult_0_r (f y)). apply Rmult_le_compat_l; assumption. - unfold f in |- *. + unfold f. apply Rplus_le_reg_l with y. - rewrite Rplus_0_r; rewrite Rplus_comm; unfold Rminus in |- *; + rewrite Rplus_0_r; rewrite Rplus_comm; unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r. - pattern y at 1 in |- *; rewrite <- Rmult_1_r. - unfold Rsqr in |- *; apply Rmult_le_compat_l. + pattern y at 1; rewrite <- Rmult_1_r. + unfold Rsqr; apply Rmult_le_compat_l. assumption. left; exact r. replace f with (Rsqr - fct_cte y)%F. @@ -729,8 +729,8 @@ Proof. apply derivable_continuous; apply derivable_Rsqr. apply derivable_continuous; apply derivable_const. reflexivity. - unfold f in |- *; rewrite Rsqr_0. - unfold Rminus in |- *; rewrite Rplus_0_l. + unfold f; rewrite Rsqr_0. + unfold Rminus; rewrite Rplus_0_l. apply Rge_le. apply Ropp_0_le_ge_contravar; assumption. Qed. @@ -749,7 +749,7 @@ Proof. intros. elim p; intros. rewrite H in H0; assumption. - unfold Rsqrt in |- *. + unfold Rsqrt. case (Rsqrt_exists x (cond_nonneg x)). intros. elim p; elim a; intros. @@ -770,7 +770,7 @@ Proof. rewrite <- H. elim p; intros. rewrite H1; reflexivity. - unfold Rsqrt in |- *. + unfold Rsqrt. case (Rsqrt_exists x (cond_nonneg x)). intros. elim p; elim a; intros. diff --git a/theories/Reals/Rtopology.v b/theories/Reals/Rtopology.v index f1142d24..51d0b99e 100644 --- a/theories/Reals/Rtopology.v +++ b/theories/Reals/Rtopology.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -12,7 +12,7 @@ Require Import Ranalysis1. Require Import RList. Require Import Classical_Prop. Require Import Classical_Pred_Type. -Open Local Scope R_scope. +Local Open Scope R_scope. (** * General definitions and propositions *) @@ -30,16 +30,16 @@ Definition interior (D:R -> Prop) (x:R) : Prop := neighbourhood D x. Lemma interior_P1 : forall D:R -> Prop, included (interior D) D. Proof. - intros; unfold included in |- *; unfold interior in |- *; intros; + intros; unfold included; unfold interior; intros; unfold neighbourhood in H; elim H; intros; unfold included in H0; - apply H0; unfold disc in |- *; unfold Rminus in |- *; + apply H0; unfold disc; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply (cond_pos x0). Qed. Lemma interior_P2 : forall D:R -> Prop, open_set D -> included D (interior D). Proof. - intros; unfold open_set in H; unfold included in |- *; intros; - assert (H1 := H _ H0); unfold interior in |- *; apply H1. + intros; unfold open_set in H; unfold included; intros; + assert (H1 := H _ H0); unfold interior; apply H1. Qed. Definition point_adherent (D:R -> Prop) (x:R) : Prop := @@ -49,11 +49,11 @@ Definition adherence (D:R -> Prop) (x:R) : Prop := point_adherent D x. Lemma adherence_P1 : forall D:R -> Prop, included D (adherence D). Proof. - intro; unfold included in |- *; intros; unfold adherence in |- *; - unfold point_adherent in |- *; intros; exists x; - unfold intersection_domain in |- *; split. + intro; unfold included; intros; unfold adherence; + unfold point_adherent; intros; exists x; + unfold intersection_domain; split. unfold neighbourhood in H0; elim H0; intros; unfold included in H1; apply H1; - unfold disc in |- *; unfold Rminus in |- *; rewrite Rplus_opp_r; + unfold disc; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply (cond_pos x0). apply H. Qed. @@ -62,29 +62,29 @@ Lemma included_trans : forall D1 D2 D3:R -> Prop, included D1 D2 -> included D2 D3 -> included D1 D3. Proof. - unfold included in |- *; intros; apply H0; apply H; apply H1. + unfold included; intros; apply H0; apply H; apply H1. Qed. Lemma interior_P3 : forall D:R -> Prop, open_set (interior D). Proof. - intro; unfold open_set, interior in |- *; unfold neighbourhood in |- *; + intro; unfold open_set, interior; unfold neighbourhood; intros; elim H; intros. - exists x0; unfold included in |- *; intros. + exists x0; unfold included; intros. set (del := x0 - Rabs (x - x1)). cut (0 < del). intro; exists (mkposreal del H2); intros. cut (included (disc x1 (mkposreal del H2)) (disc x x0)). intro; assert (H5 := included_trans _ _ _ H4 H0). apply H5; apply H3. - unfold included in |- *; unfold disc in |- *; intros. + unfold included; unfold disc; intros. apply Rle_lt_trans with (Rabs (x3 - x1) + Rabs (x1 - x)). replace (x3 - x) with (x3 - x1 + (x1 - x)); [ apply Rabs_triang | ring ]. replace (pos x0) with (del + Rabs (x1 - x)). do 2 rewrite <- (Rplus_comm (Rabs (x1 - x))); apply Rplus_lt_compat_l; apply H4. - unfold del in |- *; rewrite <- (Rabs_Ropp (x - x1)); rewrite Ropp_minus_distr; + unfold del; rewrite <- (Rabs_Ropp (x - x1)); rewrite Ropp_minus_distr; ring. - unfold del in |- *; apply Rplus_lt_reg_r with (Rabs (x - x1)); + unfold del; apply Rplus_lt_reg_r with (Rabs (x - x1)); rewrite Rplus_0_r; replace (Rabs (x - x1) + (x0 - Rabs (x - x1))) with (pos x0); [ idtac | ring ]. @@ -95,7 +95,7 @@ Lemma complementary_P1 : forall D:R -> Prop, ~ (exists y : R, intersection_domain D (complementary D) y). Proof. - intro; red in |- *; intro; elim H; intros; + intro; red; intro; elim H; intros; unfold intersection_domain, complementary in H0; elim H0; intros; elim H2; assumption. Qed. @@ -103,8 +103,8 @@ Qed. Lemma adherence_P2 : forall D:R -> Prop, closed_set D -> included (adherence D) D. Proof. - unfold closed_set in |- *; unfold open_set, complementary in |- *; intros; - unfold included, adherence in |- *; intros; assert (H1 := classic (D x)); + unfold closed_set; unfold open_set, complementary; intros; + unfold included, adherence; intros; assert (H1 := classic (D x)); elim H1; intro. assumption. assert (H3 := H _ H2); assert (H4 := H0 _ H3); elim H4; intros; @@ -114,8 +114,8 @@ Qed. Lemma adherence_P3 : forall D:R -> Prop, closed_set (adherence D). Proof. - intro; unfold closed_set, adherence in |- *; - unfold open_set, complementary, point_adherent in |- *; + intro; unfold closed_set, adherence; + unfold open_set, complementary, point_adherent; intros; set (P := @@ -123,21 +123,21 @@ Proof. neighbourhood V x -> exists y : R, intersection_domain V D y); assert (H0 := not_all_ex_not _ P H); elim H0; intros V0 H1; unfold P in H1; assert (H2 := imply_to_and _ _ H1); - unfold neighbourhood in |- *; elim H2; intros; unfold neighbourhood in H3; - elim H3; intros; exists x0; unfold included in |- *; - intros; red in |- *; intro. + unfold neighbourhood; elim H2; intros; unfold neighbourhood in H3; + elim H3; intros; exists x0; unfold included; + intros; red; intro. assert (H8 := H7 V0); cut (exists delta : posreal, (forall x:R, disc x1 delta x -> V0 x)). intro; assert (H10 := H8 H9); elim H4; assumption. cut (0 < x0 - Rabs (x - x1)). intro; set (del := mkposreal _ H9); exists del; intros; - unfold included in H5; apply H5; unfold disc in |- *; + unfold included in H5; apply H5; unfold disc; apply Rle_lt_trans with (Rabs (x2 - x1) + Rabs (x1 - x)). replace (x2 - x) with (x2 - x1 + (x1 - x)); [ apply Rabs_triang | ring ]. replace (pos x0) with (del + Rabs (x1 - x)). do 2 rewrite <- (Rplus_comm (Rabs (x1 - x))); apply Rplus_lt_compat_l; apply H10. - unfold del in |- *; simpl in |- *; rewrite <- (Rabs_Ropp (x - x1)); + unfold del; simpl; rewrite <- (Rabs_Ropp (x - x1)); rewrite Ropp_minus_distr; ring. apply Rplus_lt_reg_r with (Rabs (x - x1)); rewrite Rplus_0_r; replace (Rabs (x - x1) + (x0 - Rabs (x - x1))) with (pos x0); @@ -152,10 +152,10 @@ Infix "=_D" := eq_Dom (at level 70, no associativity). Lemma open_set_P1 : forall D:R -> Prop, open_set D <-> D =_D interior D. Proof. intro; split. - intro; unfold eq_Dom in |- *; split. + intro; unfold eq_Dom; split. apply interior_P2; assumption. apply interior_P1. - intro; unfold eq_Dom in H; elim H; clear H; intros; unfold open_set in |- *; + intro; unfold eq_Dom in H; elim H; clear H; intros; unfold open_set; intros; unfold included, interior in H; unfold included in H0; apply (H _ H1). Qed. @@ -163,20 +163,20 @@ Qed. Lemma closed_set_P1 : forall D:R -> Prop, closed_set D <-> D =_D adherence D. Proof. intro; split. - intro; unfold eq_Dom in |- *; split. + intro; unfold eq_Dom; split. apply adherence_P1. apply adherence_P2; assumption. - unfold eq_Dom in |- *; unfold included in |- *; intros; + unfold eq_Dom; unfold included; intros; assert (H0 := adherence_P3 D); unfold closed_set in H0; - unfold closed_set in |- *; unfold open_set in |- *; + unfold closed_set; unfold open_set; unfold open_set in H0; intros; assert (H2 : complementary (adherence D) x). - unfold complementary in |- *; unfold complementary in H1; red in |- *; intro; + unfold complementary; unfold complementary in H1; red; intro; elim H; clear H; intros _ H; elim H1; apply (H _ H2). - assert (H3 := H0 _ H2); unfold neighbourhood in |- *; + assert (H3 := H0 _ H2); unfold neighbourhood; unfold neighbourhood in H3; elim H3; intros; exists x0; - unfold included in |- *; unfold included in H4; intros; + unfold included; unfold included in H4; intros; assert (H6 := H4 _ H5); unfold complementary in H6; - unfold complementary in |- *; red in |- *; intro; + unfold complementary; red; intro; elim H; clear H; intros H _; elim H6; apply (H _ H7). Qed. @@ -184,8 +184,8 @@ Lemma neighbourhood_P1 : forall (D1 D2:R -> Prop) (x:R), included D1 D2 -> neighbourhood D1 x -> neighbourhood D2 x. Proof. - unfold included, neighbourhood in |- *; intros; elim H0; intros; exists x0; - intros; unfold included in |- *; unfold included in H1; + unfold included, neighbourhood; intros; elim H0; intros; exists x0; + intros; unfold included; unfold included in H1; intros; apply (H _ (H1 _ H2)). Qed. @@ -193,12 +193,12 @@ Lemma open_set_P2 : forall D1 D2:R -> Prop, open_set D1 -> open_set D2 -> open_set (union_domain D1 D2). Proof. - unfold open_set in |- *; intros; unfold union_domain in H1; elim H1; intro. + unfold open_set; intros; unfold union_domain in H1; elim H1; intro. apply neighbourhood_P1 with D1. - unfold included, union_domain in |- *; tauto. + unfold included, union_domain; tauto. apply H; assumption. apply neighbourhood_P1 with D2. - unfold included, union_domain in |- *; tauto. + unfold included, union_domain; tauto. apply H0; assumption. Qed. @@ -206,53 +206,53 @@ Lemma open_set_P3 : forall D1 D2:R -> Prop, open_set D1 -> open_set D2 -> open_set (intersection_domain D1 D2). Proof. - unfold open_set in |- *; intros; unfold intersection_domain in H1; elim H1; + unfold open_set; intros; unfold intersection_domain in H1; elim H1; intros. assert (H4 := H _ H2); assert (H5 := H0 _ H3); - unfold intersection_domain in |- *; unfold neighbourhood in H4, H5; + unfold intersection_domain; unfold neighbourhood in H4, H5; elim H4; clear H; intros del1 H; elim H5; clear H0; intros del2 H0; cut (0 < Rmin del1 del2). intro; set (del := mkposreal _ H6). - exists del; unfold included in |- *; intros; unfold included in H, H0; + exists del; unfold included; intros; unfold included in H, H0; unfold disc in H, H0, H7. split. apply H; apply Rlt_le_trans with (pos del). apply H7. - unfold del in |- *; simpl in |- *; apply Rmin_l. + unfold del; simpl; apply Rmin_l. apply H0; apply Rlt_le_trans with (pos del). apply H7. - unfold del in |- *; simpl in |- *; apply Rmin_r. - unfold Rmin in |- *; case (Rle_dec del1 del2); intro. + unfold del; simpl; apply Rmin_r. + unfold Rmin; case (Rle_dec del1 del2); intro. apply (cond_pos del1). apply (cond_pos del2). Qed. Lemma open_set_P4 : open_set (fun x:R => False). Proof. - unfold open_set in |- *; intros; elim H. + unfold open_set; intros; elim H. Qed. Lemma open_set_P5 : open_set (fun x:R => True). Proof. - unfold open_set in |- *; intros; unfold neighbourhood in |- *. - exists (mkposreal 1 Rlt_0_1); unfold included in |- *; intros; trivial. + unfold open_set; intros; unfold neighbourhood. + exists (mkposreal 1 Rlt_0_1); unfold included; intros; trivial. Qed. Lemma disc_P1 : forall (x:R) (del:posreal), open_set (disc x del). Proof. intros; assert (H := open_set_P1 (disc x del)). elim H; intros; apply H1. - unfold eq_Dom in |- *; split. - unfold included, interior, disc in |- *; intros; + unfold eq_Dom; split. + unfold included, interior, disc; intros; cut (0 < del - Rabs (x - x0)). intro; set (del2 := mkposreal _ H3). - exists del2; unfold included in |- *; intros. + exists del2; unfold included; intros. apply Rle_lt_trans with (Rabs (x1 - x0) + Rabs (x0 - x)). replace (x1 - x) with (x1 - x0 + (x0 - x)); [ apply Rabs_triang | ring ]. replace (pos del) with (del2 + Rabs (x0 - x)). do 2 rewrite <- (Rplus_comm (Rabs (x0 - x))); apply Rplus_lt_compat_l. apply H4. - unfold del2 in |- *; simpl in |- *; rewrite <- (Rabs_Ropp (x - x0)); + unfold del2; simpl; rewrite <- (Rabs_Ropp (x - x0)); rewrite Ropp_minus_distr; ring. apply Rplus_lt_reg_r with (Rabs (x - x0)); rewrite Rplus_0_r; replace (Rabs (x - x0) + (del - Rabs (x - x0))) with (pos del); @@ -278,19 +278,19 @@ Proof. elim H3; intros. exists (disc x (mkposreal del2 H4)). intros; unfold included in H1; split. - unfold neighbourhood, disc in |- *. + unfold neighbourhood, disc. exists (mkposreal del2 H4). - unfold included in |- *; intros; assumption. - intros; apply H1; unfold disc in |- *; case (Req_dec y x); intro. - rewrite H7; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + unfold included; intros; assumption. + intros; apply H1; unfold disc; case (Req_dec y x); intro. + rewrite H7; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply (cond_pos del1). apply H5; split. - unfold D_x, no_cond in |- *; split. + unfold D_x, no_cond; split. trivial. - apply (sym_not_eq (A:=R)); apply H7. + apply (not_eq_sym (A:=R)); apply H7. unfold disc in H6; apply H6. - intros; unfold continuity_pt in |- *; unfold continue_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; + intros; unfold continuity_pt; unfold continue_in; + unfold limit1_in; unfold limit_in; intros. assert (H1 := H (disc (f x) (mkposreal eps H0))). cut (neighbourhood (disc (f x) (mkposreal eps H0)) (f x)). @@ -299,10 +299,10 @@ Proof. intros del1 H7. exists (pos del1); split. apply (cond_pos del1). - intros; elim H8; intros; simpl in H10; unfold R_dist in H10; simpl in |- *; - unfold R_dist in |- *; apply (H6 _ (H7 _ H10)). - unfold neighbourhood, disc in |- *; exists (mkposreal eps H0); - unfold included in |- *; intros; assumption. + intros; elim H8; intros; simpl in H10; unfold R_dist in H10; simpl; + unfold R_dist; apply (H6 _ (H7 _ H10)). + unfold neighbourhood, disc; exists (mkposreal eps H0); + unfold included; intros; assumption. Qed. Definition image_rec (f:R -> R) (D:R -> Prop) (x:R) : Prop := D (f x). @@ -312,13 +312,13 @@ Lemma continuity_P2 : forall (f:R -> R) (D:R -> Prop), continuity f -> open_set D -> open_set (image_rec f D). Proof. - intros; unfold open_set in H0; unfold open_set in |- *; intros; + intros; unfold open_set in H0; unfold open_set; intros; assert (H2 := continuity_P1 f x); elim H2; intros H3 _; - assert (H4 := H3 (H x)); unfold neighbourhood, image_rec in |- *; + assert (H4 := H3 (H x)); unfold neighbourhood, image_rec; unfold image_rec in H1; assert (H5 := H4 D (H0 (f x) H1)); elim H5; intros V0 H6; elim H6; intros; unfold neighbourhood in H7; elim H7; intros del H9; exists del; unfold included in H9; - unfold included in |- *; intros; apply (H8 _ (H9 _ H10)). + unfold included; intros; apply (H8 _ (H9 _ H10)). Qed. (**********) @@ -329,9 +329,9 @@ Lemma continuity_P3 : Proof. intros; split. intros; apply continuity_P2; assumption. - intros; unfold continuity in |- *; unfold continuity_pt in |- *; - unfold continue_in in |- *; unfold limit1_in in |- *; - unfold limit_in in |- *; simpl in |- *; unfold R_dist in |- *; + intros; unfold continuity; unfold continuity_pt; + unfold continue_in; unfold limit1_in; + unfold limit_in; simpl; unfold R_dist; intros; cut (open_set (disc (f x) (mkposreal _ H0))). intro; assert (H2 := H _ H1). unfold open_set, image_rec in H2; cut (disc (f x) (mkposreal _ H0) (f x)). @@ -340,7 +340,7 @@ Proof. exists (pos del); split. apply (cond_pos del). intros; unfold included in H5; apply H5; elim H6; intros; apply H8. - unfold disc in |- *; unfold Rminus in |- *; rewrite Rplus_opp_r; + unfold disc; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply H0. apply disc_P1. Qed. @@ -358,23 +358,23 @@ Proof. cut (0 < D / 2). intro; exists (disc x (mkposreal _ H)). exists (disc y (mkposreal _ H)); split. - unfold neighbourhood in |- *; exists (mkposreal _ H); unfold included in |- *; + unfold neighbourhood; exists (mkposreal _ H); unfold included; tauto. split. - unfold neighbourhood in |- *; exists (mkposreal _ H); unfold included in |- *; + unfold neighbourhood; exists (mkposreal _ H); unfold included; tauto. - red in |- *; intro; elim H0; intros; unfold intersection_domain in H1; + red; intro; elim H0; intros; unfold intersection_domain in H1; elim H1; intros. cut (D < D). intro; elim (Rlt_irrefl _ H4). - change (Rabs (x - y) < D) in |- *; + change (Rabs (x - y) < D); apply Rle_lt_trans with (Rabs (x - x0) + Rabs (x0 - y)). replace (x - y) with (x - x0 + (x0 - y)); [ apply Rabs_triang | ring ]. rewrite (double_var D); apply Rplus_lt_compat. rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; apply H2. apply H3. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. - unfold D in |- *; apply Rabs_pos_lt; apply (Rminus_eq_contra _ _ Hsep). + unfold Rdiv; apply Rmult_lt_0_compat. + unfold D; apply Rabs_pos_lt; apply (Rminus_eq_contra _ _ Hsep). apply Rinv_0_lt_compat; prove_sup0. Qed. @@ -404,7 +404,7 @@ Lemma restriction_family : (exists y : R, (fun z1 z2:R => f z1 z2 /\ D z1) x y) -> intersection_domain (ind f) D x. Proof. - intros; elim H; intros; unfold intersection_domain in |- *; elim H0; intros; + intros; elim H; intros; unfold intersection_domain; elim H0; intros; split. apply (cond_fam f0); exists x0; assumption. assumption. @@ -424,19 +424,19 @@ Lemma family_P1 : forall (f:family) (D:R -> Prop), family_open_set f -> family_open_set (subfamily f D). Proof. - unfold family_open_set in |- *; intros; unfold subfamily in |- *; - simpl in |- *; assert (H0 := classic (D x)). + unfold family_open_set; intros; unfold subfamily; + simpl; assert (H0 := classic (D x)). elim H0; intro. cut (open_set (f0 x) -> open_set (fun y:R => f0 x y /\ D x)). intro; apply H2; apply H. - unfold open_set in |- *; unfold neighbourhood in |- *; intros; elim H3; + unfold open_set; unfold neighbourhood; intros; elim H3; intros; assert (H6 := H2 _ H4); elim H6; intros; exists x1; - unfold included in |- *; intros; split. + unfold included; intros; split. apply (H7 _ H8). assumption. cut (open_set (fun y:R => False) -> open_set (fun y:R => f0 x y /\ D x)). intro; apply H2; apply open_set_P4. - unfold open_set in |- *; unfold neighbourhood in |- *; intros; elim H3; + unfold open_set; unfold neighbourhood; intros; elim H3; intros; elim H1; assumption. Qed. @@ -446,7 +446,7 @@ Definition bounded (D:R -> Prop) : Prop := Lemma open_set_P6 : forall D1 D2:R -> Prop, open_set D1 -> D1 =_D D2 -> open_set D2. Proof. - unfold open_set in |- *; unfold neighbourhood in |- *; intros. + unfold open_set; unfold neighbourhood; intros. unfold eq_Dom in H0; elim H0; intros. assert (H4 := H _ (H3 _ H1)). elim H4; intros. @@ -465,7 +465,7 @@ Proof. intro; assert (H3 := H1 H2); elim H3; intros D' H4; unfold covering_finite in H4; elim H4; intros; unfold family_finite in H6; unfold domain_finite in H6; elim H6; intros l H7; - unfold bounded in |- *; set (r := MaxRlist l). + unfold bounded; set (r := MaxRlist l). exists (- r); exists r; intros. unfold covering in H5; assert (H9 := H5 _ H8); elim H9; intros; unfold subfamily in H10; simpl in H10; elim H10; intros; @@ -484,25 +484,25 @@ Proof. left; apply H11. assumption. apply (MaxRlist_P1 l x0 H16). - unfold intersection_domain, D in |- *; tauto. - unfold covering_open_set in |- *; split. - unfold covering in |- *; intros; simpl in |- *; exists (Rabs x + 1); - unfold g in |- *; pattern (Rabs x) at 1 in |- *; rewrite <- Rplus_0_r; + unfold intersection_domain, D; tauto. + unfold covering_open_set; split. + unfold covering; intros; simpl; exists (Rabs x + 1); + unfold g; pattern (Rabs x) at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; apply Rlt_0_1. - unfold family_open_set in |- *; intro; case (Rtotal_order 0 x); intro. + unfold family_open_set; intro; case (Rtotal_order 0 x); intro. apply open_set_P6 with (disc 0 (mkposreal _ H2)). apply disc_P1. - unfold eq_Dom in |- *; unfold f0 in |- *; simpl in |- *; - unfold g, disc in |- *; split. - unfold included in |- *; intros; unfold Rminus in H3; rewrite Ropp_0 in H3; + unfold eq_Dom; unfold f0; simpl; + unfold g, disc; split. + unfold included; intros; unfold Rminus in H3; rewrite Ropp_0 in H3; rewrite Rplus_0_r in H3; apply H3. - unfold included in |- *; intros; unfold Rminus in |- *; rewrite Ropp_0; + unfold included; intros; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply H3. apply open_set_P6 with (fun x:R => False). apply open_set_P4. - unfold eq_Dom in |- *; split. - unfold included in |- *; intros; elim H3. - unfold included, f0 in |- *; simpl in |- *; unfold g in |- *; intros; elim H2; + unfold eq_Dom; split. + unfold included; intros; elim H3. + unfold included, f0; simpl; unfold g; intros; elim H2; intro; [ rewrite <- H4 in H3; assert (H5 := Rabs_pos x0); elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H5 H3)) @@ -515,10 +515,10 @@ Lemma compact_P2 : forall X:R -> Prop, compact X -> closed_set X. Proof. intros; assert (H0 := closed_set_P1 X); elim H0; clear H0; intros _ H0; apply H0; clear H0. - unfold eq_Dom in |- *; split. + unfold eq_Dom; split. apply adherence_P1. - unfold included in |- *; unfold adherence in |- *; - unfold point_adherent in |- *; intros; unfold compact in H; + unfold included; unfold adherence; + unfold point_adherent; intros; unfold compact in H; assert (H1 := classic (X x)); elim H1; clear H1; intro. assumption. cut (forall y:R, X y -> 0 < Rabs (y - x) / 2). @@ -548,44 +548,44 @@ Proof. replace (y0 - x) with (y0 - y + (y - x)); [ apply Rabs_triang | ring ]. rewrite (double_var (Rabs (y0 - x))); apply Rplus_lt_compat; assumption. apply (MinRlist_P1 (AbsList l x) (Rabs (y0 - x) / 2)); apply AbsList_P1; - elim (H8 y0); clear H8; intros; apply H8; unfold intersection_domain in |- *; + elim (H8 y0); clear H8; intros; apply H8; unfold intersection_domain; split; assumption. assert (H11 := disc_P1 x (mkposreal alp H9)); unfold open_set in H11; apply H11. - unfold disc in |- *; unfold Rminus in |- *; rewrite Rplus_opp_r; + unfold disc; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply H9. - unfold alp in |- *; apply MinRlist_P2; intros; + unfold alp; apply MinRlist_P2; intros; assert (H10 := AbsList_P2 _ _ _ H9); elim H10; clear H10; intros z H10; elim H10; clear H10; intros; rewrite H11; apply H2; elim (H8 z); clear H8; intros; assert (H13 := H12 H10); unfold intersection_domain, D in H13; elim H13; clear H13; intros; assumption. - unfold covering_open_set in |- *; split. - unfold covering in |- *; intros; exists x0; simpl in |- *; unfold g in |- *; + unfold covering_open_set; split. + unfold covering; intros; exists x0; simpl; unfold g; split. - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; unfold Rminus in H2; apply (H2 _ H5). apply H5. - unfold family_open_set in |- *; intro; simpl in |- *; unfold g in |- *; + unfold family_open_set; intro; simpl; unfold g; elim (classic (D x0)); intro. apply open_set_P6 with (disc x0 (mkposreal _ (H2 _ H5))). apply disc_P1. - unfold eq_Dom in |- *; split. - unfold included, disc in |- *; simpl in |- *; intros; split. + unfold eq_Dom; split. + unfold included, disc; simpl; intros; split. rewrite <- (Rabs_Ropp (x0 - x1)); rewrite Ropp_minus_distr; apply H6. apply H5. - unfold included, disc in |- *; simpl in |- *; intros; elim H6; intros; + unfold included, disc; simpl; intros; elim H6; intros; rewrite <- (Rabs_Ropp (x1 - x0)); rewrite Ropp_minus_distr; apply H7. apply open_set_P6 with (fun z:R => False). apply open_set_P4. - unfold eq_Dom in |- *; split. - unfold included in |- *; intros; elim H6. - unfold included in |- *; intros; elim H6; intros; elim H5; assumption. + unfold eq_Dom; split. + unfold included; intros; elim H6. + unfold included; intros; elim H6; intros; elim H5; assumption. intros; elim H3; intros; unfold g in H4; elim H4; clear H4; intros _ H4; apply H4. - intros; unfold Rdiv in |- *; apply Rmult_lt_0_compat. - apply Rabs_pos_lt; apply Rminus_eq_contra; red in |- *; intro; + intros; unfold Rdiv; apply Rmult_lt_0_compat. + apply Rabs_pos_lt; apply Rminus_eq_contra; red; intro; rewrite H3 in H2; elim H1; apply H2. apply Rinv_0_lt_compat; prove_sup0. Qed. @@ -593,29 +593,29 @@ Qed. (**********) Lemma compact_EMP : compact (fun _:R => False). Proof. - unfold compact in |- *; intros; exists (fun x:R => False); - unfold covering_finite in |- *; split. - unfold covering in |- *; intros; elim H0. - unfold family_finite in |- *; unfold domain_finite in |- *; exists nil; intro. + unfold compact; intros; exists (fun x:R => False); + unfold covering_finite; split. + unfold covering; intros; elim H0. + unfold family_finite; unfold domain_finite; exists nil; intro. split. - simpl in |- *; unfold intersection_domain in |- *; intros; elim H0. + simpl; unfold intersection_domain; intros; elim H0. elim H0; clear H0; intros _ H0; elim H0. - simpl in |- *; intro; elim H0. + simpl; intro; elim H0. Qed. Lemma compact_eqDom : forall X1 X2:R -> Prop, compact X1 -> X1 =_D X2 -> compact X2. Proof. - unfold compact in |- *; intros; unfold eq_Dom in H0; elim H0; clear H0; - unfold included in |- *; intros; assert (H3 : covering_open_set X1 f0). - unfold covering_open_set in |- *; unfold covering_open_set in H1; elim H1; + unfold compact; intros; unfold eq_Dom in H0; elim H0; clear H0; + unfold included; intros; assert (H3 : covering_open_set X1 f0). + unfold covering_open_set; unfold covering_open_set in H1; elim H1; clear H1; intros; split. - unfold covering in H1; unfold covering in |- *; intros; + unfold covering in H1; unfold covering; intros; apply (H1 _ (H0 _ H4)). apply H3. - elim (H _ H3); intros D H4; exists D; unfold covering_finite in |- *; + elim (H _ H3); intros D H4; exists D; unfold covering_finite; unfold covering_finite in H4; elim H4; intros; split. - unfold covering in H5; unfold covering in |- *; intros; + unfold covering in H5; unfold covering; intros; apply (H5 _ (H2 _ H7)). apply H6. Qed. @@ -624,7 +624,7 @@ Qed. Lemma compact_P3 : forall a b:R, compact (fun c:R => a <= c <= b). Proof. intros; case (Rle_dec a b); intro. - unfold compact in |- *; intros; + unfold compact; intros; set (A := fun x:R => @@ -647,92 +647,92 @@ Proof. rewrite H11 in H10; rewrite H11 in H8; unfold A in H9; elim H9; clear H9; intros; elim H12; clear H12; intros Dx H12; set (Db := fun x:R => Dx x \/ x = y0); exists Db; - unfold covering_finite in |- *; split. - unfold covering in |- *; unfold covering_finite in H12; elim H12; clear H12; + unfold covering_finite; split. + unfold covering; unfold covering_finite in H12; elim H12; clear H12; intros; unfold covering in H12; case (Rle_dec x0 x); intro. cut (a <= x0 <= x). intro; assert (H16 := H12 x0 H15); elim H16; clear H16; intros; exists x1; - simpl in H16; simpl in |- *; unfold Db in |- *; elim H16; + simpl in H16; simpl; unfold Db; elim H16; clear H16; intros; split; [ apply H16 | left; apply H17 ]. split. elim H14; intros; assumption. assumption. - exists y0; simpl in |- *; split. - apply H8; unfold disc in |- *; rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; + exists y0; simpl; split. + apply H8; unfold disc; rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; rewrite Rabs_right. apply Rlt_trans with (b - x). - unfold Rminus in |- *; apply Rplus_lt_compat_l; apply Ropp_lt_gt_contravar; + unfold Rminus; apply Rplus_lt_compat_l; apply Ropp_lt_gt_contravar; auto with real. elim H10; intros H15 _; apply Rplus_lt_reg_r with (x - eps); replace (x - eps + (b - x)) with (b - eps); [ replace (x - eps + eps) with x; [ apply H15 | ring ] | ring ]. apply Rge_minus; apply Rle_ge; elim H14; intros _ H15; apply H15. - unfold Db in |- *; right; reflexivity. - unfold family_finite in |- *; unfold domain_finite in |- *; + unfold Db; right; reflexivity. + unfold family_finite; unfold domain_finite; unfold covering_finite in H12; elim H12; clear H12; intros; unfold family_finite in H13; unfold domain_finite in H13; elim H13; clear H13; intros l H13; exists (cons y0 l); intro; split. intro; simpl in H14; unfold intersection_domain in H14; elim (H13 x0); clear H13; intros; case (Req_dec x0 y0); intro. - simpl in |- *; left; apply H16. - simpl in |- *; right; apply H13. - simpl in |- *; unfold intersection_domain in |- *; unfold Db in H14; + simpl; left; apply H16. + simpl; right; apply H13. + simpl; unfold intersection_domain; unfold Db in H14; decompose [and or] H14. split; assumption. elim H16; assumption. - intro; simpl in H14; elim H14; intro; simpl in |- *; - unfold intersection_domain in |- *. + intro; simpl in H14; elim H14; intro; simpl; + unfold intersection_domain. split. apply (cond_fam f0); rewrite H15; exists m; apply H6. - unfold Db in |- *; right; assumption. - simpl in |- *; unfold intersection_domain in |- *; elim (H13 x0). + unfold Db; right; assumption. + simpl; unfold intersection_domain; elim (H13 x0). intros _ H16; assert (H17 := H16 H15); simpl in H17; unfold intersection_domain in H17; split. elim H17; intros; assumption. - unfold Db in |- *; left; elim H17; intros; assumption. + unfold Db; left; elim H17; intros; assumption. set (m' := Rmin (m + eps / 2) b); cut (A m'). intro; elim H3; intros; unfold is_upper_bound in H13; assert (H15 := H13 m' H12); cut (m < m'). intro; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H15 H16)). - unfold m' in |- *; unfold Rmin in |- *; case (Rle_dec (m + eps / 2) b); intro. - pattern m at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold m'; unfold Rmin; case (Rle_dec (m + eps / 2) b); intro. + pattern m at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos eps) | apply Rinv_0_lt_compat; prove_sup0 ]. elim H4; intros. elim H17; intro. assumption. elim H11; assumption. - unfold A in |- *; split. + unfold A; split. split. apply Rle_trans with m. elim H4; intros; assumption. - unfold m' in |- *; unfold Rmin in |- *; case (Rle_dec (m + eps / 2) b); intro. - pattern m at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold m'; unfold Rmin; case (Rle_dec (m + eps / 2) b); intro. + pattern m at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos eps) | apply Rinv_0_lt_compat; prove_sup0 ]. elim H4; intros. elim H13; intro. assumption. elim H11; assumption. - unfold m' in |- *; apply Rmin_r. + unfold m'; apply Rmin_r. unfold A in H9; elim H9; clear H9; intros; elim H12; clear H12; intros Dx H12; set (Db := fun x:R => Dx x \/ x = y0); exists Db; - unfold covering_finite in |- *; split. - unfold covering in |- *; unfold covering_finite in H12; elim H12; clear H12; + unfold covering_finite; split. + unfold covering; unfold covering_finite in H12; elim H12; clear H12; intros; unfold covering in H12; case (Rle_dec x0 x); intro. cut (a <= x0 <= x). intro; assert (H16 := H12 x0 H15); elim H16; clear H16; intros; exists x1; - simpl in H16; simpl in |- *; unfold Db in |- *. + simpl in H16; simpl; unfold Db. elim H16; clear H16; intros; split; [ apply H16 | left; apply H17 ]. elim H14; intros; split; assumption. - exists y0; simpl in |- *; split. - apply H8; unfold disc in |- *; unfold Rabs in |- *; case (Rcase_abs (x0 - m)); + exists y0; simpl; split. + apply H8; unfold disc; unfold Rabs; case (Rcase_abs (x0 - m)); intro. rewrite Ropp_minus_distr; apply Rlt_trans with (m - x). - unfold Rminus in |- *; apply Rplus_lt_compat_l; apply Ropp_lt_gt_contravar; + unfold Rminus; apply Rplus_lt_compat_l; apply Ropp_lt_gt_contravar; auto with real. apply Rplus_lt_reg_r with (x - eps); replace (x - eps + (m - x)) with (m - eps). @@ -741,56 +741,56 @@ Proof. ring. ring. apply Rle_lt_trans with (m' - m). - unfold Rminus in |- *; do 2 rewrite <- (Rplus_comm (- m)); + unfold Rminus; do 2 rewrite <- (Rplus_comm (- m)); apply Rplus_le_compat_l; elim H14; intros; assumption. apply Rplus_lt_reg_r with m; replace (m + (m' - m)) with m'. apply Rle_lt_trans with (m + eps / 2). - unfold m' in |- *; apply Rmin_l. + unfold m'; apply Rmin_l. apply Rplus_lt_compat_l; apply Rmult_lt_reg_l with 2. prove_sup0. - unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; + unfold Rdiv; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. - rewrite Rmult_1_l; pattern (pos eps) at 1 in |- *; rewrite <- Rplus_0_r; + rewrite Rmult_1_l; pattern (pos eps) at 1; rewrite <- Rplus_0_r; rewrite double; apply Rplus_lt_compat_l; apply (cond_pos eps). discrR. ring. - unfold Db in |- *; right; reflexivity. - unfold family_finite in |- *; unfold domain_finite in |- *; + unfold Db; right; reflexivity. + unfold family_finite; unfold domain_finite; unfold covering_finite in H12; elim H12; clear H12; intros; unfold family_finite in H13; unfold domain_finite in H13; elim H13; clear H13; intros l H13; exists (cons y0 l); intro; split. intro; simpl in H14; unfold intersection_domain in H14; elim (H13 x0); clear H13; intros; case (Req_dec x0 y0); intro. - simpl in |- *; left; apply H16. - simpl in |- *; right; apply H13; simpl in |- *; - unfold intersection_domain in |- *; unfold Db in H14; + simpl; left; apply H16. + simpl; right; apply H13; simpl; + unfold intersection_domain; unfold Db in H14; decompose [and or] H14. split; assumption. elim H16; assumption. - intro; simpl in H14; elim H14; intro; simpl in |- *; - unfold intersection_domain in |- *. + intro; simpl in H14; elim H14; intro; simpl; + unfold intersection_domain. split. apply (cond_fam f0); rewrite H15; exists m; apply H6. - unfold Db in |- *; right; assumption. + unfold Db; right; assumption. elim (H13 x0); intros _ H16. assert (H17 := H16 H15). simpl in H17. unfold intersection_domain in H17. split. elim H17; intros; assumption. - unfold Db in |- *; left; elim H17; intros; assumption. + unfold Db; left; elim H17; intros; assumption. elim (classic (exists x : R, A x /\ m - eps < x <= m)); intro. assumption. elim H3; intros; cut (is_upper_bound A (m - eps)). intro; assert (H13 := H11 _ H12); cut (m - eps < m). intro; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H13 H14)). - pattern m at 2 in |- *; rewrite <- Rplus_0_r; unfold Rminus in |- *; + pattern m at 2; rewrite <- Rplus_0_r; unfold Rminus; apply Rplus_lt_compat_l; apply Ropp_lt_cancel; rewrite Ropp_involutive; rewrite Ropp_0; apply (cond_pos eps). set (P := fun n:R => A n /\ m - eps < n <= m); assert (H12 := not_ex_all_not _ P H9); unfold P in H12; - unfold is_upper_bound in |- *; intros; + unfold is_upper_bound; intros; assert (H14 := not_and_or _ _ (H12 x)); elim H14; intro. elim H15; apply H13. @@ -803,44 +803,44 @@ Proof. unfold is_upper_bound in H3. split. apply (H3 _ H0). - apply (H4 b); unfold is_upper_bound in |- *; intros; unfold A in H5; elim H5; + apply (H4 b); unfold is_upper_bound; intros; unfold A in H5; elim H5; clear H5; intros H5 _; elim H5; clear H5; intros _ H5; apply H5. exists a; apply H0. - unfold bound in |- *; exists b; unfold is_upper_bound in |- *; intros; + unfold bound; exists b; unfold is_upper_bound; intros; unfold A in H1; elim H1; clear H1; intros H1 _; elim H1; clear H1; intros _ H1; apply H1. - unfold A in |- *; split. + unfold A; split. split; [ right; reflexivity | apply r ]. unfold covering_open_set in H; elim H; clear H; intros; unfold covering in H; cut (a <= a <= b). intro; elim (H _ H1); intros y0 H2; set (D' := fun x:R => x = y0); exists D'; - unfold covering_finite in |- *; split. - unfold covering in |- *; simpl in |- *; intros; cut (x = a). + unfold covering_finite; split. + unfold covering; simpl; intros; cut (x = a). intro; exists y0; split. rewrite H4; apply H2. - unfold D' in |- *; reflexivity. + unfold D'; reflexivity. elim H3; intros; apply Rle_antisym; assumption. - unfold family_finite in |- *; unfold domain_finite in |- *; + unfold family_finite; unfold domain_finite; exists (cons y0 nil); intro; split. - simpl in |- *; unfold intersection_domain in |- *; intro; elim H3; clear H3; + simpl; unfold intersection_domain; intro; elim H3; clear H3; intros; unfold D' in H4; left; apply H4. - simpl in |- *; unfold intersection_domain in |- *; intro; elim H3; intro. + simpl; unfold intersection_domain; intro; elim H3; intro. split; [ rewrite H4; apply (cond_fam f0); exists a; apply H2 | apply H4 ]. elim H4. split; [ right; reflexivity | apply r ]. apply compact_eqDom with (fun c:R => False). apply compact_EMP. - unfold eq_Dom in |- *; split. - unfold included in |- *; intros; elim H. - unfold included in |- *; intros; elim H; clear H; intros; + unfold eq_Dom; split. + unfold included; intros; elim H. + unfold included; intros; elim H; clear H; intros; assert (H1 := Rle_trans _ _ _ H H0); elim n; apply H1. Qed. Lemma compact_P4 : forall X F:R -> Prop, compact X -> closed_set F -> included F X -> compact F. Proof. - unfold compact in |- *; intros; elim (classic (exists z : R, F z)); + unfold compact; intros; elim (classic (exists z : R, F z)); intro Hyp_F_NE. set (D := ind f0); set (g := f f0); unfold closed_set in H0. set (g' := fun x y:R => f0 x y \/ complementary F y /\ D x). @@ -848,61 +848,61 @@ Proof. cut (forall x:R, (exists y : R, g' x y) -> D' x). intro; set (f' := mkfamily D' g' H3); cut (covering_open_set X f'). intro; elim (H _ H4); intros DX H5; exists DX. - unfold covering_finite in |- *; unfold covering_finite in H5; elim H5; + unfold covering_finite; unfold covering_finite in H5; elim H5; clear H5; intros. split. - unfold covering in |- *; unfold covering in H5; intros. - elim (H5 _ (H1 _ H7)); intros y0 H8; exists y0; simpl in H8; simpl in |- *; + unfold covering; unfold covering in H5; intros. + elim (H5 _ (H1 _ H7)); intros y0 H8; exists y0; simpl in H8; simpl; elim H8; clear H8; intros. split. unfold g' in H8; elim H8; intro. apply H10. elim H10; intros H11 _; unfold complementary in H11; elim H11; apply H7. apply H9. - unfold family_finite in |- *; unfold domain_finite in |- *; + unfold family_finite; unfold domain_finite; unfold family_finite in H6; unfold domain_finite in H6; elim H6; clear H6; intros l H6; exists l; intro; assert (H7 := H6 x); elim H7; clear H7; intros. split. - intro; apply H7; simpl in |- *; unfold intersection_domain in |- *; - simpl in H9; unfold intersection_domain in H9; unfold D' in |- *; + intro; apply H7; simpl; unfold intersection_domain; + simpl in H9; unfold intersection_domain in H9; unfold D'; apply H9. intro; assert (H10 := H8 H9); simpl in H10; unfold intersection_domain in H10; - simpl in |- *; unfold intersection_domain in |- *; + simpl; unfold intersection_domain; unfold D' in H10; apply H10. - unfold covering_open_set in |- *; unfold covering_open_set in H2; elim H2; + unfold covering_open_set; unfold covering_open_set in H2; elim H2; clear H2; intros. split. - unfold covering in |- *; unfold covering in H2; intros. + unfold covering; unfold covering in H2; intros. elim (classic (F x)); intro. - elim (H2 _ H6); intros y0 H7; exists y0; simpl in |- *; unfold g' in |- *; + elim (H2 _ H6); intros y0 H7; exists y0; simpl; unfold g'; left; assumption. cut (exists z : R, D z). - intro; elim H7; clear H7; intros x0 H7; exists x0; simpl in |- *; - unfold g' in |- *; right. + intro; elim H7; clear H7; intros x0 H7; exists x0; simpl; + unfold g'; right. split. - unfold complementary in |- *; apply H6. + unfold complementary; apply H6. apply H7. elim Hyp_F_NE; intros z0 H7. assert (H8 := H2 _ H7). elim H8; clear H8; intros t H8; exists t; apply (cond_fam f0); exists z0; apply H8. - unfold family_open_set in |- *; intro; simpl in |- *; unfold g' in |- *; + unfold family_open_set; intro; simpl; unfold g'; elim (classic (D x)); intro. apply open_set_P6 with (union_domain (f0 x) (complementary F)). apply open_set_P2. unfold family_open_set in H4; apply H4. apply H0. - unfold eq_Dom in |- *; split. - unfold included, union_domain, complementary in |- *; intros. + unfold eq_Dom; split. + unfold included, union_domain, complementary; intros. elim H6; intro; [ left; apply H7 | right; split; assumption ]. - unfold included, union_domain, complementary in |- *; intros. + unfold included, union_domain, complementary; intros. elim H6; intro; [ left; apply H7 | right; elim H7; intros; apply H8 ]. apply open_set_P6 with (f0 x). unfold family_open_set in H4; apply H4. - unfold eq_Dom in |- *; split. - unfold included, complementary in |- *; intros; left; apply H6. - unfold included, complementary in |- *; intros. + unfold eq_Dom; split. + unfold included, complementary; intros; left; apply H6. + unfold included, complementary; intros. elim H6; intro. apply H7. elim H7; intros _ H8; elim H5; apply H8. @@ -914,9 +914,9 @@ Proof. intro; apply (H3 f0 H2). apply compact_eqDom with (fun _:R => False). apply compact_EMP. - unfold eq_Dom in |- *; split. - unfold included in |- *; intros; elim H3. - assert (H3 := not_ex_all_not _ _ Hyp_F_NE); unfold included in |- *; intros; + unfold eq_Dom; split. + unfold included; intros; elim H3. + assert (H3 := not_ex_all_not _ _ Hyp_F_NE); unfold included; intros; elim (H3 x); apply H4. Qed. @@ -947,7 +947,7 @@ Lemma continuity_compact : forall (f:R -> R) (X:R -> Prop), (forall x:R, continuity_pt f x) -> compact X -> compact (image_dir f X). Proof. - unfold compact in |- *; intros; unfold covering_open_set in H1. + unfold compact; intros; unfold covering_open_set in H1. elim H1; clear H1; intros. set (D := ind f1). set (g := fun x y:R => image_rec f0 (f1 x) y). @@ -956,24 +956,24 @@ Proof. cut (covering_open_set X f'). intro; elim (H0 f' H4); intros D' H5; exists D'. unfold covering_finite in H5; elim H5; clear H5; intros; - unfold covering_finite in |- *; split. - unfold covering, image_dir in |- *; simpl in |- *; unfold covering in H5; + unfold covering_finite; split. + unfold covering, image_dir; simpl; unfold covering in H5; intros; elim H7; intros y H8; elim H8; intros; assert (H11 := H5 _ H10); simpl in H11; elim H11; intros z H12; exists z; unfold g in H12; unfold image_rec in H12; rewrite H9; apply H12. unfold family_finite in H6; unfold domain_finite in H6; - unfold family_finite in |- *; unfold domain_finite in |- *; + unfold family_finite; unfold domain_finite; elim H6; intros l H7; exists l; intro; elim (H7 x); intros; split; intro. - apply H8; simpl in H10; simpl in |- *; apply H10. + apply H8; simpl in H10; simpl; apply H10. apply (H9 H10). - unfold covering_open_set in |- *; split. - unfold covering in |- *; intros; simpl in |- *; unfold covering in H1; - unfold image_dir in H1; unfold g in |- *; unfold image_rec in |- *; + unfold covering_open_set; split. + unfold covering; intros; simpl; unfold covering in H1; + unfold image_dir in H1; unfold g; unfold image_rec; apply H1. exists x; split; [ reflexivity | apply H4 ]. - unfold family_open_set in |- *; unfold family_open_set in H2; intro; - simpl in |- *; unfold g in |- *; + unfold family_open_set; unfold family_open_set in H2; intro; + simpl; unfold g; cut ((fun y:R => image_rec f0 (f1 x) y) = image_rec f0 (f1 x)). intro; rewrite H4. apply (continuity_P2 f0 (f1 x) H (H2 x)). @@ -1010,16 +1010,16 @@ Proof. assert (H2 : 0 < b - a). apply Rlt_Rminus; assumption. exists h; split. - unfold continuity in |- *; intro; case (Rtotal_order x a); intro. - unfold continuity_pt in |- *; unfold continue_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold R_dist in |- *; intros; exists (a - x); + unfold continuity; intro; case (Rtotal_order x a); intro. + unfold continuity_pt; unfold continue_in; + unfold limit1_in; unfold limit_in; + simpl; unfold R_dist; intros; exists (a - x); split. - change (0 < a - x) in |- *; apply Rlt_Rminus; assumption. - intros; elim H5; clear H5; intros _ H5; unfold h in |- *. + change (0 < a - x); apply Rlt_Rminus; assumption. + intros; elim H5; clear H5; intros _ H5; unfold h. case (Rle_dec x a); intro. case (Rle_dec x0 a); intro. - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. elim n; left; apply Rplus_lt_reg_r with (- x); do 2 rewrite (Rplus_comm (- x)); apply Rle_lt_trans with (Rabs (x0 - x)). apply RRle_abs. @@ -1030,23 +1030,23 @@ Proof. split; [ right; reflexivity | left; assumption ]. assert (H6 := H0 _ H5); unfold continuity_pt in H6; unfold continue_in in H6; unfold limit1_in in H6; unfold limit_in in H6; simpl in H6; - unfold R_dist in H6; unfold continuity_pt in |- *; - unfold continue_in in |- *; unfold limit1_in in |- *; - unfold limit_in in |- *; simpl in |- *; unfold R_dist in |- *; + unfold R_dist in H6; unfold continuity_pt; + unfold continue_in; unfold limit1_in; + unfold limit_in; simpl; unfold R_dist; intros; elim (H6 _ H7); intros; exists (Rmin x0 (b - a)); split. - unfold Rmin in |- *; case (Rle_dec x0 (b - a)); intro. + unfold Rmin; case (Rle_dec x0 (b - a)); intro. elim H8; intros; assumption. - change (0 < b - a) in |- *; apply Rlt_Rminus; assumption. + change (0 < b - a); apply Rlt_Rminus; assumption. intros; elim H9; clear H9; intros _ H9; cut (x1 < b). - intro; unfold h in |- *; case (Rle_dec x a); intro. + intro; unfold h; case (Rle_dec x a); intro. case (Rle_dec x1 a); intro. - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. case (Rle_dec x1 b); intro. elim H8; intros; apply H12; split. - unfold D_x, no_cond in |- *; split. + unfold D_x, no_cond; split. trivial. - red in |- *; intro; elim n; right; symmetry in |- *; assumption. + red; intro; elim n; right; symmetry ; assumption. apply Rlt_le_trans with (Rmin x0 (b - a)). rewrite H4 in H9; apply H9. apply Rmin_l. @@ -1063,9 +1063,9 @@ Proof. split; left; assumption. assert (H7 := H0 _ H6); unfold continuity_pt in H7; unfold continue_in in H7; unfold limit1_in in H7; unfold limit_in in H7; simpl in H7; - unfold R_dist in H7; unfold continuity_pt in |- *; - unfold continue_in in |- *; unfold limit1_in in |- *; - unfold limit_in in |- *; simpl in |- *; unfold R_dist in |- *; + unfold R_dist in H7; unfold continuity_pt; + unfold continue_in; unfold limit1_in; + unfold limit_in; simpl; unfold R_dist; intros; elim (H7 _ H8); intros; elim H9; clear H9; intros. assert (H11 : 0 < x - a). @@ -1073,7 +1073,7 @@ Proof. assert (H12 : 0 < b - x). apply Rlt_Rminus; assumption. exists (Rmin x0 (Rmin (x - a) (b - x))); split. - unfold Rmin in |- *; case (Rle_dec (x - a) (b - x)); intro. + unfold Rmin; case (Rle_dec (x - a) (b - x)); intro. case (Rle_dec x0 (x - a)); intro. assumption. assumption. @@ -1081,7 +1081,7 @@ Proof. assumption. assumption. intros; elim H13; clear H13; intros; cut (a < x1 < b). - intro; elim H15; clear H15; intros; unfold h in |- *; case (Rle_dec x a); + intro; elim H15; clear H15; intros; unfold h; case (Rle_dec x a); intro. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r H4)). case (Rle_dec x b); intro. @@ -1115,16 +1115,16 @@ Proof. split; [ left; assumption | right; reflexivity ]. assert (H8 := H0 _ H7); unfold continuity_pt in H8; unfold continue_in in H8; unfold limit1_in in H8; unfold limit_in in H8; simpl in H8; - unfold R_dist in H8; unfold continuity_pt in |- *; - unfold continue_in in |- *; unfold limit1_in in |- *; - unfold limit_in in |- *; simpl in |- *; unfold R_dist in |- *; + unfold R_dist in H8; unfold continuity_pt; + unfold continue_in; unfold limit1_in; + unfold limit_in; simpl; unfold R_dist; intros; elim (H8 _ H9); intros; exists (Rmin x0 (b - a)); split. - unfold Rmin in |- *; case (Rle_dec x0 (b - a)); intro. + unfold Rmin; case (Rle_dec x0 (b - a)); intro. elim H10; intros; assumption. - change (0 < b - a) in |- *; apply Rlt_Rminus; assumption. + change (0 < b - a); apply Rlt_Rminus; assumption. intros; elim H11; clear H11; intros _ H11; cut (a < x1). - intro; unfold h in |- *; case (Rle_dec x a); intro. + intro; unfold h; case (Rle_dec x a); intro. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r H4)). case (Rle_dec x1 a); intro. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r H12)). @@ -1132,15 +1132,15 @@ Proof. case (Rle_dec x1 b); intro. rewrite H6; elim H10; intros; elim r0; intro. apply H14; split. - unfold D_x, no_cond in |- *; split. + unfold D_x, no_cond; split. trivial. - red in |- *; intro; rewrite <- H16 in H15; elim (Rlt_irrefl _ H15). + red; intro; rewrite <- H16 in H15; elim (Rlt_irrefl _ H15). rewrite H6 in H11; apply Rlt_le_trans with (Rmin x0 (b - a)). apply H11. apply Rmin_l. - rewrite H15; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + rewrite H15; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. - rewrite H6; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + rewrite H6; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. elim n1; right; assumption. rewrite H6 in H11; apply Ropp_lt_cancel; apply Rplus_lt_reg_r with b; @@ -1149,18 +1149,18 @@ Proof. apply Rlt_le_trans with (Rmin x0 (b - a)). assumption. apply Rmin_r. - unfold continuity_pt in |- *; unfold continue_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold R_dist in |- *; intros; exists (x - b); + unfold continuity_pt; unfold continue_in; + unfold limit1_in; unfold limit_in; + simpl; unfold R_dist; intros; exists (x - b); split. - change (0 < x - b) in |- *; apply Rlt_Rminus; assumption. + change (0 < x - b); apply Rlt_Rminus; assumption. intros; elim H8; clear H8; intros. assert (H10 : b < x0). apply Ropp_lt_cancel; apply Rplus_lt_reg_r with x; apply Rle_lt_trans with (Rabs (x0 - x)). rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; apply RRle_abs. assumption. - unfold h in |- *; case (Rle_dec x a); intro. + unfold h; case (Rle_dec x a); intro. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r H4)). case (Rle_dec x b); intro. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r H6)). @@ -1168,8 +1168,8 @@ Proof. elim (Rlt_irrefl _ (Rlt_trans _ _ _ H1 (Rlt_le_trans _ _ _ H10 r))). case (Rle_dec x0 b); intro. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r H10)). - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. - intros; elim H3; intros; unfold h in |- *; case (Rle_dec c a); intro. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. + intros; elim H3; intros; unfold h; case (Rle_dec c a); intro. elim r; intro. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H4 H6)). rewrite H6; reflexivity. @@ -1210,7 +1210,7 @@ Proof. intros; rewrite <- (Heq c H10); rewrite <- (Heq Mxx H9); intros; rewrite <- H8; unfold is_lub in H7; elim H7; clear H7; intros H7 _; unfold is_upper_bound in H7; apply H7; - unfold image_dir in |- *; exists c; split; [ reflexivity | apply H10 ]. + unfold image_dir; exists c; split; [ reflexivity | apply H10 ]. apply H9. elim (classic (image_dir g (fun c:R => a <= c <= b) M)); intro. assumption. @@ -1225,13 +1225,13 @@ Proof. cut (is_upper_bound (image_dir g (fun c:R => a <= c <= b)) (M - eps)). intro; assert (H12 := H10 _ H11); cut (M - eps < M). intro; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H12 H13)). - pattern M at 2 in |- *; rewrite <- Rplus_0_r; unfold Rminus in |- *; + pattern M at 2; rewrite <- Rplus_0_r; unfold Rminus; apply Rplus_lt_compat_l; apply Ropp_lt_cancel; rewrite Ropp_0; rewrite Ropp_involutive; apply (cond_pos eps). - unfold is_upper_bound, image_dir in |- *; intros; cut (x <= M). + unfold is_upper_bound, image_dir; intros; cut (x <= M). intro; case (Rle_dec x (M - eps)); intro. apply r. - elim (H9 x); unfold intersection_domain, disc, image_dir in |- *; split. + elim (H9 x); unfold intersection_domain, disc, image_dir; split. rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; rewrite Rabs_right. apply Rplus_lt_reg_r with (x - eps); replace (x - eps + (M - x)) with (M - eps). @@ -1249,8 +1249,8 @@ Proof. ~ intersection_domain V (image_dir g (fun c:R => a <= c <= b)) y)). intro; elim H9; intros V H10; elim H10; clear H10; intros. unfold neighbourhood in H10; elim H10; intros del H12; exists del; intros; - red in |- *; intro; elim (H11 y). - unfold intersection_domain in |- *; unfold intersection_domain in H13; + red; intro; elim (H11 y). + unfold intersection_domain; unfold intersection_domain in H13; elim H13; clear H13; intros; split. apply (H12 _ H13). apply H14. @@ -1268,18 +1268,18 @@ Proof. split. apply H12. apply (not_ex_all_not _ _ H13). - red in |- *; intro; cut (adherence (image_dir g (fun c:R => a <= c <= b)) M). + red; intro; cut (adherence (image_dir g (fun c:R => a <= c <= b)) M). intro; elim (closed_set_P1 (image_dir g (fun c:R => a <= c <= b))); intros H11 _; assert (H12 := H11 H3). elim H8. unfold eq_Dom in H12; elim H12; clear H12; intros. apply (H13 _ H10). apply H9. - exists (g a); unfold image_dir in |- *; exists a; split. + exists (g a); unfold image_dir; exists a; split. reflexivity. split; [ right; reflexivity | apply H ]. - unfold bound in |- *; unfold bounded in H4; elim H4; clear H4; intros m H4; - elim H4; clear H4; intros M H4; exists M; unfold is_upper_bound in |- *; + unfold bound; unfold bounded in H4; elim H4; clear H4; intros m H4; + elim H4; clear H4; intros M H4; exists M; unfold is_upper_bound; intros; elim (H4 _ H5); intros _ H6; apply H6. apply prolongement_C0; assumption. Qed. @@ -1327,8 +1327,8 @@ Proof. intros; elim H; intros; unfold f in H0; unfold adherence in H0; unfold point_adherent in H0; assert (H1 : neighbourhood (disc x0 (mkposreal _ Rlt_0_1)) x0). - unfold neighbourhood, disc in |- *; exists (mkposreal _ Rlt_0_1); - unfold included in |- *; trivial. + unfold neighbourhood, disc; exists (mkposreal _ Rlt_0_1); + unfold included; trivial. elim (H0 _ H1); intros; unfold intersection_domain in H2; elim H2; intros; elim H4; intros; apply H6. Qed. @@ -1345,17 +1345,17 @@ Lemma ValAdh_un_prop : forall (un:nat -> R) (x:R), ValAdh un x <-> ValAdh_un un x. Proof. intros; split; intro. - unfold ValAdh in H; unfold ValAdh_un in |- *; - unfold intersection_family in |- *; simpl in |- *; - intros; elim H0; intros N H1; unfold adherence in |- *; - unfold point_adherent in |- *; intros; elim (H V N H2); - intros; exists (un x0); unfold intersection_domain in |- *; + unfold ValAdh in H; unfold ValAdh_un; + unfold intersection_family; simpl; + intros; elim H0; intros N H1; unfold adherence; + unfold point_adherent; intros; elim (H V N H2); + intros; exists (un x0); unfold intersection_domain; elim H3; clear H3; intros; split. assumption. split. exists x0; split; [ reflexivity | rewrite H1; apply (le_INR _ _ H3) ]. exists N; assumption. - unfold ValAdh in |- *; intros; unfold ValAdh_un in H; + unfold ValAdh; intros; unfold ValAdh_un in H; unfold intersection_family in H; simpl in H; assert (H1 : @@ -1376,8 +1376,8 @@ Qed. Lemma adherence_P4 : forall F G:R -> Prop, included F G -> included (adherence F) (adherence G). Proof. - unfold adherence, included in |- *; unfold point_adherent in |- *; intros; - elim (H0 _ H1); unfold intersection_domain in |- *; + unfold adherence, included; unfold point_adherent; intros; + elim (H0 _ H1); unfold intersection_domain; intros; elim H2; clear H2; intros; exists x0; split; [ assumption | apply (H _ H3) ]. Qed. @@ -1410,36 +1410,36 @@ Proof. intros; elim H2; intros; unfold f' in H3; elim H3; intros; assumption. set (f0 := mkfamily D' f' H2). unfold compact in H; assert (H3 : covering_open_set X f0). - unfold covering_open_set in |- *; split. - unfold covering in |- *; intros; unfold intersection_vide_in in H1; + unfold covering_open_set; split. + unfold covering; intros; unfold intersection_vide_in in H1; elim (H1 x); intros; unfold intersection_family in H5; assert (H6 := not_ex_all_not _ (fun y:R => forall y0:R, ind g y0 -> g y0 y) H5 x); assert (H7 := not_all_ex_not _ (fun y0:R => ind g y0 -> g y0 x) H6); elim H7; intros; exists x0; elim (imply_to_and _ _ H8); - intros; unfold f0 in |- *; simpl in |- *; unfold f' in |- *; + intros; unfold f0; simpl; unfold f'; split; [ apply H10 | apply H9 ]. - unfold family_open_set in |- *; intro; elim (classic (D' x)); intro. + unfold family_open_set; intro; elim (classic (D' x)); intro. apply open_set_P6 with (complementary (g x)). unfold family_closed_set in H0; unfold closed_set in H0; apply H0. - unfold f0 in |- *; simpl in |- *; unfold f' in |- *; unfold eq_Dom in |- *; + unfold f0; simpl; unfold f'; unfold eq_Dom; split. - unfold included in |- *; intros; split; [ apply H4 | apply H3 ]. - unfold included in |- *; intros; elim H4; intros; assumption. + unfold included; intros; split; [ apply H4 | apply H3 ]. + unfold included; intros; elim H4; intros; assumption. apply open_set_P6 with (fun _:R => False). apply open_set_P4. - unfold eq_Dom in |- *; unfold included in |- *; split; intros; + unfold eq_Dom; unfold included; split; intros; [ elim H4 | simpl in H4; unfold f' in H4; elim H4; intros; elim H3; assumption ]. elim (H _ H3); intros SF H4; exists SF; - unfold intersection_vide_finite_in in |- *; split. - unfold intersection_vide_in in |- *; simpl in |- *; intros; split. - intros; unfold included in |- *; intros; unfold intersection_vide_in in H1; + unfold intersection_vide_finite_in; split. + unfold intersection_vide_in; simpl; intros; split. + intros; unfold included; intros; unfold intersection_vide_in in H1; elim (H1 x); intros; elim H6; intros; apply H7. unfold intersection_domain in H5; elim H5; intros; assumption. assumption. elim (classic (exists y : R, intersection_domain (ind g) SF y)); intro Hyp'. - red in |- *; intro; elim H5; intros; unfold intersection_family in H6; + red; intro; elim H5; intros; unfold intersection_family in H6; simpl in H6. cut (X x0). intro; unfold covering_finite in H4; elim H4; clear H4; intros H4 _; @@ -1462,16 +1462,16 @@ Proof. cut (exists z : R, X z). intro; elim H5; clear H5; intros; unfold covering in H4; elim (H4 x0 H5); intros; simpl in H6; elim Hyp'; exists x1; elim H6; - intros; unfold intersection_domain in |- *; split. + intros; unfold intersection_domain; split. apply (cond_fam f0); exists x0; apply H7. apply H8. apply Hyp. unfold covering_finite in H4; elim H4; clear H4; intros; unfold family_finite in H5; unfold domain_finite in H5; - unfold family_finite in |- *; unfold domain_finite in |- *; + unfold family_finite; unfold domain_finite; elim H5; clear H5; intros l H5; exists l; intro; elim (H5 x); intros; split; intro; - [ apply H6; simpl in |- *; simpl in H8; apply H8 | apply (H7 H8) ]. + [ apply H6; simpl; simpl in H8; apply H8 | apply (H7 H8) ]. Qed. Theorem Bolzano_Weierstrass : @@ -1492,8 +1492,8 @@ Proof. intros; elim H2; intros; unfold g in H3; unfold adherence in H3; unfold point_adherent in H3. assert (H4 : neighbourhood (disc x0 (mkposreal _ Rlt_0_1)) x0). - unfold neighbourhood in |- *; exists (mkposreal _ Rlt_0_1); - unfold included in |- *; trivial. + unfold neighbourhood; exists (mkposreal _ Rlt_0_1); + unfold included; trivial. elim (H3 _ H4); intros; unfold intersection_domain in H5; decompose [and] H5; assumption. set (f0 := mkfamily D g H2). @@ -1509,19 +1509,19 @@ Proof. unfold domain_finite in H9; elim H9; clear H9; intros l H9; set (r := MaxRlist l); cut (D r). intro; unfold D in H11; elim H11; intros; exists (un x); - unfold intersection_family in |- *; simpl in |- *; - unfold intersection_domain in |- *; intros; split. - unfold g in |- *; apply adherence_P1; split. + unfold intersection_family; simpl; + unfold intersection_domain; intros; split. + unfold g; apply adherence_P1; split. exists x; split; [ reflexivity - | rewrite <- H12; unfold r in |- *; apply MaxRlist_P1; elim (H9 y); intros; - apply H14; simpl in |- *; apply H13 ]. + | rewrite <- H12; unfold r; apply MaxRlist_P1; elim (H9 y); intros; + apply H14; simpl; apply H13 ]. elim H13; intros; assumption. elim H13; intros; assumption. elim (H9 r); intros. simpl in H12; unfold intersection_domain in H12; cut (In r l). intro; elim (H12 H13); intros; assumption. - unfold r in |- *; apply MaxRlist_P2; + unfold r; apply MaxRlist_P2; cut (exists z : R, intersection_domain (ind f0) SF z). intro; elim H13; intros; elim (H9 x); intros; simpl in H15; assert (H17 := H15 H14); exists x; apply H17. @@ -1541,16 +1541,16 @@ Proof. not_all_ex_not _ (fun y:R => intersection_domain D SF y -> g y x /\ SF y) H18); elim H19; intros; assert (H21 := imply_to_and _ _ H20); elim (H17 x0); elim H21; intros; assumption. - unfold intersection_vide_in in |- *; intros; split. - intro; simpl in H6; unfold f0 in |- *; simpl in |- *; unfold g in |- *; + unfold intersection_vide_in; intros; split. + intro; simpl in H6; unfold f0; simpl; unfold g; apply included_trans with (adherence X). apply adherence_P4. - unfold included in |- *; intros; elim H7; intros; elim H8; intros; elim H10; + unfold included; intros; elim H7; intros; elim H8; intros; elim H10; intros; rewrite H11; apply H0. apply adherence_P2; apply compact_P2; assumption. apply H4. - unfold family_closed_set in |- *; unfold f0 in |- *; simpl in |- *; - unfold g in |- *; intro; apply adherence_P3. + unfold family_closed_set; unfold f0; simpl; + unfold g; intro; apply adherence_P3. Qed. (********************************************************) @@ -1566,7 +1566,7 @@ Definition uniform_continuity (f:R -> R) (X:R -> Prop) : Prop := Lemma is_lub_u : forall (E:R -> Prop) (x y:R), is_lub E x -> is_lub E y -> x = y. Proof. - unfold is_lub in |- *; intros; elim H; elim H0; intros; apply Rle_antisym; + unfold is_lub; intros; elim H; elim H0; intros; apply Rle_antisym; [ apply (H4 _ H1) | apply (H2 _ H3) ]. Qed. @@ -1581,7 +1581,7 @@ Proof. right; elim H1; intros; elim H2; intros; exists x; exists x0; intros. split; [ assumption - | split; [ assumption | apply (sym_not_eq (A:=R)); assumption ] ]. + | split; [ assumption | apply (not_eq_sym (A:=R)); assumption ] ]. left; exists x; split. assumption. intros; case (Req_dec x0 x); intro. @@ -1597,14 +1597,14 @@ Theorem Heine : Proof. intros f0 X H0 H; elim (domain_P1 X); intro Hyp. (* X is empty *) - unfold uniform_continuity in |- *; intros; exists (mkposreal _ Rlt_0_1); + unfold uniform_continuity; intros; exists (mkposreal _ Rlt_0_1); intros; elim Hyp; exists x; assumption. elim Hyp; clear Hyp; intro Hyp. (* X has only one element *) - unfold uniform_continuity in |- *; intros; exists (mkposreal _ Rlt_0_1); + unfold uniform_continuity; intros; exists (mkposreal _ Rlt_0_1); intros; elim Hyp; clear Hyp; intros; elim H4; clear H4; intros; assert (H6 := H5 _ H1); assert (H7 := H5 _ H2); - rewrite H6; rewrite H7; unfold Rminus in |- *; rewrite Rplus_opp_r; + rewrite H6; rewrite H7; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply (cond_pos eps). (* X has at least two distinct elements *) assert @@ -1624,9 +1624,9 @@ Proof. elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ (Rle_trans _ _ _ H13 H14) r)). elim X_enc; clear X_enc; intros m X_enc; elim X_enc; clear X_enc; intros M X_enc; elim X_enc; clear X_enc Hyp; intros X_enc Hyp; - unfold uniform_continuity in |- *; intro; + unfold uniform_continuity; intro; assert (H1 : forall t:posreal, 0 < t / 2). - intro; unfold Rdiv in |- *; apply Rmult_lt_0_compat; + intro; unfold Rdiv; apply Rmult_lt_0_compat; [ apply (cond_pos t) | apply Rinv_0_lt_compat; prove_sup0 ]. set (g := @@ -1644,8 +1644,8 @@ Proof. apply H3. set (f' := mkfamily X g H2); unfold compact in H0; assert (H3 : covering_open_set X f'). - unfold covering_open_set in |- *; split. - unfold covering in |- *; intros; exists x; simpl in |- *; unfold g in |- *; + unfold covering_open_set; split. + unfold covering; intros; exists x; simpl; unfold g; split. assumption. assert (H4 := H _ H3); unfold continuity_pt in H4; unfold continue_in in H4; @@ -1658,22 +1658,22 @@ Proof. 0 < zeta <= M - m /\ (forall z:R, Rabs (z - x) < zeta -> Rabs (f0 z - f0 x) < eps / 2)); assert (H6 : bound E). - unfold bound in |- *; exists (M - m); unfold is_upper_bound in |- *; - unfold E in |- *; intros; elim H6; clear H6; intros H6 _; + unfold bound; exists (M - m); unfold is_upper_bound; + unfold E; intros; elim H6; clear H6; intros H6 _; elim H6; clear H6; intros _ H6; apply H6. assert (H7 : exists x : R, E x). - elim H5; clear H5; intros; exists (Rmin x0 (M - m)); unfold E in |- *; intros; + elim H5; clear H5; intros; exists (Rmin x0 (M - m)); unfold E; intros; split. split. - unfold Rmin in |- *; case (Rle_dec x0 (M - m)); intro. + unfold Rmin; case (Rle_dec x0 (M - m)); intro. apply H5. apply Rlt_Rminus; apply Hyp. apply Rmin_r. intros; case (Req_dec x z); intro. - rewrite H9; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + rewrite H9; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply (H1 eps). apply H7; split. - unfold D_x, no_cond in |- *; split; [ trivial | assumption ]. + unfold D_x, no_cond; split; [ trivial | assumption ]. apply Rlt_le_trans with (Rmin x0 (M - m)); [ apply H8 | apply Rmin_l ]. assert (H8 := completeness _ H6 H7); elim H8; clear H8; intros; cut (0 < x1 <= M - m). @@ -1690,15 +1690,15 @@ Proof. unfold is_lub in p; elim p; intros; cut (is_upper_bound E (Rabs (z - x))). intro; assert (H16 := H14 _ H15); elim (Rlt_irrefl _ (Rlt_le_trans _ _ _ H10 H16)). - unfold is_upper_bound in |- *; intros; unfold is_upper_bound in H13; + unfold is_upper_bound; intros; unfold is_upper_bound in H13; assert (H16 := H13 _ H15); case (Rle_dec x2 (Rabs (z - x))); intro. assumption. elim (H12 x2); split; [ split; [ auto with real | assumption ] | assumption ]. split. apply p. - unfold disc in |- *; unfold Rminus in |- *; rewrite Rplus_opp_r; - rewrite Rabs_R0; simpl in |- *; unfold Rdiv in |- *; + unfold disc; unfold Rminus; rewrite Rplus_opp_r; + rewrite Rabs_R0; simpl; unfold Rdiv; apply Rmult_lt_0_compat; [ apply H8 | apply Rinv_0_lt_compat; prove_sup0 ]. elim H7; intros; unfold E in H8; elim H8; intros H9 _; elim H9; intros H10 _; unfold is_lub in p; elim p; intros; unfold is_upper_bound in H12; @@ -1706,13 +1706,13 @@ Proof. apply Rlt_le_trans with x2; [ assumption | apply (H11 _ H8) ]. apply H12; intros; unfold E in H13; elim H13; intros; elim H14; intros; assumption. - unfold family_open_set in |- *; intro; simpl in |- *; elim (classic (X x)); + unfold family_open_set; intro; simpl; elim (classic (X x)); intro. - unfold g in |- *; unfold open_set in |- *; intros; elim H4; clear H4; + unfold g; unfold open_set; intros; elim H4; clear H4; intros _ H4; elim H4; clear H4; intros; elim H4; clear H4; - intros; unfold neighbourhood in |- *; case (Req_dec x x0); + intros; unfold neighbourhood; case (Req_dec x x0); intro. - exists (mkposreal _ (H1 x1)); rewrite <- H6; unfold included in |- *; intros; + exists (mkposreal _ (H1 x1)); rewrite <- H6; unfold included; intros; split. assumption. exists x1; split. @@ -1721,24 +1721,24 @@ Proof. elim H5; intros; apply H8. apply H7. set (d := x1 / 2 - Rabs (x0 - x)); assert (H7 : 0 < d). - unfold d in |- *; apply Rlt_Rminus; elim H5; clear H5; intros; + unfold d; apply Rlt_Rminus; elim H5; clear H5; intros; unfold disc in H7; apply H7. - exists (mkposreal _ H7); unfold included in |- *; intros; split. + exists (mkposreal _ H7); unfold included; intros; split. assumption. exists x1; split. apply H4. elim H5; intros; split. assumption. - unfold disc in H8; simpl in H8; unfold disc in |- *; simpl in |- *; + unfold disc in H8; simpl in H8; unfold disc; simpl; unfold disc in H10; simpl in H10; apply Rle_lt_trans with (Rabs (x2 - x0) + Rabs (x0 - x)). replace (x2 - x) with (x2 - x0 + (x0 - x)); [ apply Rabs_triang | ring ]. - replace (x1 / 2) with (d + Rabs (x0 - x)); [ idtac | unfold d in |- *; ring ]. + replace (x1 / 2) with (d + Rabs (x0 - x)); [ idtac | unfold d; ring ]. do 2 rewrite <- (Rplus_comm (Rabs (x0 - x))); apply Rplus_lt_compat_l; apply H8. apply open_set_P6 with (fun _:R => False). apply open_set_P4. - unfold eq_Dom in |- *; unfold included in |- *; intros; split. + unfold eq_Dom; unfold included; intros; split. intros; elim H4. intros; unfold g in H4; elim H4; clear H4; intros H4 _; elim H3; apply H4. elim (H0 _ H3); intros DF H4; unfold covering_finite in H4; elim H4; clear H4; @@ -1776,10 +1776,10 @@ Proof. apply Rlt_trans with (pos_Rl l' i / 2). apply H21. elim H13; clear H13; intros; assumption. - unfold Rdiv in |- *; apply Rmult_lt_reg_l with 2. + unfold Rdiv; apply Rmult_lt_reg_l with 2. prove_sup0. rewrite Rmult_comm; rewrite Rmult_assoc; rewrite <- Rinv_l_sym. - rewrite Rmult_1_r; pattern (pos_Rl l' i) at 1 in |- *; rewrite <- Rplus_0_r; + rewrite Rmult_1_r; pattern (pos_Rl l' i) at 1; rewrite <- Rplus_0_r; rewrite double; apply Rplus_lt_compat_l; apply H19. discrR. assert (H19 := H8 i H17); elim H19; clear H19; intros; rewrite <- H18 in H20; @@ -1791,15 +1791,15 @@ Proof. rewrite (double_var (pos_Rl l' i)); apply Rplus_lt_compat. apply Rlt_le_trans with (D / 2). rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; apply H12. - unfold Rdiv in |- *; do 2 rewrite <- (Rmult_comm (/ 2)); + unfold Rdiv; do 2 rewrite <- (Rmult_comm (/ 2)); apply Rmult_le_compat_l. left; apply Rinv_0_lt_compat; prove_sup0. - unfold D in |- *; apply MinRlist_P1; elim (pos_Rl_P2 l' (pos_Rl l' i)); + unfold D; apply MinRlist_P1; elim (pos_Rl_P2 l' (pos_Rl l' i)); intros; apply H26; exists i; split; [ rewrite <- H7; assumption | reflexivity ]. assumption. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; - [ unfold D in |- *; apply MinRlist_P2; intros; elim (pos_Rl_P2 l' y); intros; + unfold Rdiv; apply Rmult_lt_0_compat; + [ unfold D; apply MinRlist_P2; intros; elim (pos_Rl_P2 l' y); intros; elim (H10 H9); intros; elim H12; intros; rewrite H14; rewrite <- H7 in H13; elim (H8 x H13); intros; apply H15 @@ -1811,25 +1811,25 @@ Proof. 0 < zeta <= M - m /\ (forall z:R, Rabs (z - x) < zeta -> Rabs (f0 z - f0 x) < eps / 2)); assert (H11 : bound E). - unfold bound in |- *; exists (M - m); unfold is_upper_bound in |- *; - unfold E in |- *; intros; elim H11; clear H11; intros H11 _; + unfold bound; exists (M - m); unfold is_upper_bound; + unfold E; intros; elim H11; clear H11; intros H11 _; elim H11; clear H11; intros _ H11; apply H11. assert (H12 : exists x : R, E x). assert (H13 := H _ H9); unfold continuity_pt in H13; unfold continue_in in H13; unfold limit1_in in H13; unfold limit_in in H13; simpl in H13; unfold R_dist in H13; elim (H13 _ (H1 eps)); intros; elim H12; clear H12; - intros; exists (Rmin x0 (M - m)); unfold E in |- *; + intros; exists (Rmin x0 (M - m)); unfold E; intros; split. split; - [ unfold Rmin in |- *; case (Rle_dec x0 (M - m)); intro; + [ unfold Rmin; case (Rle_dec x0 (M - m)); intro; [ apply H12 | apply Rlt_Rminus; apply Hyp ] | apply Rmin_r ]. intros; case (Req_dec x z); intro. - rewrite H16; unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; + rewrite H16; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; apply (H1 eps). apply H14; split; - [ unfold D_x, no_cond in |- *; split; [ trivial | assumption ] + [ unfold D_x, no_cond; split; [ trivial | assumption ] | apply Rlt_le_trans with (Rmin x0 (M - m)); [ apply H15 | apply Rmin_l ] ]. assert (H13 := completeness _ H11 H12); elim H13; clear H13; intros; cut (0 < x0 <= M - m). @@ -1847,14 +1847,14 @@ Proof. unfold is_lub in p; elim p; intros; cut (is_upper_bound E (Rabs (z - x))). intro; assert (H21 := H19 _ H20); elim (Rlt_irrefl _ (Rlt_le_trans _ _ _ H15 H21)). - unfold is_upper_bound in |- *; intros; unfold is_upper_bound in H18; + unfold is_upper_bound; intros; unfold is_upper_bound in H18; assert (H21 := H18 _ H20); case (Rle_dec x1 (Rabs (z - x))); intro. assumption. elim (H17 x1); split. split; [ auto with real | assumption ]. assumption. - unfold included, g in |- *; intros; elim H15; intros; elim H17; intros; + unfold included, g; intros; elim H15; intros; elim H17; intros; decompose [and] H18; cut (x0 = x2). intro; rewrite H20; apply H22. unfold E in p; eapply is_lub_u. diff --git a/theories/Reals/Rtrigo.v b/theories/Reals/Rtrigo.v index e45353b5..32c4d7d3 100644 --- a/theories/Reals/Rtrigo.v +++ b/theories/Reals/Rtrigo.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -16,1789 +16,11 @@ Require Export Cos_rel. Require Export Cos_plus. Require Import ZArith_base. Require Import Zcomplements. -Local Open Scope nat_scope. -Local Open Scope R_scope. - -(** sin_PI2 is the only remaining axiom **) -Axiom sin_PI2 : sin (PI / 2) = 1. - -(**********) -Lemma PI_neq0 : PI <> 0. -Proof. - red in |- *; intro; assert (H0 := PI_RGT_0); rewrite H in H0; - elim (Rlt_irrefl _ H0). -Qed. - -(**********) -Lemma cos_minus : forall x y:R, cos (x - y) = cos x * cos y + sin x * sin y. -Proof. - intros; unfold Rminus in |- *; rewrite cos_plus. - rewrite <- cos_sym; rewrite sin_antisym; ring. -Qed. - -(**********) -Lemma sin2_cos2 : forall x:R, Rsqr (sin x) + Rsqr (cos x) = 1. -Proof. - intro; unfold Rsqr in |- *; rewrite Rplus_comm; rewrite <- (cos_minus x x); - unfold Rminus in |- *; rewrite Rplus_opp_r; apply cos_0. -Qed. - -Lemma cos2 : forall x:R, Rsqr (cos x) = 1 - Rsqr (sin x). -Proof. - intro x; generalize (sin2_cos2 x); intro H1; rewrite <- H1; - unfold Rminus in |- *; rewrite <- (Rplus_comm (Rsqr (cos x))); - rewrite Rplus_assoc; rewrite Rplus_opp_r; symmetry in |- *; - apply Rplus_0_r. -Qed. - -(**********) -Lemma cos_PI2 : cos (PI / 2) = 0. -Proof. - apply Rsqr_eq_0; rewrite cos2; rewrite sin_PI2; rewrite Rsqr_1; - unfold Rminus in |- *; apply Rplus_opp_r. -Qed. - -(**********) -Lemma cos_PI : cos PI = -1. -Proof. - replace PI with (PI / 2 + PI / 2). - rewrite cos_plus. - rewrite sin_PI2; rewrite cos_PI2. - ring. - symmetry in |- *; apply double_var. -Qed. - -Lemma sin_PI : sin PI = 0. -Proof. - assert (H := sin2_cos2 PI). - rewrite cos_PI in H. - rewrite <- Rsqr_neg in H. - rewrite Rsqr_1 in H. - cut (Rsqr (sin PI) = 0). - intro; apply (Rsqr_eq_0 _ H0). - apply Rplus_eq_reg_l with 1. - rewrite Rplus_0_r; rewrite Rplus_comm; exact H. -Qed. - -(**********) -Lemma neg_cos : forall x:R, cos (x + PI) = - cos x. -Proof. - intro x; rewrite cos_plus; rewrite sin_PI; rewrite cos_PI; ring. -Qed. - -(**********) -Lemma sin_cos : forall x:R, sin x = - cos (PI / 2 + x). -Proof. - intro x; rewrite cos_plus; rewrite sin_PI2; rewrite cos_PI2; ring. -Qed. - -(**********) -Lemma sin_plus : forall x y:R, sin (x + y) = sin x * cos y + cos x * sin y. -Proof. - intros. - rewrite (sin_cos (x + y)). - replace (PI / 2 + (x + y)) with (PI / 2 + x + y); [ rewrite cos_plus | ring ]. - rewrite (sin_cos (PI / 2 + x)). - replace (PI / 2 + (PI / 2 + x)) with (x + PI). - rewrite neg_cos. - replace (cos (PI / 2 + x)) with (- sin x). - ring. - rewrite sin_cos; rewrite Ropp_involutive; reflexivity. - pattern PI at 1 in |- *; rewrite (double_var PI); ring. -Qed. - -Lemma sin_minus : forall x y:R, sin (x - y) = sin x * cos y - cos x * sin y. -Proof. - intros; unfold Rminus in |- *; rewrite sin_plus. - rewrite <- cos_sym; rewrite sin_antisym; ring. -Qed. - -(**********) -Definition tan (x:R) : R := sin x / cos x. - -Lemma tan_plus : - forall x y:R, - cos x <> 0 -> - cos y <> 0 -> - cos (x + y) <> 0 -> - 1 - tan x * tan y <> 0 -> - tan (x + y) = (tan x + tan y) / (1 - tan x * tan y). -Proof. - intros; unfold tan in |- *; rewrite sin_plus; rewrite cos_plus; - unfold Rdiv in |- *; - replace (cos x * cos y - sin x * sin y) with - (cos x * cos y * (1 - sin x * / cos x * (sin y * / cos y))). - rewrite Rinv_mult_distr. - repeat rewrite <- Rmult_assoc; - replace ((sin x * cos y + cos x * sin y) * / (cos x * cos y)) with - (sin x * / cos x + sin y * / cos y). - reflexivity. - rewrite Rmult_plus_distr_r; rewrite Rinv_mult_distr. - repeat rewrite Rmult_assoc; repeat rewrite (Rmult_comm (sin x)); - repeat rewrite <- Rmult_assoc. - repeat rewrite Rinv_r_simpl_m; [ reflexivity | assumption | assumption ]. - assumption. - assumption. - apply prod_neq_R0; assumption. - assumption. - unfold Rminus in |- *; rewrite Rmult_plus_distr_l; rewrite Rmult_1_r; - apply Rplus_eq_compat_l; repeat rewrite Rmult_assoc; - rewrite (Rmult_comm (sin x)); rewrite (Rmult_comm (cos y)); - rewrite <- Ropp_mult_distr_r_reverse; repeat rewrite <- Rmult_assoc; - rewrite <- Rinv_r_sym. - rewrite Rmult_1_l; rewrite (Rmult_comm (sin x)); - rewrite <- Ropp_mult_distr_r_reverse; repeat rewrite Rmult_assoc; - apply Rmult_eq_compat_l; rewrite (Rmult_comm (/ cos y)); - rewrite Rmult_assoc; rewrite <- Rinv_r_sym. - apply Rmult_1_r. - assumption. - assumption. -Qed. - -(*******************************************************) -(** * Some properties of cos, sin and tan *) -(*******************************************************) - -Lemma sin2 : forall x:R, Rsqr (sin x) = 1 - Rsqr (cos x). -Proof. - intro x; generalize (cos2 x); intro H1; rewrite H1. - unfold Rminus in |- *; rewrite Ropp_plus_distr; rewrite <- Rplus_assoc; - rewrite Rplus_opp_r; rewrite Rplus_0_l; symmetry in |- *; - apply Ropp_involutive. -Qed. - -Lemma sin_2a : forall x:R, sin (2 * x) = 2 * sin x * cos x. -Proof. - intro x; rewrite double; rewrite sin_plus. - rewrite <- (Rmult_comm (sin x)); symmetry in |- *; rewrite Rmult_assoc; - apply double. -Qed. - -Lemma cos_2a : forall x:R, cos (2 * x) = cos x * cos x - sin x * sin x. -Proof. - intro x; rewrite double; apply cos_plus. -Qed. - -Lemma cos_2a_cos : forall x:R, cos (2 * x) = 2 * cos x * cos x - 1. -Proof. - intro x; rewrite double; unfold Rminus in |- *; rewrite Rmult_assoc; - rewrite cos_plus; generalize (sin2_cos2 x); rewrite double; - intro H1; rewrite <- H1; ring_Rsqr. -Qed. - -Lemma cos_2a_sin : forall x:R, cos (2 * x) = 1 - 2 * sin x * sin x. -Proof. - intro x; rewrite Rmult_assoc; unfold Rminus in |- *; repeat rewrite double. - generalize (sin2_cos2 x); intro H1; rewrite <- H1; rewrite cos_plus; - ring_Rsqr. -Qed. - -Lemma tan_2a : - forall x:R, - cos x <> 0 -> - cos (2 * x) <> 0 -> - 1 - tan x * tan x <> 0 -> tan (2 * x) = 2 * tan x / (1 - tan x * tan x). -Proof. - repeat rewrite double; intros; repeat rewrite double; rewrite double in H0; - apply tan_plus; assumption. -Qed. - -Lemma sin_neg : forall x:R, sin (- x) = - sin x. -Proof. - apply sin_antisym. -Qed. - -Lemma cos_neg : forall x:R, cos (- x) = cos x. -Proof. - intro; symmetry in |- *; apply cos_sym. -Qed. - -Lemma tan_0 : tan 0 = 0. -Proof. - unfold tan in |- *; rewrite sin_0; rewrite cos_0. - unfold Rdiv in |- *; apply Rmult_0_l. -Qed. - -Lemma tan_neg : forall x:R, tan (- x) = - tan x. -Proof. - intros x; unfold tan in |- *; rewrite sin_neg; rewrite cos_neg; - unfold Rdiv in |- *. - apply Ropp_mult_distr_l_reverse. -Qed. - -Lemma tan_minus : - forall x y:R, - cos x <> 0 -> - cos y <> 0 -> - cos (x - y) <> 0 -> - 1 + tan x * tan y <> 0 -> - tan (x - y) = (tan x - tan y) / (1 + tan x * tan y). -Proof. - intros; unfold Rminus in |- *; rewrite tan_plus. - rewrite tan_neg; unfold Rminus in |- *; rewrite <- Ropp_mult_distr_l_reverse; - rewrite Rmult_opp_opp; reflexivity. - assumption. - rewrite cos_neg; assumption. - assumption. - rewrite tan_neg; unfold Rminus in |- *; rewrite <- Ropp_mult_distr_l_reverse; - rewrite Rmult_opp_opp; assumption. -Qed. - -Lemma cos_3PI2 : cos (3 * (PI / 2)) = 0. -Proof. - replace (3 * (PI / 2)) with (PI + PI / 2). - rewrite cos_plus; rewrite sin_PI; rewrite cos_PI2; ring. - pattern PI at 1 in |- *; rewrite (double_var PI). - ring. -Qed. - -Lemma sin_2PI : sin (2 * PI) = 0. -Proof. - rewrite sin_2a; rewrite sin_PI; ring. -Qed. - -Lemma cos_2PI : cos (2 * PI) = 1. -Proof. - rewrite cos_2a; rewrite sin_PI; rewrite cos_PI; ring. -Qed. - -Lemma neg_sin : forall x:R, sin (x + PI) = - sin x. -Proof. - intro x; rewrite sin_plus; rewrite sin_PI; rewrite cos_PI; ring. -Qed. - -Lemma sin_PI_x : forall x:R, sin (PI - x) = sin x. -Proof. - intro x; rewrite sin_minus; rewrite sin_PI; rewrite cos_PI; rewrite Rmult_0_l; - unfold Rminus in |- *; rewrite Rplus_0_l; rewrite Ropp_mult_distr_l_reverse; - rewrite Ropp_involutive; apply Rmult_1_l. -Qed. - -Lemma sin_period : forall (x:R) (k:nat), sin (x + 2 * INR k * PI) = sin x. -Proof. - intros x k; induction k as [| k Hreck]. - simpl in |- *; ring_simplify (x + 2 * 0 * PI). - trivial. - - replace (x + 2 * INR (S k) * PI) with (x + 2 * INR k * PI + 2 * PI). - rewrite sin_plus in |- *; rewrite sin_2PI in |- *; rewrite cos_2PI in |- *. - ring_simplify; trivial. - rewrite S_INR in |- *; ring. -Qed. - -Lemma cos_period : forall (x:R) (k:nat), cos (x + 2 * INR k * PI) = cos x. -Proof. - intros x k; induction k as [| k Hreck]. - simpl in |- *; ring_simplify (x + 2 * 0 * PI). - trivial. - - replace (x + 2 * INR (S k) * PI) with (x + 2 * INR k * PI + 2 * PI). - rewrite cos_plus in |- *; rewrite sin_2PI in |- *; rewrite cos_2PI in |- *. - ring_simplify; trivial. - rewrite S_INR in |- *; ring. -Qed. - -Lemma sin_shift : forall x:R, sin (PI / 2 - x) = cos x. -Proof. - intro x; rewrite sin_minus; rewrite sin_PI2; rewrite cos_PI2; ring. -Qed. - -Lemma cos_shift : forall x:R, cos (PI / 2 - x) = sin x. -Proof. - intro x; rewrite cos_minus; rewrite sin_PI2; rewrite cos_PI2; ring. -Qed. - -Lemma cos_sin : forall x:R, cos x = sin (PI / 2 + x). -Proof. - intro x; rewrite sin_plus; rewrite sin_PI2; rewrite cos_PI2; ring. -Qed. - -Lemma PI2_RGT_0 : 0 < PI / 2. -Proof. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; - [ apply PI_RGT_0 | apply Rinv_0_lt_compat; prove_sup ]. -Qed. - -Lemma SIN_bound : forall x:R, -1 <= sin x <= 1. -Proof. - intro; case (Rle_dec (-1) (sin x)); intro. - case (Rle_dec (sin x) 1); intro. - split; assumption. - cut (1 < sin x). - intro; - generalize - (Rsqr_incrst_1 1 (sin x) H (Rlt_le 0 1 Rlt_0_1) - (Rlt_le 0 (sin x) (Rlt_trans 0 1 (sin x) Rlt_0_1 H))); - rewrite Rsqr_1; intro; rewrite sin2 in H0; unfold Rminus in H0; - generalize (Rplus_lt_compat_l (-1) 1 (1 + - Rsqr (cos x)) H0); - repeat rewrite <- Rplus_assoc; repeat rewrite Rplus_opp_l; - rewrite Rplus_0_l; intro; rewrite <- Ropp_0 in H1; - generalize (Ropp_lt_gt_contravar (-0) (- Rsqr (cos x)) H1); - repeat rewrite Ropp_involutive; intro; generalize (Rle_0_sqr (cos x)); - intro; elim (Rlt_irrefl 0 (Rle_lt_trans 0 (Rsqr (cos x)) 0 H3 H2)). - auto with real. - cut (sin x < -1). - intro; generalize (Ropp_lt_gt_contravar (sin x) (-1) H); - rewrite Ropp_involutive; clear H; intro; - generalize - (Rsqr_incrst_1 1 (- sin x) H (Rlt_le 0 1 Rlt_0_1) - (Rlt_le 0 (- sin x) (Rlt_trans 0 1 (- sin x) Rlt_0_1 H))); - rewrite Rsqr_1; intro; rewrite <- Rsqr_neg in H0; - rewrite sin2 in H0; unfold Rminus in H0; - generalize (Rplus_lt_compat_l (-1) 1 (1 + - Rsqr (cos x)) H0); - repeat rewrite <- Rplus_assoc; repeat rewrite Rplus_opp_l; - rewrite Rplus_0_l; intro; rewrite <- Ropp_0 in H1; - generalize (Ropp_lt_gt_contravar (-0) (- Rsqr (cos x)) H1); - repeat rewrite Ropp_involutive; intro; generalize (Rle_0_sqr (cos x)); - intro; elim (Rlt_irrefl 0 (Rle_lt_trans 0 (Rsqr (cos x)) 0 H3 H2)). - auto with real. -Qed. - -Lemma COS_bound : forall x:R, -1 <= cos x <= 1. -Proof. - intro; rewrite <- sin_shift; apply SIN_bound. -Qed. - -Lemma cos_sin_0 : forall x:R, ~ (cos x = 0 /\ sin x = 0). -Proof. - intro; red in |- *; intro; elim H; intros; generalize (sin2_cos2 x); intro; - rewrite H0 in H2; rewrite H1 in H2; repeat rewrite Rsqr_0 in H2; - rewrite Rplus_0_r in H2; generalize Rlt_0_1; intro; - rewrite <- H2 in H3; elim (Rlt_irrefl 0 H3). -Qed. - -Lemma cos_sin_0_var : forall x:R, cos x <> 0 \/ sin x <> 0. -Proof. - intros x. - destruct (Req_dec (cos x) 0). 2: now left. - right. intros H'. - apply (cos_sin_0 x). - now split. -Qed. - -(*****************************************************************) -(** * Using series definitions of cos and sin *) -(*****************************************************************) - -Definition sin_lb (a:R) : R := sin_approx a 3. -Definition sin_ub (a:R) : R := sin_approx a 4. -Definition cos_lb (a:R) : R := cos_approx a 3. -Definition cos_ub (a:R) : R := cos_approx a 4. - -Lemma sin_lb_gt_0 : forall a:R, 0 < a -> a <= PI / 2 -> 0 < sin_lb a. -Proof. - intros. - unfold sin_lb in |- *; unfold sin_approx in |- *; unfold sin_term in |- *. - set (Un := fun i:nat => a ^ (2 * i + 1) / INR (fact (2 * i + 1))). - replace - (sum_f_R0 - (fun i:nat => (-1) ^ i * (a ^ (2 * i + 1) / INR (fact (2 * i + 1)))) 3) - with (sum_f_R0 (fun i:nat => (-1) ^ i * Un i) 3); - [ idtac | apply sum_eq; intros; unfold Un in |- *; reflexivity ]. - cut (forall n:nat, Un (S n) < Un n). - intro; simpl in |- *. - repeat rewrite Rmult_1_l; repeat rewrite Rmult_1_r; - replace (-1 * Un 1%nat) with (- Un 1%nat); [ idtac | ring ]; - replace (-1 * -1 * Un 2%nat) with (Un 2%nat); [ idtac | ring ]; - replace (-1 * (-1 * -1) * Un 3%nat) with (- Un 3%nat); - [ idtac | ring ]; - replace (Un 0%nat + - Un 1%nat + Un 2%nat + - Un 3%nat) with - (Un 0%nat - Un 1%nat + (Un 2%nat - Un 3%nat)); [ idtac | ring ]. - apply Rplus_lt_0_compat. - unfold Rminus in |- *; apply Rplus_lt_reg_r with (Un 1%nat); - rewrite Rplus_0_r; rewrite (Rplus_comm (Un 1%nat)); - rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; - apply H1. - unfold Rminus in |- *; apply Rplus_lt_reg_r with (Un 3%nat); - rewrite Rplus_0_r; rewrite (Rplus_comm (Un 3%nat)); - rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; - apply H1. - intro; unfold Un in |- *. - cut ((2 * S n + 1)%nat = (2 * n + 1 + 2)%nat). - intro; rewrite H1. - rewrite pow_add; unfold Rdiv in |- *; rewrite Rmult_assoc; - apply Rmult_lt_compat_l. - apply pow_lt; assumption. - rewrite <- H1; apply Rmult_lt_reg_l with (INR (fact (2 * n + 1))). - apply lt_INR_0; apply neq_O_lt. - assert (H2 := fact_neq_0 (2 * n + 1)). - red in |- *; intro; elim H2; symmetry in |- *; assumption. - rewrite <- Rinv_r_sym. - apply Rmult_lt_reg_l with (INR (fact (2 * S n + 1))). - apply lt_INR_0; apply neq_O_lt. - assert (H2 := fact_neq_0 (2 * S n + 1)). - red in |- *; intro; elim H2; symmetry in |- *; assumption. - rewrite (Rmult_comm (INR (fact (2 * S n + 1)))); repeat rewrite Rmult_assoc; - rewrite <- Rinv_l_sym. - do 2 rewrite Rmult_1_r; apply Rle_lt_trans with (INR (fact (2 * n + 1)) * 4). - apply Rmult_le_compat_l. - replace 0 with (INR 0); [ idtac | reflexivity ]; apply le_INR; apply le_O_n. - simpl in |- *; rewrite Rmult_1_r; replace 4 with (Rsqr 2); - [ idtac | ring_Rsqr ]; replace (a * a) with (Rsqr a); - [ idtac | reflexivity ]; apply Rsqr_incr_1. - apply Rle_trans with (PI / 2); - [ assumption - | unfold Rdiv in |- *; apply Rmult_le_reg_l with 2; - [ prove_sup0 - | rewrite <- Rmult_assoc; rewrite Rinv_r_simpl_m; - [ replace 4 with 4; [ apply PI_4 | ring ] | discrR ] ] ]. - left; assumption. - left; prove_sup0. - rewrite H1; replace (2 * n + 1 + 2)%nat with (S (S (2 * n + 1))). - do 2 rewrite fact_simpl; do 2 rewrite mult_INR. - repeat rewrite <- Rmult_assoc. - rewrite <- (Rmult_comm (INR (fact (2 * n + 1)))). - rewrite Rmult_assoc. - apply Rmult_lt_compat_l. - apply lt_INR_0; apply neq_O_lt. - assert (H2 := fact_neq_0 (2 * n + 1)). - red in |- *; intro; elim H2; symmetry in |- *; assumption. - do 2 rewrite S_INR; rewrite plus_INR; rewrite mult_INR; set (x := INR n); - unfold INR in |- *. - replace ((2 * x + 1 + 1 + 1) * (2 * x + 1 + 1)) with (4 * x * x + 10 * x + 6); - [ idtac | ring ]. - apply Rplus_lt_reg_r with (-4); rewrite Rplus_opp_l; - replace (-4 + (4 * x * x + 10 * x + 6)) with (4 * x * x + 10 * x + 2); - [ idtac | ring ]. - apply Rplus_le_lt_0_compat. - cut (0 <= x). - intro; apply Rplus_le_le_0_compat; repeat apply Rmult_le_pos; - assumption || left; prove_sup. - unfold x in |- *; replace 0 with (INR 0); - [ apply le_INR; apply le_O_n | reflexivity ]. - prove_sup0. - ring. - apply INR_fact_neq_0. - apply INR_fact_neq_0. - ring. -Qed. - -Lemma SIN : forall a:R, 0 <= a -> a <= PI -> sin_lb a <= sin a <= sin_ub a. - intros; unfold sin_lb, sin_ub in |- *; apply (sin_bound a 1 H H0). -Qed. - -Lemma COS : - forall a:R, - PI / 2 <= a -> a <= PI / 2 -> cos_lb a <= cos a <= cos_ub a. - intros; unfold cos_lb, cos_ub in |- *; apply (cos_bound a 1 H H0). -Qed. - -(**********) -Lemma _PI2_RLT_0 : - (PI / 2) < 0. -Proof. - rewrite <- Ropp_0; apply Ropp_lt_contravar; apply PI2_RGT_0. -Qed. - -Lemma PI4_RLT_PI2 : PI / 4 < PI / 2. -Proof. - unfold Rdiv in |- *; apply Rmult_lt_compat_l. - apply PI_RGT_0. - apply Rinv_lt_contravar. - apply Rmult_lt_0_compat; prove_sup0. - pattern 2 at 1 in |- *; rewrite <- Rplus_0_r. - replace 4 with (2 + 2); [ apply Rplus_lt_compat_l; prove_sup0 | ring ]. -Qed. - -Lemma PI2_Rlt_PI : PI / 2 < PI. -Proof. - unfold Rdiv in |- *; pattern PI at 2 in |- *; rewrite <- Rmult_1_r. - apply Rmult_lt_compat_l. - apply PI_RGT_0. - pattern 1 at 3 in |- *; rewrite <- Rinv_1; apply Rinv_lt_contravar. - rewrite Rmult_1_l; prove_sup0. - pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; - apply Rlt_0_1. -Qed. - -(***************************************************) -(** * Increasing and decreasing of [cos] and [sin] *) -(***************************************************) -Theorem sin_gt_0 : forall x:R, 0 < x -> x < PI -> 0 < sin x. -Proof. - intros; elim (SIN x (Rlt_le 0 x H) (Rlt_le x PI H0)); intros H1 _; - case (Rtotal_order x (PI / 2)); intro H2. - apply Rlt_le_trans with (sin_lb x). - apply sin_lb_gt_0; [ assumption | left; assumption ]. - assumption. - elim H2; intro H3. - rewrite H3; rewrite sin_PI2; apply Rlt_0_1. - rewrite <- sin_PI_x; generalize (Ropp_gt_lt_contravar x (PI / 2) H3); - intro H4; generalize (Rplus_lt_compat_l PI (- x) (- (PI / 2)) H4). - replace (PI + - x) with (PI - x). - replace (PI + - (PI / 2)) with (PI / 2). - intro H5; generalize (Ropp_lt_gt_contravar x PI H0); intro H6; - change (- PI < - x) in H6; generalize (Rplus_lt_compat_l PI (- PI) (- x) H6). - rewrite Rplus_opp_r. - replace (PI + - x) with (PI - x). - intro H7; - elim - (SIN (PI - x) (Rlt_le 0 (PI - x) H7) - (Rlt_le (PI - x) PI (Rlt_trans (PI - x) (PI / 2) PI H5 PI2_Rlt_PI))); - intros H8 _; - generalize (sin_lb_gt_0 (PI - x) H7 (Rlt_le (PI - x) (PI / 2) H5)); - intro H9; apply (Rlt_le_trans 0 (sin_lb (PI - x)) (sin (PI - x)) H9 H8). - reflexivity. - pattern PI at 2 in |- *; rewrite double_var; ring. - reflexivity. -Qed. - -Theorem cos_gt_0 : forall x:R, - (PI / 2) < x -> x < PI / 2 -> 0 < cos x. -Proof. - intros; rewrite cos_sin; - generalize (Rplus_lt_compat_l (PI / 2) (- (PI / 2)) x H). - rewrite Rplus_opp_r; intro H1; - generalize (Rplus_lt_compat_l (PI / 2) x (PI / 2) H0); - rewrite <- double_var; intro H2; apply (sin_gt_0 (PI / 2 + x) H1 H2). -Qed. - -Lemma sin_ge_0 : forall x:R, 0 <= x -> x <= PI -> 0 <= sin x. -Proof. - intros x H1 H2; elim H1; intro H3; - [ elim H2; intro H4; - [ left; apply (sin_gt_0 x H3 H4) - | rewrite H4; right; symmetry in |- *; apply sin_PI ] - | rewrite <- H3; right; symmetry in |- *; apply sin_0 ]. -Qed. - -Lemma cos_ge_0 : forall x:R, - (PI / 2) <= x -> x <= PI / 2 -> 0 <= cos x. -Proof. - intros x H1 H2; elim H1; intro H3; - [ elim H2; intro H4; - [ left; apply (cos_gt_0 x H3 H4) - | rewrite H4; right; symmetry in |- *; apply cos_PI2 ] - | rewrite <- H3; rewrite cos_neg; right; symmetry in |- *; apply cos_PI2 ]. -Qed. - -Lemma sin_le_0 : forall x:R, PI <= x -> x <= 2 * PI -> sin x <= 0. -Proof. - intros x H1 H2; apply Rge_le; rewrite <- Ropp_0; - rewrite <- (Ropp_involutive (sin x)); apply Ropp_le_ge_contravar; - rewrite <- neg_sin; replace (x + PI) with (x - PI + 2 * INR 1 * PI); - [ rewrite (sin_period (x - PI) 1); apply sin_ge_0; - [ replace (x - PI) with (x + - PI); - [ rewrite Rplus_comm; replace 0 with (- PI + PI); - [ apply Rplus_le_compat_l; assumption | ring ] - | ring ] - | replace (x - PI) with (x + - PI); rewrite Rplus_comm; - [ pattern PI at 2 in |- *; replace PI with (- PI + 2 * PI); - [ apply Rplus_le_compat_l; assumption | ring ] - | ring ] ] - | unfold INR in |- *; ring ]. -Qed. - -Lemma cos_le_0 : forall x:R, PI / 2 <= x -> x <= 3 * (PI / 2) -> cos x <= 0. -Proof. - intros x H1 H2; apply Rge_le; rewrite <- Ropp_0; - rewrite <- (Ropp_involutive (cos x)); apply Ropp_le_ge_contravar; - rewrite <- neg_cos; replace (x + PI) with (x - PI + 2 * INR 1 * PI). - rewrite cos_period; apply cos_ge_0. - replace (- (PI / 2)) with (- PI + PI / 2). - unfold Rminus in |- *; rewrite (Rplus_comm x); apply Rplus_le_compat_l; - assumption. - pattern PI at 1 in |- *; rewrite (double_var PI); rewrite Ropp_plus_distr; - ring. - unfold Rminus in |- *; rewrite Rplus_comm; - replace (PI / 2) with (- PI + 3 * (PI / 2)). - apply Rplus_le_compat_l; assumption. - pattern PI at 1 in |- *; rewrite (double_var PI); rewrite Ropp_plus_distr; - ring. - unfold INR in |- *; ring. -Qed. - -Lemma sin_lt_0 : forall x:R, PI < x -> x < 2 * PI -> sin x < 0. -Proof. - intros x H1 H2; rewrite <- Ropp_0; rewrite <- (Ropp_involutive (sin x)); - apply Ropp_lt_gt_contravar; rewrite <- neg_sin; - replace (x + PI) with (x - PI + 2 * INR 1 * PI); - [ rewrite (sin_period (x - PI) 1); apply sin_gt_0; - [ replace (x - PI) with (x + - PI); - [ rewrite Rplus_comm; replace 0 with (- PI + PI); - [ apply Rplus_lt_compat_l; assumption | ring ] - | ring ] - | replace (x - PI) with (x + - PI); rewrite Rplus_comm; - [ pattern PI at 2 in |- *; replace PI with (- PI + 2 * PI); - [ apply Rplus_lt_compat_l; assumption | ring ] - | ring ] ] - | unfold INR in |- *; ring ]. -Qed. - -Lemma sin_lt_0_var : forall x:R, - PI < x -> x < 0 -> sin x < 0. -Proof. - intros; generalize (Rplus_lt_compat_l (2 * PI) (- PI) x H); - replace (2 * PI + - PI) with PI; - [ intro H1; rewrite Rplus_comm in H1; - generalize (Rplus_lt_compat_l (2 * PI) x 0 H0); - intro H2; rewrite (Rplus_comm (2 * PI)) in H2; - rewrite <- (Rplus_comm 0) in H2; rewrite Rplus_0_l in H2; - rewrite <- (sin_period x 1); unfold INR in |- *; - replace (2 * 1 * PI) with (2 * PI); - [ apply (sin_lt_0 (x + 2 * PI) H1 H2) | ring ] - | ring ]. -Qed. - -Lemma cos_lt_0 : forall x:R, PI / 2 < x -> x < 3 * (PI / 2) -> cos x < 0. -Proof. - intros x H1 H2; rewrite <- Ropp_0; rewrite <- (Ropp_involutive (cos x)); - apply Ropp_lt_gt_contravar; rewrite <- neg_cos; - replace (x + PI) with (x - PI + 2 * INR 1 * PI). - rewrite cos_period; apply cos_gt_0. - replace (- (PI / 2)) with (- PI + PI / 2). - unfold Rminus in |- *; rewrite (Rplus_comm x); apply Rplus_lt_compat_l; - assumption. - pattern PI at 1 in |- *; rewrite (double_var PI); rewrite Ropp_plus_distr; - ring. - unfold Rminus in |- *; rewrite Rplus_comm; - replace (PI / 2) with (- PI + 3 * (PI / 2)). - apply Rplus_lt_compat_l; assumption. - pattern PI at 1 in |- *; rewrite (double_var PI); rewrite Ropp_plus_distr; - ring. - unfold INR in |- *; ring. -Qed. - -Lemma tan_gt_0 : forall x:R, 0 < x -> x < PI / 2 -> 0 < tan x. -Proof. - intros x H1 H2; unfold tan in |- *; generalize _PI2_RLT_0; - generalize (Rlt_trans 0 x (PI / 2) H1 H2); intros; - generalize (Rlt_trans (- (PI / 2)) 0 x H0 H1); intro H5; - generalize (Rlt_trans x (PI / 2) PI H2 PI2_Rlt_PI); - intro H7; unfold Rdiv in |- *; apply Rmult_lt_0_compat. - apply sin_gt_0; assumption. - apply Rinv_0_lt_compat; apply cos_gt_0; assumption. -Qed. - -Lemma tan_lt_0 : forall x:R, - (PI / 2) < x -> x < 0 -> tan x < 0. -Proof. - intros x H1 H2; unfold tan in |- *; - generalize (cos_gt_0 x H1 (Rlt_trans x 0 (PI / 2) H2 PI2_RGT_0)); - intro H3; rewrite <- Ropp_0; - replace (sin x / cos x) with (- (- sin x / cos x)). - rewrite <- sin_neg; apply Ropp_gt_lt_contravar; - change (0 < sin (- x) / cos x) in |- *; unfold Rdiv in |- *; - apply Rmult_lt_0_compat. - apply sin_gt_0. - rewrite <- Ropp_0; apply Ropp_gt_lt_contravar; assumption. - apply Rlt_trans with (PI / 2). - rewrite <- (Ropp_involutive (PI / 2)); apply Ropp_gt_lt_contravar; assumption. - apply PI2_Rlt_PI. - apply Rinv_0_lt_compat; assumption. - unfold Rdiv in |- *; ring. -Qed. - -Lemma cos_ge_0_3PI2 : - forall x:R, 3 * (PI / 2) <= x -> x <= 2 * PI -> 0 <= cos x. -Proof. - intros; rewrite <- cos_neg; rewrite <- (cos_period (- x) 1); - unfold INR in |- *; replace (- x + 2 * 1 * PI) with (2 * PI - x). - generalize (Ropp_le_ge_contravar x (2 * PI) H0); intro H1; - generalize (Rge_le (- x) (- (2 * PI)) H1); clear H1; - intro H1; generalize (Rplus_le_compat_l (2 * PI) (- (2 * PI)) (- x) H1). - rewrite Rplus_opp_r. - intro H2; generalize (Ropp_le_ge_contravar (3 * (PI / 2)) x H); intro H3; - generalize (Rge_le (- (3 * (PI / 2))) (- x) H3); clear H3; - intro H3; - generalize (Rplus_le_compat_l (2 * PI) (- x) (- (3 * (PI / 2))) H3). - replace (2 * PI + - (3 * (PI / 2))) with (PI / 2). - intro H4; - apply - (cos_ge_0 (2 * PI - x) - (Rlt_le (- (PI / 2)) (2 * PI - x) - (Rlt_le_trans (- (PI / 2)) 0 (2 * PI - x) _PI2_RLT_0 H2)) H4). - rewrite double; pattern PI at 2 3 in |- *; rewrite double_var; ring. - ring. -Qed. - -Lemma form1 : - forall p q:R, cos p + cos q = 2 * cos ((p - q) / 2) * cos ((p + q) / 2). -Proof. - intros p q; pattern p at 1 in |- *; - replace p with ((p - q) / 2 + (p + q) / 2). - rewrite <- (cos_neg q); replace (- q) with ((p - q) / 2 - (p + q) / 2). - rewrite cos_plus; rewrite cos_minus; ring. - pattern q at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. - pattern p at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. -Qed. - -Lemma form2 : - forall p q:R, cos p - cos q = -2 * sin ((p - q) / 2) * sin ((p + q) / 2). -Proof. - intros p q; pattern p at 1 in |- *; - replace p with ((p - q) / 2 + (p + q) / 2). - rewrite <- (cos_neg q); replace (- q) with ((p - q) / 2 - (p + q) / 2). - rewrite cos_plus; rewrite cos_minus; ring. - pattern q at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. - pattern p at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. -Qed. - -Lemma form3 : - forall p q:R, sin p + sin q = 2 * cos ((p - q) / 2) * sin ((p + q) / 2). -Proof. - intros p q; pattern p at 1 in |- *; - replace p with ((p - q) / 2 + (p + q) / 2). - pattern q at 3 in |- *; replace q with ((p + q) / 2 - (p - q) / 2). - rewrite sin_plus; rewrite sin_minus; ring. - pattern q at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. - pattern p at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. -Qed. - -Lemma form4 : - forall p q:R, sin p - sin q = 2 * cos ((p + q) / 2) * sin ((p - q) / 2). -Proof. - intros p q; pattern p at 1 in |- *; - replace p with ((p - q) / 2 + (p + q) / 2). - pattern q at 3 in |- *; replace q with ((p + q) / 2 - (p - q) / 2). - rewrite sin_plus; rewrite sin_minus; ring. - pattern q at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. - pattern p at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. - -Qed. - -Lemma sin_increasing_0 : - forall x y:R, - - (PI / 2) <= x -> - x <= PI / 2 -> - (PI / 2) <= y -> y <= PI / 2 -> sin x < sin y -> x < y. -Proof. - intros; cut (sin ((x - y) / 2) < 0). - intro H4; case (Rtotal_order ((x - y) / 2) 0); intro H5. - assert (Hyp : 0 < 2). - prove_sup0. - generalize (Rmult_lt_compat_l 2 ((x - y) / 2) 0 Hyp H5). - unfold Rdiv in |- *. - rewrite <- Rmult_assoc. - rewrite Rinv_r_simpl_m. - rewrite Rmult_0_r. - clear H5; intro H5; apply Rminus_lt; assumption. - discrR. - elim H5; intro H6. - rewrite H6 in H4; rewrite sin_0 in H4; elim (Rlt_irrefl 0 H4). - change (0 < (x - y) / 2) in H6; - generalize (Ropp_le_ge_contravar (- (PI / 2)) y H1). - rewrite Ropp_involutive. - intro H7; generalize (Rge_le (PI / 2) (- y) H7); clear H7; intro H7; - generalize (Rplus_le_compat x (PI / 2) (- y) (PI / 2) H0 H7). - rewrite <- double_var. - intro H8. - assert (Hyp : 0 < 2). - prove_sup0. - generalize - (Rmult_le_compat_l (/ 2) (x - y) PI - (Rlt_le 0 (/ 2) (Rinv_0_lt_compat 2 Hyp)) H8). - repeat rewrite (Rmult_comm (/ 2)). - intro H9; - generalize - (sin_gt_0 ((x - y) / 2) H6 - (Rle_lt_trans ((x - y) / 2) (PI / 2) PI H9 PI2_Rlt_PI)); - intro H10; - elim - (Rlt_irrefl (sin ((x - y) / 2)) - (Rlt_trans (sin ((x - y) / 2)) 0 (sin ((x - y) / 2)) H4 H10)). - generalize (Rlt_minus (sin x) (sin y) H3); clear H3; intro H3; - rewrite form4 in H3; - generalize (Rplus_le_compat x (PI / 2) y (PI / 2) H0 H2). - rewrite <- double_var. - assert (Hyp : 0 < 2). - prove_sup0. - intro H4; - generalize - (Rmult_le_compat_l (/ 2) (x + y) PI - (Rlt_le 0 (/ 2) (Rinv_0_lt_compat 2 Hyp)) H4). - repeat rewrite (Rmult_comm (/ 2)). - clear H4; intro H4; - generalize (Rplus_le_compat (- (PI / 2)) x (- (PI / 2)) y H H1); - replace (- (PI / 2) + - (PI / 2)) with (- PI). - intro H5; - generalize - (Rmult_le_compat_l (/ 2) (- PI) (x + y) - (Rlt_le 0 (/ 2) (Rinv_0_lt_compat 2 Hyp)) H5). - replace (/ 2 * (x + y)) with ((x + y) / 2). - replace (/ 2 * - PI) with (- (PI / 2)). - clear H5; intro H5; elim H4; intro H40. - elim H5; intro H50. - generalize (cos_gt_0 ((x + y) / 2) H50 H40); intro H6; - generalize (Rmult_lt_compat_l 2 0 (cos ((x + y) / 2)) Hyp H6). - rewrite Rmult_0_r. - clear H6; intro H6; case (Rcase_abs (sin ((x - y) / 2))); intro H7. - assumption. - generalize (Rge_le (sin ((x - y) / 2)) 0 H7); clear H7; intro H7; - generalize - (Rmult_le_pos (2 * cos ((x + y) / 2)) (sin ((x - y) / 2)) - (Rlt_le 0 (2 * cos ((x + y) / 2)) H6) H7); intro H8; - generalize - (Rle_lt_trans 0 (2 * cos ((x + y) / 2) * sin ((x - y) / 2)) 0 H8 H3); - intro H9; elim (Rlt_irrefl 0 H9). - rewrite <- H50 in H3; rewrite cos_neg in H3; rewrite cos_PI2 in H3; - rewrite Rmult_0_r in H3; rewrite Rmult_0_l in H3; - elim (Rlt_irrefl 0 H3). - unfold Rdiv in H3. - rewrite H40 in H3; assert (H50 := cos_PI2); unfold Rdiv in H50; - rewrite H50 in H3; rewrite Rmult_0_r in H3; rewrite Rmult_0_l in H3; - elim (Rlt_irrefl 0 H3). - unfold Rdiv in |- *. - rewrite <- Ropp_mult_distr_l_reverse. - apply Rmult_comm. - unfold Rdiv in |- *; apply Rmult_comm. - pattern PI at 1 in |- *; rewrite double_var. - rewrite Ropp_plus_distr. - reflexivity. -Qed. - -Lemma sin_increasing_1 : - forall x y:R, - - (PI / 2) <= x -> - x <= PI / 2 -> - (PI / 2) <= y -> y <= PI / 2 -> x < y -> sin x < sin y. -Proof. - intros; generalize (Rplus_lt_compat_l x x y H3); intro H4; - generalize (Rplus_le_compat (- (PI / 2)) x (- (PI / 2)) x H H); - replace (- (PI / 2) + - (PI / 2)) with (- PI). - assert (Hyp : 0 < 2). - prove_sup0. - intro H5; generalize (Rle_lt_trans (- PI) (x + x) (x + y) H5 H4); intro H6; - generalize - (Rmult_lt_compat_l (/ 2) (- PI) (x + y) (Rinv_0_lt_compat 2 Hyp) H6); - replace (/ 2 * - PI) with (- (PI / 2)). - replace (/ 2 * (x + y)) with ((x + y) / 2). - clear H4 H5 H6; intro H4; generalize (Rplus_lt_compat_l y x y H3); intro H5; - rewrite Rplus_comm in H5; - generalize (Rplus_le_compat y (PI / 2) y (PI / 2) H2 H2). - rewrite <- double_var. - intro H6; generalize (Rlt_le_trans (x + y) (y + y) PI H5 H6); intro H7; - generalize (Rmult_lt_compat_l (/ 2) (x + y) PI (Rinv_0_lt_compat 2 Hyp) H7); - replace (/ 2 * PI) with (PI / 2). - replace (/ 2 * (x + y)) with ((x + y) / 2). - clear H5 H6 H7; intro H5; generalize (Ropp_le_ge_contravar (- (PI / 2)) y H1); - rewrite Ropp_involutive; clear H1; intro H1; - generalize (Rge_le (PI / 2) (- y) H1); clear H1; intro H1; - generalize (Ropp_le_ge_contravar y (PI / 2) H2); clear H2; - intro H2; generalize (Rge_le (- y) (- (PI / 2)) H2); - clear H2; intro H2; generalize (Rplus_lt_compat_l (- y) x y H3); - replace (- y + x) with (x - y). - rewrite Rplus_opp_l. - intro H6; - generalize (Rmult_lt_compat_l (/ 2) (x - y) 0 (Rinv_0_lt_compat 2 Hyp) H6); - rewrite Rmult_0_r; replace (/ 2 * (x - y)) with ((x - y) / 2). - clear H6; intro H6; - generalize (Rplus_le_compat (- (PI / 2)) x (- (PI / 2)) (- y) H H2); - replace (- (PI / 2) + - (PI / 2)) with (- PI). - replace (x + - y) with (x - y). - intro H7; - generalize - (Rmult_le_compat_l (/ 2) (- PI) (x - y) - (Rlt_le 0 (/ 2) (Rinv_0_lt_compat 2 Hyp)) H7); - replace (/ 2 * - PI) with (- (PI / 2)). - replace (/ 2 * (x - y)) with ((x - y) / 2). - clear H7; intro H7; clear H H0 H1 H2; apply Rminus_lt; rewrite form4; - generalize (cos_gt_0 ((x + y) / 2) H4 H5); intro H8; - generalize (Rmult_lt_0_compat 2 (cos ((x + y) / 2)) Hyp H8); - clear H8; intro H8; cut (- PI < - (PI / 2)). - intro H9; - generalize - (sin_lt_0_var ((x - y) / 2) - (Rlt_le_trans (- PI) (- (PI / 2)) ((x - y) / 2) H9 H7) H6); - intro H10; - generalize - (Rmult_lt_gt_compat_neg_l (sin ((x - y) / 2)) 0 ( - 2 * cos ((x + y) / 2)) H10 H8); intro H11; rewrite Rmult_0_r in H11; - rewrite Rmult_comm; assumption. - apply Ropp_lt_gt_contravar; apply PI2_Rlt_PI. - unfold Rdiv in |- *; apply Rmult_comm. - unfold Rdiv in |- *; rewrite <- Ropp_mult_distr_l_reverse; apply Rmult_comm. - reflexivity. - pattern PI at 1 in |- *; rewrite double_var. - rewrite Ropp_plus_distr. - reflexivity. - unfold Rdiv in |- *; apply Rmult_comm. - unfold Rminus in |- *; apply Rplus_comm. - unfold Rdiv in |- *; apply Rmult_comm. - unfold Rdiv in |- *; apply Rmult_comm. - unfold Rdiv in |- *; apply Rmult_comm. - unfold Rdiv in |- *. - rewrite <- Ropp_mult_distr_l_reverse. - apply Rmult_comm. - pattern PI at 1 in |- *; rewrite double_var. - rewrite Ropp_plus_distr. - reflexivity. -Qed. - -Lemma sin_decreasing_0 : - forall x y:R, - x <= 3 * (PI / 2) -> - PI / 2 <= x -> y <= 3 * (PI / 2) -> PI / 2 <= y -> sin x < sin y -> y < x. -Proof. - intros; rewrite <- (sin_PI_x x) in H3; rewrite <- (sin_PI_x y) in H3; - generalize (Ropp_lt_gt_contravar (sin (PI - x)) (sin (PI - y)) H3); - repeat rewrite <- sin_neg; - generalize (Rplus_le_compat_l (- PI) x (3 * (PI / 2)) H); - generalize (Rplus_le_compat_l (- PI) (PI / 2) x H0); - generalize (Rplus_le_compat_l (- PI) y (3 * (PI / 2)) H1); - generalize (Rplus_le_compat_l (- PI) (PI / 2) y H2); - replace (- PI + x) with (x - PI). - replace (- PI + PI / 2) with (- (PI / 2)). - replace (- PI + y) with (y - PI). - replace (- PI + 3 * (PI / 2)) with (PI / 2). - replace (- (PI - x)) with (x - PI). - replace (- (PI - y)) with (y - PI). - intros; change (sin (y - PI) < sin (x - PI)) in H8; - apply Rplus_lt_reg_r with (- PI); rewrite Rplus_comm; - replace (y + - PI) with (y - PI). - rewrite Rplus_comm; replace (x + - PI) with (x - PI). - apply (sin_increasing_0 (y - PI) (x - PI) H4 H5 H6 H7 H8). - reflexivity. - reflexivity. - unfold Rminus in |- *; rewrite Ropp_plus_distr. - rewrite Ropp_involutive. - apply Rplus_comm. - unfold Rminus in |- *; rewrite Ropp_plus_distr. - rewrite Ropp_involutive. - apply Rplus_comm. - pattern PI at 2 in |- *; rewrite double_var. - rewrite Ropp_plus_distr. - ring. - unfold Rminus in |- *; apply Rplus_comm. - pattern PI at 2 in |- *; rewrite double_var. - rewrite Ropp_plus_distr. - ring. - unfold Rminus in |- *; apply Rplus_comm. -Qed. - -Lemma sin_decreasing_1 : - forall x y:R, - x <= 3 * (PI / 2) -> - PI / 2 <= x -> y <= 3 * (PI / 2) -> PI / 2 <= y -> x < y -> sin y < sin x. -Proof. - intros; rewrite <- (sin_PI_x x); rewrite <- (sin_PI_x y); - generalize (Rplus_le_compat_l (- PI) x (3 * (PI / 2)) H); - generalize (Rplus_le_compat_l (- PI) (PI / 2) x H0); - generalize (Rplus_le_compat_l (- PI) y (3 * (PI / 2)) H1); - generalize (Rplus_le_compat_l (- PI) (PI / 2) y H2); - generalize (Rplus_lt_compat_l (- PI) x y H3); - replace (- PI + PI / 2) with (- (PI / 2)). - replace (- PI + y) with (y - PI). - replace (- PI + 3 * (PI / 2)) with (PI / 2). - replace (- PI + x) with (x - PI). - intros; apply Ropp_lt_cancel; repeat rewrite <- sin_neg; - replace (- (PI - x)) with (x - PI). - replace (- (PI - y)) with (y - PI). - apply (sin_increasing_1 (x - PI) (y - PI) H7 H8 H5 H6 H4). - unfold Rminus in |- *; rewrite Ropp_plus_distr. - rewrite Ropp_involutive. - apply Rplus_comm. - unfold Rminus in |- *; rewrite Ropp_plus_distr. - rewrite Ropp_involutive. - apply Rplus_comm. - unfold Rminus in |- *; apply Rplus_comm. - pattern PI at 2 in |- *; rewrite double_var; ring. - unfold Rminus in |- *; apply Rplus_comm. - pattern PI at 2 in |- *; rewrite double_var; ring. -Qed. - -Lemma cos_increasing_0 : - forall x y:R, - PI <= x -> x <= 2 * PI -> PI <= y -> y <= 2 * PI -> cos x < cos y -> x < y. -Proof. - intros x y H1 H2 H3 H4; rewrite <- (cos_neg x); rewrite <- (cos_neg y); - rewrite <- (cos_period (- x) 1); rewrite <- (cos_period (- y) 1); - unfold INR in |- *; - replace (- x + 2 * 1 * PI) with (PI / 2 - (x - 3 * (PI / 2))). - replace (- y + 2 * 1 * PI) with (PI / 2 - (y - 3 * (PI / 2))). - repeat rewrite cos_shift; intro H5; - generalize (Rplus_le_compat_l (-3 * (PI / 2)) PI x H1); - generalize (Rplus_le_compat_l (-3 * (PI / 2)) x (2 * PI) H2); - generalize (Rplus_le_compat_l (-3 * (PI / 2)) PI y H3); - generalize (Rplus_le_compat_l (-3 * (PI / 2)) y (2 * PI) H4). - replace (-3 * (PI / 2) + y) with (y - 3 * (PI / 2)). - replace (-3 * (PI / 2) + x) with (x - 3 * (PI / 2)). - replace (-3 * (PI / 2) + 2 * PI) with (PI / 2). - replace (-3 * (PI / 2) + PI) with (- (PI / 2)). - clear H1 H2 H3 H4; intros H1 H2 H3 H4; - apply Rplus_lt_reg_r with (-3 * (PI / 2)); - replace (-3 * (PI / 2) + x) with (x - 3 * (PI / 2)). - replace (-3 * (PI / 2) + y) with (y - 3 * (PI / 2)). - apply (sin_increasing_0 (x - 3 * (PI / 2)) (y - 3 * (PI / 2)) H4 H3 H2 H1 H5). - unfold Rminus in |- *. - rewrite Ropp_mult_distr_l_reverse. - apply Rplus_comm. - unfold Rminus in |- *. - rewrite Ropp_mult_distr_l_reverse. - apply Rplus_comm. - pattern PI at 3 in |- *; rewrite double_var. - ring. - rewrite double; pattern PI at 3 4 in |- *; rewrite double_var. - ring. - unfold Rminus in |- *. - rewrite Ropp_mult_distr_l_reverse. - apply Rplus_comm. - unfold Rminus in |- *. - rewrite Ropp_mult_distr_l_reverse. - apply Rplus_comm. - rewrite Rmult_1_r. - rewrite (double PI); pattern PI at 3 4 in |- *; rewrite double_var. - ring. - rewrite Rmult_1_r. - rewrite (double PI); pattern PI at 3 4 in |- *; rewrite double_var. - ring. -Qed. - -Lemma cos_increasing_1 : - forall x y:R, - PI <= x -> x <= 2 * PI -> PI <= y -> y <= 2 * PI -> x < y -> cos x < cos y. -Proof. - intros x y H1 H2 H3 H4 H5; - generalize (Rplus_le_compat_l (-3 * (PI / 2)) PI x H1); - generalize (Rplus_le_compat_l (-3 * (PI / 2)) x (2 * PI) H2); - generalize (Rplus_le_compat_l (-3 * (PI / 2)) PI y H3); - generalize (Rplus_le_compat_l (-3 * (PI / 2)) y (2 * PI) H4); - generalize (Rplus_lt_compat_l (-3 * (PI / 2)) x y H5); - rewrite <- (cos_neg x); rewrite <- (cos_neg y); - rewrite <- (cos_period (- x) 1); rewrite <- (cos_period (- y) 1); - unfold INR in |- *; replace (-3 * (PI / 2) + x) with (x - 3 * (PI / 2)). - replace (-3 * (PI / 2) + y) with (y - 3 * (PI / 2)). - replace (-3 * (PI / 2) + PI) with (- (PI / 2)). - replace (-3 * (PI / 2) + 2 * PI) with (PI / 2). - clear H1 H2 H3 H4 H5; intros H1 H2 H3 H4 H5; - replace (- x + 2 * 1 * PI) with (PI / 2 - (x - 3 * (PI / 2))). - replace (- y + 2 * 1 * PI) with (PI / 2 - (y - 3 * (PI / 2))). - repeat rewrite cos_shift; - apply - (sin_increasing_1 (x - 3 * (PI / 2)) (y - 3 * (PI / 2)) H5 H4 H3 H2 H1). - rewrite Rmult_1_r. - rewrite (double PI); pattern PI at 3 4 in |- *; rewrite double_var. - ring. - rewrite Rmult_1_r. - rewrite (double PI); pattern PI at 3 4 in |- *; rewrite double_var. - ring. - rewrite (double PI); pattern PI at 3 4 in |- *; rewrite double_var. - ring. - pattern PI at 3 in |- *; rewrite double_var; ring. - unfold Rminus in |- *. - rewrite <- Ropp_mult_distr_l_reverse. - apply Rplus_comm. - unfold Rminus in |- *. - rewrite <- Ropp_mult_distr_l_reverse. - apply Rplus_comm. -Qed. - -Lemma cos_decreasing_0 : - forall x y:R, - 0 <= x -> x <= PI -> 0 <= y -> y <= PI -> cos x < cos y -> y < x. -Proof. - intros; generalize (Ropp_lt_gt_contravar (cos x) (cos y) H3); - repeat rewrite <- neg_cos; intro H4; - change (cos (y + PI) < cos (x + PI)) in H4; rewrite (Rplus_comm x) in H4; - rewrite (Rplus_comm y) in H4; generalize (Rplus_le_compat_l PI 0 x H); - generalize (Rplus_le_compat_l PI x PI H0); - generalize (Rplus_le_compat_l PI 0 y H1); - generalize (Rplus_le_compat_l PI y PI H2); rewrite Rplus_0_r. - rewrite <- double. - clear H H0 H1 H2 H3; intros; apply Rplus_lt_reg_r with PI; - apply (cos_increasing_0 (PI + y) (PI + x) H0 H H2 H1 H4). -Qed. - -Lemma cos_decreasing_1 : - forall x y:R, - 0 <= x -> x <= PI -> 0 <= y -> y <= PI -> x < y -> cos y < cos x. -Proof. - intros; apply Ropp_lt_cancel; repeat rewrite <- neg_cos; - rewrite (Rplus_comm x); rewrite (Rplus_comm y); - generalize (Rplus_le_compat_l PI 0 x H); - generalize (Rplus_le_compat_l PI x PI H0); - generalize (Rplus_le_compat_l PI 0 y H1); - generalize (Rplus_le_compat_l PI y PI H2); rewrite Rplus_0_r. - rewrite <- double. - generalize (Rplus_lt_compat_l PI x y H3); clear H H0 H1 H2 H3; intros; - apply (cos_increasing_1 (PI + x) (PI + y) H3 H2 H1 H0 H). -Qed. - -Lemma tan_diff : - forall x y:R, - cos x <> 0 -> cos y <> 0 -> tan x - tan y = sin (x - y) / (cos x * cos y). -Proof. - intros; unfold tan in |- *; rewrite sin_minus. - unfold Rdiv in |- *. - unfold Rminus in |- *. - rewrite Rmult_plus_distr_r. - rewrite Rinv_mult_distr. - repeat rewrite (Rmult_comm (sin x)). - repeat rewrite Rmult_assoc. - rewrite (Rmult_comm (cos y)). - repeat rewrite Rmult_assoc. - rewrite <- Rinv_l_sym. - rewrite Rmult_1_r. - rewrite (Rmult_comm (sin x)). - apply Rplus_eq_compat_l. - rewrite <- Ropp_mult_distr_l_reverse. - rewrite <- Ropp_mult_distr_r_reverse. - rewrite (Rmult_comm (/ cos x)). - repeat rewrite Rmult_assoc. - rewrite (Rmult_comm (cos x)). - repeat rewrite Rmult_assoc. - rewrite <- Rinv_l_sym. - rewrite Rmult_1_r. - reflexivity. - assumption. - assumption. - assumption. - assumption. -Qed. - -Lemma tan_increasing_0 : - forall x y:R, - - (PI / 4) <= x -> - x <= PI / 4 -> - (PI / 4) <= y -> y <= PI / 4 -> tan x < tan y -> x < y. -Proof. - intros; generalize PI4_RLT_PI2; intro H4; - generalize (Ropp_lt_gt_contravar (PI / 4) (PI / 2) H4); - intro H5; change (- (PI / 2) < - (PI / 4)) in H5; - generalize - (cos_gt_0 x (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) x H5 H) - (Rle_lt_trans x (PI / 4) (PI / 2) H0 H4)); intro HP1; - generalize - (cos_gt_0 y (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) y H5 H1) - (Rle_lt_trans y (PI / 4) (PI / 2) H2 H4)); intro HP2; - generalize - (sym_not_eq - (Rlt_not_eq 0 (cos x) - (cos_gt_0 x (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) x H5 H) - (Rle_lt_trans x (PI / 4) (PI / 2) H0 H4)))); - intro H6; - generalize - (sym_not_eq - (Rlt_not_eq 0 (cos y) - (cos_gt_0 y (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) y H5 H1) - (Rle_lt_trans y (PI / 4) (PI / 2) H2 H4)))); - intro H7; generalize (tan_diff x y H6 H7); intro H8; - generalize (Rlt_minus (tan x) (tan y) H3); clear H3; - intro H3; rewrite H8 in H3; cut (sin (x - y) < 0). - intro H9; generalize (Ropp_le_ge_contravar (- (PI / 4)) y H1); - rewrite Ropp_involutive; intro H10; generalize (Rge_le (PI / 4) (- y) H10); - clear H10; intro H10; generalize (Ropp_le_ge_contravar y (PI / 4) H2); - intro H11; generalize (Rge_le (- y) (- (PI / 4)) H11); - clear H11; intro H11; - generalize (Rplus_le_compat (- (PI / 4)) x (- (PI / 4)) (- y) H H11); - generalize (Rplus_le_compat x (PI / 4) (- y) (PI / 4) H0 H10); - replace (x + - y) with (x - y). - replace (PI / 4 + PI / 4) with (PI / 2). - replace (- (PI / 4) + - (PI / 4)) with (- (PI / 2)). - intros; case (Rtotal_order 0 (x - y)); intro H14. - generalize - (sin_gt_0 (x - y) H14 (Rle_lt_trans (x - y) (PI / 2) PI H12 PI2_Rlt_PI)); - intro H15; elim (Rlt_irrefl 0 (Rlt_trans 0 (sin (x - y)) 0 H15 H9)). - elim H14; intro H15. - rewrite <- H15 in H9; rewrite sin_0 in H9; elim (Rlt_irrefl 0 H9). - apply Rminus_lt; assumption. - pattern PI at 1 in |- *; rewrite double_var. - unfold Rdiv in |- *. - rewrite Rmult_plus_distr_r. - repeat rewrite Rmult_assoc. - rewrite <- Rinv_mult_distr. - rewrite Ropp_plus_distr. - replace 4 with 4. - reflexivity. - ring. - discrR. - discrR. - pattern PI at 1 in |- *; rewrite double_var. - unfold Rdiv in |- *. - rewrite Rmult_plus_distr_r. - repeat rewrite Rmult_assoc. - rewrite <- Rinv_mult_distr. - replace 4 with 4. - reflexivity. - ring. - discrR. - discrR. - reflexivity. - case (Rcase_abs (sin (x - y))); intro H9. - assumption. - generalize (Rge_le (sin (x - y)) 0 H9); clear H9; intro H9; - generalize (Rinv_0_lt_compat (cos x) HP1); intro H10; - generalize (Rinv_0_lt_compat (cos y) HP2); intro H11; - generalize (Rmult_lt_0_compat (/ cos x) (/ cos y) H10 H11); - replace (/ cos x * / cos y) with (/ (cos x * cos y)). - intro H12; - generalize - (Rmult_le_pos (sin (x - y)) (/ (cos x * cos y)) H9 - (Rlt_le 0 (/ (cos x * cos y)) H12)); intro H13; - elim - (Rlt_irrefl 0 (Rle_lt_trans 0 (sin (x - y) * / (cos x * cos y)) 0 H13 H3)). - rewrite Rinv_mult_distr. - reflexivity. - assumption. - assumption. -Qed. - -Lemma tan_increasing_1 : - forall x y:R, - - (PI / 4) <= x -> - x <= PI / 4 -> - (PI / 4) <= y -> y <= PI / 4 -> x < y -> tan x < tan y. -Proof. - intros; apply Rminus_lt; generalize PI4_RLT_PI2; intro H4; - generalize (Ropp_lt_gt_contravar (PI / 4) (PI / 2) H4); - intro H5; change (- (PI / 2) < - (PI / 4)) in H5; - generalize - (cos_gt_0 x (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) x H5 H) - (Rle_lt_trans x (PI / 4) (PI / 2) H0 H4)); intro HP1; - generalize - (cos_gt_0 y (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) y H5 H1) - (Rle_lt_trans y (PI / 4) (PI / 2) H2 H4)); intro HP2; - generalize - (sym_not_eq - (Rlt_not_eq 0 (cos x) - (cos_gt_0 x (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) x H5 H) - (Rle_lt_trans x (PI / 4) (PI / 2) H0 H4)))); - intro H6; - generalize - (sym_not_eq - (Rlt_not_eq 0 (cos y) - (cos_gt_0 y (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) y H5 H1) - (Rle_lt_trans y (PI / 4) (PI / 2) H2 H4)))); - intro H7; rewrite (tan_diff x y H6 H7); - generalize (Rinv_0_lt_compat (cos x) HP1); intro H10; - generalize (Rinv_0_lt_compat (cos y) HP2); intro H11; - generalize (Rmult_lt_0_compat (/ cos x) (/ cos y) H10 H11); - replace (/ cos x * / cos y) with (/ (cos x * cos y)). - clear H10 H11; intro H8; generalize (Ropp_le_ge_contravar y (PI / 4) H2); - intro H11; generalize (Rge_le (- y) (- (PI / 4)) H11); - clear H11; intro H11; - generalize (Rplus_le_compat (- (PI / 4)) x (- (PI / 4)) (- y) H H11); - replace (x + - y) with (x - y). - replace (- (PI / 4) + - (PI / 4)) with (- (PI / 2)). - clear H11; intro H9; generalize (Rlt_minus x y H3); clear H3; intro H3; - clear H H0 H1 H2 H4 H5 HP1 HP2; generalize PI2_Rlt_PI; - intro H1; generalize (Ropp_lt_gt_contravar (PI / 2) PI H1); - clear H1; intro H1; - generalize - (sin_lt_0_var (x - y) (Rlt_le_trans (- PI) (- (PI / 2)) (x - y) H1 H9) H3); - intro H2; - generalize - (Rmult_lt_gt_compat_neg_l (sin (x - y)) 0 (/ (cos x * cos y)) H2 H8); - rewrite Rmult_0_r; intro H4; assumption. - pattern PI at 1 in |- *; rewrite double_var. - unfold Rdiv in |- *. - rewrite Rmult_plus_distr_r. - repeat rewrite Rmult_assoc. - rewrite <- Rinv_mult_distr. - replace 4 with 4. - rewrite Ropp_plus_distr. - reflexivity. - ring. - discrR. - discrR. - reflexivity. - apply Rinv_mult_distr; assumption. -Qed. - -Lemma sin_incr_0 : - forall x y:R, - - (PI / 2) <= x -> - x <= PI / 2 -> - (PI / 2) <= y -> y <= PI / 2 -> sin x <= sin y -> x <= y. -Proof. - intros; case (Rtotal_order (sin x) (sin y)); intro H4; - [ left; apply (sin_increasing_0 x y H H0 H1 H2 H4) - | elim H4; intro H5; - [ case (Rtotal_order x y); intro H6; - [ left; assumption - | elim H6; intro H7; - [ right; assumption - | generalize (sin_increasing_1 y x H1 H2 H H0 H7); intro H8; - rewrite H5 in H8; elim (Rlt_irrefl (sin y) H8) ] ] - | elim (Rlt_irrefl (sin x) (Rle_lt_trans (sin x) (sin y) (sin x) H3 H5)) ] ]. -Qed. - -Lemma sin_incr_1 : - forall x y:R, - - (PI / 2) <= x -> - x <= PI / 2 -> - (PI / 2) <= y -> y <= PI / 2 -> x <= y -> sin x <= sin y. -Proof. - intros; case (Rtotal_order x y); intro H4; - [ left; apply (sin_increasing_1 x y H H0 H1 H2 H4) - | elim H4; intro H5; - [ case (Rtotal_order (sin x) (sin y)); intro H6; - [ left; assumption - | elim H6; intro H7; - [ right; assumption - | generalize (sin_increasing_0 y x H1 H2 H H0 H7); intro H8; - rewrite H5 in H8; elim (Rlt_irrefl y H8) ] ] - | elim (Rlt_irrefl x (Rle_lt_trans x y x H3 H5)) ] ]. -Qed. - -Lemma sin_decr_0 : - forall x y:R, - x <= 3 * (PI / 2) -> - PI / 2 <= x -> - y <= 3 * (PI / 2) -> PI / 2 <= y -> sin x <= sin y -> y <= x. -Proof. - intros; case (Rtotal_order (sin x) (sin y)); intro H4; - [ left; apply (sin_decreasing_0 x y H H0 H1 H2 H4) - | elim H4; intro H5; - [ case (Rtotal_order x y); intro H6; - [ generalize (sin_decreasing_1 x y H H0 H1 H2 H6); intro H8; - rewrite H5 in H8; elim (Rlt_irrefl (sin y) H8) - | elim H6; intro H7; - [ right; symmetry in |- *; assumption | left; assumption ] ] - | elim (Rlt_irrefl (sin x) (Rle_lt_trans (sin x) (sin y) (sin x) H3 H5)) ] ]. -Qed. - -Lemma sin_decr_1 : - forall x y:R, - x <= 3 * (PI / 2) -> - PI / 2 <= x -> - y <= 3 * (PI / 2) -> PI / 2 <= y -> x <= y -> sin y <= sin x. -Proof. - intros; case (Rtotal_order x y); intro H4; - [ left; apply (sin_decreasing_1 x y H H0 H1 H2 H4) - | elim H4; intro H5; - [ case (Rtotal_order (sin x) (sin y)); intro H6; - [ generalize (sin_decreasing_0 x y H H0 H1 H2 H6); intro H8; - rewrite H5 in H8; elim (Rlt_irrefl y H8) - | elim H6; intro H7; - [ right; symmetry in |- *; assumption | left; assumption ] ] - | elim (Rlt_irrefl x (Rle_lt_trans x y x H3 H5)) ] ]. -Qed. - -Lemma cos_incr_0 : - forall x y:R, - PI <= x -> - x <= 2 * PI -> PI <= y -> y <= 2 * PI -> cos x <= cos y -> x <= y. -Proof. - intros; case (Rtotal_order (cos x) (cos y)); intro H4; - [ left; apply (cos_increasing_0 x y H H0 H1 H2 H4) - | elim H4; intro H5; - [ case (Rtotal_order x y); intro H6; - [ left; assumption - | elim H6; intro H7; - [ right; assumption - | generalize (cos_increasing_1 y x H1 H2 H H0 H7); intro H8; - rewrite H5 in H8; elim (Rlt_irrefl (cos y) H8) ] ] - | elim (Rlt_irrefl (cos x) (Rle_lt_trans (cos x) (cos y) (cos x) H3 H5)) ] ]. -Qed. - -Lemma cos_incr_1 : - forall x y:R, - PI <= x -> - x <= 2 * PI -> PI <= y -> y <= 2 * PI -> x <= y -> cos x <= cos y. -Proof. - intros; case (Rtotal_order x y); intro H4; - [ left; apply (cos_increasing_1 x y H H0 H1 H2 H4) - | elim H4; intro H5; - [ case (Rtotal_order (cos x) (cos y)); intro H6; - [ left; assumption - | elim H6; intro H7; - [ right; assumption - | generalize (cos_increasing_0 y x H1 H2 H H0 H7); intro H8; - rewrite H5 in H8; elim (Rlt_irrefl y H8) ] ] - | elim (Rlt_irrefl x (Rle_lt_trans x y x H3 H5)) ] ]. -Qed. - -Lemma cos_decr_0 : - forall x y:R, - 0 <= x -> x <= PI -> 0 <= y -> y <= PI -> cos x <= cos y -> y <= x. -Proof. - intros; case (Rtotal_order (cos x) (cos y)); intro H4; - [ left; apply (cos_decreasing_0 x y H H0 H1 H2 H4) - | elim H4; intro H5; - [ case (Rtotal_order x y); intro H6; - [ generalize (cos_decreasing_1 x y H H0 H1 H2 H6); intro H8; - rewrite H5 in H8; elim (Rlt_irrefl (cos y) H8) - | elim H6; intro H7; - [ right; symmetry in |- *; assumption | left; assumption ] ] - | elim (Rlt_irrefl (cos x) (Rle_lt_trans (cos x) (cos y) (cos x) H3 H5)) ] ]. -Qed. - -Lemma cos_decr_1 : - forall x y:R, - 0 <= x -> x <= PI -> 0 <= y -> y <= PI -> x <= y -> cos y <= cos x. -Proof. - intros; case (Rtotal_order x y); intro H4; - [ left; apply (cos_decreasing_1 x y H H0 H1 H2 H4) - | elim H4; intro H5; - [ case (Rtotal_order (cos x) (cos y)); intro H6; - [ generalize (cos_decreasing_0 x y H H0 H1 H2 H6); intro H8; - rewrite H5 in H8; elim (Rlt_irrefl y H8) - | elim H6; intro H7; - [ right; symmetry in |- *; assumption | left; assumption ] ] - | elim (Rlt_irrefl x (Rle_lt_trans x y x H3 H5)) ] ]. -Qed. - -Lemma tan_incr_0 : - forall x y:R, - - (PI / 4) <= x -> - x <= PI / 4 -> - (PI / 4) <= y -> y <= PI / 4 -> tan x <= tan y -> x <= y. -Proof. - intros; case (Rtotal_order (tan x) (tan y)); intro H4; - [ left; apply (tan_increasing_0 x y H H0 H1 H2 H4) - | elim H4; intro H5; - [ case (Rtotal_order x y); intro H6; - [ left; assumption - | elim H6; intro H7; - [ right; assumption - | generalize (tan_increasing_1 y x H1 H2 H H0 H7); intro H8; - rewrite H5 in H8; elim (Rlt_irrefl (tan y) H8) ] ] - | elim (Rlt_irrefl (tan x) (Rle_lt_trans (tan x) (tan y) (tan x) H3 H5)) ] ]. -Qed. - -Lemma tan_incr_1 : - forall x y:R, - - (PI / 4) <= x -> - x <= PI / 4 -> - (PI / 4) <= y -> y <= PI / 4 -> x <= y -> tan x <= tan y. -Proof. - intros; case (Rtotal_order x y); intro H4; - [ left; apply (tan_increasing_1 x y H H0 H1 H2 H4) - | elim H4; intro H5; - [ case (Rtotal_order (tan x) (tan y)); intro H6; - [ left; assumption - | elim H6; intro H7; - [ right; assumption - | generalize (tan_increasing_0 y x H1 H2 H H0 H7); intro H8; - rewrite H5 in H8; elim (Rlt_irrefl y H8) ] ] - | elim (Rlt_irrefl x (Rle_lt_trans x y x H3 H5)) ] ]. -Qed. - -(**********) -Lemma sin_eq_0_1 : forall x:R, (exists k : Z, x = IZR k * PI) -> sin x = 0. -Proof. - intros. - elim H; intros. - apply (Zcase_sign x0). - intro. - rewrite H1 in H0. - simpl in H0. - rewrite H0; rewrite Rmult_0_l; apply sin_0. - intro. - cut (0 <= x0)%Z. - intro. - elim (IZN x0 H2); intros. - rewrite H3 in H0. - rewrite <- INR_IZR_INZ in H0. - rewrite H0. - elim (even_odd_cor x1); intros. - elim H4; intro. - rewrite H5. - rewrite mult_INR. - simpl in |- *. - rewrite <- (Rplus_0_l (2 * INR x2 * PI)). - rewrite sin_period. - apply sin_0. - rewrite H5. - rewrite S_INR; rewrite mult_INR. - simpl in |- *. - rewrite Rmult_plus_distr_r. - rewrite Rmult_1_l; rewrite sin_plus. - rewrite sin_PI. - rewrite Rmult_0_r. - rewrite <- (Rplus_0_l (2 * INR x2 * PI)). - rewrite sin_period. - rewrite sin_0; ring. - apply le_IZR. - left; apply IZR_lt. - assert (H2 := Zorder.Zgt_iff_lt). - elim (H2 x0 0%Z); intros. - apply H3; assumption. - intro. - rewrite H0. - replace (sin (IZR x0 * PI)) with (- sin (- IZR x0 * PI)). - cut (0 <= - x0)%Z. - intro. - rewrite <- Ropp_Ropp_IZR. - elim (IZN (- x0) H2); intros. - rewrite H3. - rewrite <- INR_IZR_INZ. - elim (even_odd_cor x1); intros. - elim H4; intro. - rewrite H5. - rewrite mult_INR. - simpl in |- *. - rewrite <- (Rplus_0_l (2 * INR x2 * PI)). - rewrite sin_period. - rewrite sin_0; ring. - rewrite H5. - rewrite S_INR; rewrite mult_INR. - simpl in |- *. - rewrite Rmult_plus_distr_r. - rewrite Rmult_1_l; rewrite sin_plus. - rewrite sin_PI. - rewrite Rmult_0_r. - rewrite <- (Rplus_0_l (2 * INR x2 * PI)). - rewrite sin_period. - rewrite sin_0; ring. - apply le_IZR. - apply Rplus_le_reg_l with (IZR x0). - rewrite Rplus_0_r. - rewrite Ropp_Ropp_IZR. - rewrite Rplus_opp_r. - left; replace 0 with (IZR 0); [ apply IZR_lt | reflexivity ]. - assumption. - rewrite <- sin_neg. - rewrite Ropp_mult_distr_l_reverse. - rewrite Ropp_involutive. - reflexivity. -Qed. - -Lemma sin_eq_0_0 : forall x:R, sin x = 0 -> exists k : Z, x = IZR k * PI. -Proof. - intros. - assert (H0 := euclidian_division x PI PI_neq0). - elim H0; intros q H1. - elim H1; intros r H2. - exists q. - cut (r = 0). - intro. - elim H2; intros H4 _; rewrite H4; rewrite H3. - apply Rplus_0_r. - elim H2; intros. - rewrite H3 in H. - rewrite sin_plus in H. - cut (sin (IZR q * PI) = 0). - intro. - rewrite H5 in H. - rewrite Rmult_0_l in H. - rewrite Rplus_0_l in H. - assert (H6 := Rmult_integral _ _ H). - elim H6; intro. - assert (H8 := sin2_cos2 (IZR q * PI)). - rewrite H5 in H8; rewrite H7 in H8. - rewrite Rsqr_0 in H8. - rewrite Rplus_0_r in H8. - elim R1_neq_R0; symmetry in |- *; assumption. - cut (r = 0 \/ 0 < r < PI). - intro; elim H8; intro. - assumption. - elim H9; intros. - assert (H12 := sin_gt_0 _ H10 H11). - rewrite H7 in H12; elim (Rlt_irrefl _ H12). - rewrite Rabs_right in H4. - elim H4; intros. - case (Rtotal_order 0 r); intro. - right; split; assumption. - elim H10; intro. - left; symmetry in |- *; assumption. - elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H8 H11)). - apply Rle_ge. - left; apply PI_RGT_0. - apply sin_eq_0_1. - exists q; reflexivity. -Qed. - -Lemma cos_eq_0_0 : - forall x:R, cos x = 0 -> exists k : Z, x = IZR k * PI + PI / 2. -Proof. - intros x H; rewrite cos_sin in H; generalize (sin_eq_0_0 (PI / INR 2 + x) H); - intro H2; elim H2; intros x0 H3; exists (x0 - Z_of_nat 1)%Z; - rewrite <- Z_R_minus; simpl. -unfold INR in H3. field_simplify [(sym_eq H3)]. field. -(** - ring_simplify. - (* rewrite (Rmult_comm PI);*) (* old ring compat *) - rewrite <- H3; simpl; - field;repeat split; discrR. -*) -Qed. - -Lemma cos_eq_0_1 : - forall x:R, (exists k : Z, x = IZR k * PI + PI / 2) -> cos x = 0. -Proof. - intros x H1; rewrite cos_sin; elim H1; intros x0 H2; rewrite H2; - replace (PI / 2 + (IZR x0 * PI + PI / 2)) with (IZR x0 * PI + PI). - rewrite neg_sin; rewrite <- Ropp_0. - apply Ropp_eq_compat; apply sin_eq_0_1; exists x0; reflexivity. - pattern PI at 2 in |- *; rewrite (double_var PI); ring. -Qed. - -Lemma sin_eq_O_2PI_0 : - forall x:R, - 0 <= x -> x <= 2 * PI -> sin x = 0 -> x = 0 \/ x = PI \/ x = 2 * PI. -Proof. - intros; generalize (sin_eq_0_0 x H1); intro. - elim H2; intros k0 H3. - case (Rtotal_order PI x); intro. - rewrite H3 in H4; rewrite H3 in H0. - right; right. - generalize - (Rmult_lt_compat_r (/ PI) PI (IZR k0 * PI) (Rinv_0_lt_compat PI PI_RGT_0) H4); - rewrite Rmult_assoc; repeat rewrite <- Rinv_r_sym. - rewrite Rmult_1_r; intro; - generalize - (Rmult_le_compat_r (/ PI) (IZR k0 * PI) (2 * PI) - (Rlt_le 0 (/ PI) (Rinv_0_lt_compat PI PI_RGT_0)) H0); - repeat rewrite Rmult_assoc; repeat rewrite <- Rinv_r_sym. - repeat rewrite Rmult_1_r; intro; - generalize (Rplus_lt_compat_l (IZR (-2)) 1 (IZR k0) H5); - rewrite <- plus_IZR. - replace (IZR (-2) + 1) with (-1). - intro; generalize (Rplus_le_compat_l (IZR (-2)) (IZR k0) 2 H6); - rewrite <- plus_IZR. - replace (IZR (-2) + 2) with 0. - intro; cut (-1 < IZR (-2 + k0) < 1). - intro; generalize (one_IZR_lt1 (-2 + k0) H9); intro. - cut (k0 = 2%Z). - intro; rewrite H11 in H3; rewrite H3; simpl in |- *. - reflexivity. - rewrite <- (Zplus_opp_l 2) in H10; generalize (Zplus_reg_l (-2) k0 2 H10); - intro; assumption. - split. - assumption. - apply Rle_lt_trans with 0. - assumption. - apply Rlt_0_1. - simpl in |- *; ring. - simpl in |- *; ring. - apply PI_neq0. - apply PI_neq0. - elim H4; intro. - right; left. - symmetry in |- *; assumption. - left. - rewrite H3 in H5; rewrite H3 in H; - generalize - (Rmult_lt_compat_r (/ PI) (IZR k0 * PI) PI (Rinv_0_lt_compat PI PI_RGT_0) - H5); rewrite Rmult_assoc; repeat rewrite <- Rinv_r_sym. - rewrite Rmult_1_r; intro; - generalize - (Rmult_le_compat_r (/ PI) 0 (IZR k0 * PI) - (Rlt_le 0 (/ PI) (Rinv_0_lt_compat PI PI_RGT_0)) H); - repeat rewrite Rmult_assoc; repeat rewrite <- Rinv_r_sym. - rewrite Rmult_1_r; rewrite Rmult_0_l; intro. - cut (-1 < IZR k0 < 1). - intro; generalize (one_IZR_lt1 k0 H8); intro; rewrite H9 in H3; rewrite H3; - simpl in |- *; apply Rmult_0_l. - split. - apply Rlt_le_trans with 0. - rewrite <- Ropp_0; apply Ropp_gt_lt_contravar; apply Rlt_0_1. - assumption. - assumption. - apply PI_neq0. - apply PI_neq0. -Qed. - -Lemma sin_eq_O_2PI_1 : - forall x:R, - 0 <= x -> x <= 2 * PI -> x = 0 \/ x = PI \/ x = 2 * PI -> sin x = 0. -Proof. - intros x H1 H2 H3; elim H3; intro H4; - [ rewrite H4; rewrite sin_0; reflexivity - | elim H4; intro H5; - [ rewrite H5; rewrite sin_PI; reflexivity - | rewrite H5; rewrite sin_2PI; reflexivity ] ]. -Qed. - -Lemma cos_eq_0_2PI_0 : - forall x:R, - 0 <= x -> x <= 2 * PI -> cos x = 0 -> x = PI / 2 \/ x = 3 * (PI / 2). -Proof. - intros; case (Rtotal_order x (3 * (PI / 2))); intro. - rewrite cos_sin in H1. - cut (0 <= PI / 2 + x). - cut (PI / 2 + x <= 2 * PI). - intros; generalize (sin_eq_O_2PI_0 (PI / 2 + x) H4 H3 H1); intros. - decompose [or] H5. - generalize (Rplus_le_compat_l (PI / 2) 0 x H); rewrite Rplus_0_r; rewrite H6; - intro. - elim (Rlt_irrefl 0 (Rlt_le_trans 0 (PI / 2) 0 PI2_RGT_0 H7)). - left. - generalize (Rplus_eq_compat_l (- (PI / 2)) (PI / 2 + x) PI H7). - replace (- (PI / 2) + (PI / 2 + x)) with x. - replace (- (PI / 2) + PI) with (PI / 2). - intro; assumption. - pattern PI at 3 in |- *; rewrite (double_var PI); ring. - ring. - right. - generalize (Rplus_eq_compat_l (- (PI / 2)) (PI / 2 + x) (2 * PI) H7). - replace (- (PI / 2) + (PI / 2 + x)) with x. - replace (- (PI / 2) + 2 * PI) with (3 * (PI / 2)). - intro; assumption. - rewrite double; pattern PI at 3 4 in |- *; rewrite (double_var PI); ring. - ring. - left; replace (2 * PI) with (PI / 2 + 3 * (PI / 2)). - apply Rplus_lt_compat_l; assumption. - rewrite (double PI); pattern PI at 3 4 in |- *; rewrite (double_var PI); ring. - apply Rplus_le_le_0_compat. - left; unfold Rdiv in |- *; apply Rmult_lt_0_compat. - apply PI_RGT_0. - apply Rinv_0_lt_compat; prove_sup0. - assumption. - elim H2; intro. - right; assumption. - generalize (cos_eq_0_0 x H1); intro; elim H4; intros k0 H5. - rewrite H5 in H3; rewrite H5 in H0; - generalize - (Rplus_lt_compat_l (- (PI / 2)) (3 * (PI / 2)) (IZR k0 * PI + PI / 2) H3); - generalize - (Rplus_le_compat_l (- (PI / 2)) (IZR k0 * PI + PI / 2) (2 * PI) H0). - replace (- (PI / 2) + 3 * (PI / 2)) with PI. - replace (- (PI / 2) + (IZR k0 * PI + PI / 2)) with (IZR k0 * PI). - replace (- (PI / 2) + 2 * PI) with (3 * (PI / 2)). - intros; - generalize - (Rmult_lt_compat_l (/ PI) PI (IZR k0 * PI) (Rinv_0_lt_compat PI PI_RGT_0) - H7); - generalize - (Rmult_le_compat_l (/ PI) (IZR k0 * PI) (3 * (PI / 2)) - (Rlt_le 0 (/ PI) (Rinv_0_lt_compat PI PI_RGT_0)) H6). - replace (/ PI * (IZR k0 * PI)) with (IZR k0). - replace (/ PI * (3 * (PI / 2))) with (3 * / 2). - rewrite <- Rinv_l_sym. - intros; generalize (Rplus_lt_compat_l (IZR (-2)) 1 (IZR k0) H9); - rewrite <- plus_IZR. - replace (IZR (-2) + 1) with (-1). - intro; generalize (Rplus_le_compat_l (IZR (-2)) (IZR k0) (3 * / 2) H8); - rewrite <- plus_IZR. - replace (IZR (-2) + 2) with 0. - intro; cut (-1 < IZR (-2 + k0) < 1). - intro; generalize (one_IZR_lt1 (-2 + k0) H12); intro. - cut (k0 = 2%Z). - intro; rewrite H14 in H8. - assert (Hyp : 0 < 2). - prove_sup0. - generalize (Rmult_le_compat_l 2 (IZR 2) (3 * / 2) (Rlt_le 0 2 Hyp) H8); - simpl in |- *. - replace 4 with 4. - replace (2 * (3 * / 2)) with 3. - intro; cut (3 < 4). - intro; elim (Rlt_irrefl 3 (Rlt_le_trans 3 4 3 H16 H15)). - generalize (Rplus_lt_compat_l 3 0 1 Rlt_0_1); rewrite Rplus_0_r. - replace (3 + 1) with 4. - intro; assumption. - ring. - symmetry in |- *; rewrite <- Rmult_assoc; apply Rinv_r_simpl_m. - discrR. - ring. - rewrite <- (Zplus_opp_l 2) in H13; generalize (Zplus_reg_l (-2) k0 2 H13); - intro; assumption. - split. - assumption. - apply Rle_lt_trans with (IZR (-2) + 3 * / 2). - assumption. - simpl in |- *; replace (-2 + 3 * / 2) with (- (1 * / 2)). - apply Rlt_trans with 0. - rewrite <- Ropp_0; apply Ropp_lt_gt_contravar. - apply Rmult_lt_0_compat; - [ apply Rlt_0_1 | apply Rinv_0_lt_compat; prove_sup0 ]. - apply Rlt_0_1. - rewrite Rmult_1_l; apply Rmult_eq_reg_l with 2. - rewrite Ropp_mult_distr_r_reverse; rewrite <- Rinv_r_sym. - rewrite Rmult_plus_distr_l; rewrite <- Rmult_assoc; rewrite Rinv_r_simpl_m. - ring. - discrR. - discrR. - discrR. - simpl in |- *; ring. - simpl in |- *; ring. - apply PI_neq0. - unfold Rdiv in |- *; pattern 3 at 1 in |- *; rewrite (Rmult_comm 3); - repeat rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. - rewrite Rmult_1_l; apply Rmult_comm. - apply PI_neq0. - symmetry in |- *; rewrite (Rmult_comm (/ PI)); rewrite Rmult_assoc; - rewrite <- Rinv_r_sym. - apply Rmult_1_r. - apply PI_neq0. - rewrite double; pattern PI at 3 4 in |- *; rewrite double_var; ring. - ring. - pattern PI at 1 in |- *; rewrite double_var; ring. -Qed. - -Lemma cos_eq_0_2PI_1 : - forall x:R, - 0 <= x -> x <= 2 * PI -> x = PI / 2 \/ x = 3 * (PI / 2) -> cos x = 0. -Proof. - intros x H1 H2 H3; elim H3; intro H4; - [ rewrite H4; rewrite cos_PI2; reflexivity - | rewrite H4; rewrite cos_3PI2; reflexivity ]. -Qed. +Require Import Classical_Prop. +Require Import Fourier. +Require Import Ranalysis1. +Require Import Rsqrt_def. +Require Import PSeries_reg. +Require Export Rtrigo1. +Require Export Ratan. +Require Export Machin.
\ No newline at end of file diff --git a/theories/Reals/Rtrigo1.v b/theories/Reals/Rtrigo1.v new file mode 100644 index 00000000..6174ef32 --- /dev/null +++ b/theories/Reals/Rtrigo1.v @@ -0,0 +1,1933 @@ +(************************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) +(* \VV/ **************************************************************) +(* // * This file is distributed under the terms of the *) +(* * GNU Lesser General Public License Version 2.1 *) +(************************************************************************) + +Require Import Rbase. +Require Import Rfunctions. +Require Import SeqSeries. +Require Export Rtrigo_fun. +Require Export Rtrigo_def. +Require Export Rtrigo_alt. +Require Export Cos_rel. +Require Export Cos_plus. +Require Import ZArith_base. +Require Import Zcomplements. +Require Import Classical_Prop. +Require Import Fourier. +Require Import Ranalysis1. +Require Import Rsqrt_def. +Require Import PSeries_reg. + +Local Open Scope nat_scope. +Local Open Scope R_scope. + +Lemma CVN_R_cos : + forall fn:nat -> R -> R, + fn = (fun (N:nat) (x:R) => (-1) ^ N / INR (fact (2 * N)) * x ^ (2 * N)) -> + CVN_R fn. +Proof. + unfold CVN_R in |- *; intros. + cut ((r:R) <> 0). + intro hyp_r; unfold CVN_r in |- *. + exists (fun n:nat => / INR (fact (2 * n)) * r ^ (2 * n)). + cut + { l:R | + Un_cv + (fun n:nat => + sum_f_R0 (fun k:nat => Rabs (/ INR (fact (2 * k)) * r ^ (2 * k))) + n) l }. + intro X; elim X; intros. + exists x. + split. + apply p. + intros; rewrite H; unfold Rdiv in |- *; do 2 rewrite Rabs_mult. + rewrite pow_1_abs; rewrite Rmult_1_l. + cut (0 < / INR (fact (2 * n))). + intro; rewrite (Rabs_right _ (Rle_ge _ _ (Rlt_le _ _ H1))). + apply Rmult_le_compat_l. + left; apply H1. + rewrite <- RPow_abs; apply pow_maj_Rabs. + rewrite Rabs_Rabsolu. + unfold Boule in H0; rewrite Rminus_0_r in H0. + left; apply H0. + apply Rinv_0_lt_compat; apply INR_fact_lt_0. + apply Alembert_C2. + intro; apply Rabs_no_R0. + apply prod_neq_R0. + apply Rinv_neq_0_compat. + apply INR_fact_neq_0. + apply pow_nonzero; assumption. + assert (H0 := Alembert_cos). + unfold cos_n in H0; unfold Un_cv in H0; unfold Un_cv in |- *; intros. + cut (0 < eps / Rsqr r). + intro; elim (H0 _ H2); intros N0 H3. + exists N0; intros. + unfold R_dist in |- *; assert (H5 := H3 _ H4). + unfold R_dist in H5; + replace + (Rabs + (Rabs (/ INR (fact (2 * S n)) * r ^ (2 * S n)) / + Rabs (/ INR (fact (2 * n)) * r ^ (2 * n)))) with + (Rsqr r * + Rabs ((-1) ^ S n / INR (fact (2 * S n)) / ((-1) ^ n / INR (fact (2 * n))))). + apply Rmult_lt_reg_l with (/ Rsqr r). + apply Rinv_0_lt_compat; apply Rsqr_pos_lt; assumption. + pattern (/ Rsqr r) at 1 in |- *; replace (/ Rsqr r) with (Rabs (/ Rsqr r)). + rewrite <- Rabs_mult; rewrite Rmult_minus_distr_l; rewrite Rmult_0_r; + rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. + rewrite Rmult_1_l; rewrite <- (Rmult_comm eps); apply H5. + unfold Rsqr in |- *; apply prod_neq_R0; assumption. + rewrite Rabs_Rinv. + rewrite Rabs_right. + reflexivity. + apply Rle_ge; apply Rle_0_sqr. + unfold Rsqr in |- *; apply prod_neq_R0; assumption. + rewrite (Rmult_comm (Rsqr r)); unfold Rdiv in |- *; repeat rewrite Rabs_mult; + rewrite Rabs_Rabsolu; rewrite pow_1_abs; rewrite Rmult_1_l; + repeat rewrite Rmult_assoc; apply Rmult_eq_compat_l. + rewrite Rabs_Rinv. + rewrite Rabs_mult; rewrite (pow_1_abs n); rewrite Rmult_1_l; + rewrite <- Rabs_Rinv. + rewrite Rinv_involutive. + rewrite Rinv_mult_distr. + rewrite Rabs_Rinv. + rewrite Rinv_involutive. + rewrite (Rmult_comm (Rabs (Rabs (r ^ (2 * S n))))); rewrite Rabs_mult; + rewrite Rabs_Rabsolu; rewrite Rmult_assoc; apply Rmult_eq_compat_l. + rewrite Rabs_Rinv. + do 2 rewrite Rabs_Rabsolu; repeat rewrite Rabs_right. + replace (r ^ (2 * S n)) with (r ^ (2 * n) * r * r). + repeat rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. + unfold Rsqr in |- *; ring. + apply pow_nonzero; assumption. + replace (2 * S n)%nat with (S (S (2 * n))). + simpl in |- *; ring. + ring. + apply Rle_ge; apply pow_le; left; apply (cond_pos r). + apply Rle_ge; apply pow_le; left; apply (cond_pos r). + apply Rabs_no_R0; apply pow_nonzero; assumption. + apply Rabs_no_R0; apply INR_fact_neq_0. + apply INR_fact_neq_0. + apply Rabs_no_R0; apply Rinv_neq_0_compat; apply INR_fact_neq_0. + apply Rabs_no_R0; apply pow_nonzero; assumption. + apply INR_fact_neq_0. + apply Rinv_neq_0_compat; apply INR_fact_neq_0. + apply prod_neq_R0. + apply pow_nonzero; discrR. + apply Rinv_neq_0_compat; apply INR_fact_neq_0. + unfold Rdiv in |- *; apply Rmult_lt_0_compat. + apply H1. + apply Rinv_0_lt_compat; apply Rsqr_pos_lt; assumption. + assert (H0 := cond_pos r); red in |- *; intro; rewrite H1 in H0; + elim (Rlt_irrefl _ H0). +Qed. + +(**********) +Lemma continuity_cos : continuity cos. +Proof. + set (fn := fun (N:nat) (x:R) => (-1) ^ N / INR (fact (2 * N)) * x ^ (2 * N)). + cut (CVN_R fn). + intro; cut (forall x:R, { l:R | Un_cv (fun N:nat => SP fn N x) l }). + intro cv; cut (forall n:nat, continuity (fn n)). + intro; cut (forall x:R, cos x = SFL fn cv x). + intro; cut (continuity (SFL fn cv) -> continuity cos). + intro; apply H1. + apply SFL_continuity; assumption. + unfold continuity in |- *; unfold continuity_pt in |- *; + unfold continue_in in |- *; unfold limit1_in in |- *; + unfold limit_in in |- *; simpl in |- *; unfold R_dist in |- *; + intros. + elim (H1 x _ H2); intros. + exists x0; intros. + elim H3; intros. + split. + apply H4. + intros; rewrite (H0 x); rewrite (H0 x1); apply H5; apply H6. + intro; unfold cos, SFL in |- *. + case (cv x); case (exist_cos (Rsqr x)); intros. + symmetry in |- *; eapply UL_sequence. + apply u. + unfold cos_in in c; unfold infinite_sum in c; unfold Un_cv in |- *; intros. + elim (c _ H0); intros N0 H1. + exists N0; intros. + unfold R_dist in H1; unfold R_dist, SP in |- *. + replace (sum_f_R0 (fun k:nat => fn k x) n) with + (sum_f_R0 (fun i:nat => cos_n i * Rsqr x ^ i) n). + apply H1; assumption. + apply sum_eq; intros. + unfold cos_n, fn in |- *; apply Rmult_eq_compat_l. + unfold Rsqr in |- *; rewrite pow_sqr; reflexivity. + intro; unfold fn in |- *; + replace (fun x:R => (-1) ^ n / INR (fact (2 * n)) * x ^ (2 * n)) with + (fct_cte ((-1) ^ n / INR (fact (2 * n))) * pow_fct (2 * n))%F; + [ idtac | reflexivity ]. + apply continuity_mult. + apply derivable_continuous; apply derivable_const. + apply derivable_continuous; apply (derivable_pow (2 * n)). + apply CVN_R_CVS; apply X. + apply CVN_R_cos; unfold fn in |- *; reflexivity. +Qed. + +Lemma sin_gt_cos_7_8 : sin (7 / 8) > cos (7 / 8). +Proof. +assert (lo1 : 0 <= 7/8) by fourier. +assert (up1 : 7/8 <= 4) by fourier. +assert (lo : -2 <= 7/8) by fourier. +assert (up : 7/8 <= 2) by fourier. +destruct (pre_sin_bound _ 0 lo1 up1) as [lower _ ]. +destruct (pre_cos_bound _ 0 lo up) as [_ upper]. +apply Rle_lt_trans with (1 := upper). +apply Rlt_le_trans with (2 := lower). +unfold cos_approx, sin_approx. +simpl sum_f_R0; replace 7 with (IZR 7) by (simpl; field). +replace 8 with (IZR 8) by (simpl; field). +unfold cos_term, sin_term; simpl fact; rewrite !INR_IZR_INZ. +simpl plus; simpl mult. +field_simplify; + try (repeat apply conj; apply not_eq_sym, Rlt_not_eq, (IZR_lt 0); reflexivity). +unfold Rminus; rewrite !pow_IZR, <- !mult_IZR, <- !opp_IZR, <- ?plus_IZR. +match goal with + |- IZR ?a / ?b < ?c / ?d => + apply Rmult_lt_reg_r with d;[apply (IZR_lt 0); reflexivity | + unfold Rdiv at 2; rewrite Rmult_assoc, Rinv_l, Rmult_1_r, Rmult_comm; + [ |apply not_eq_sym, Rlt_not_eq, (IZR_lt 0); reflexivity ]]; + apply Rmult_lt_reg_r with b;[apply (IZR_lt 0); reflexivity | ] +end. +unfold Rdiv; rewrite !Rmult_assoc, Rinv_l, Rmult_1_r; + [ | apply not_eq_sym, Rlt_not_eq, (IZR_lt 0); reflexivity]. +repeat (rewrite <- !plus_IZR || rewrite <- !mult_IZR). +apply IZR_lt; reflexivity. +Qed. + +Definition PI_2_aux : {z | 7/8 <= z <= 7/4 /\ -cos z = 0}. +assert (cc : continuity (fun r =>- cos r)). + apply continuity_opp, continuity_cos. +assert (cvp : 0 < cos (7/8)). + assert (int78 : -2 <= 7/8 <= 2) by (split; fourier). + destruct int78 as [lower upper]. + case (pre_cos_bound _ 0 lower upper). + unfold cos_approx; simpl sum_f_R0; unfold cos_term. + intros cl _; apply Rlt_le_trans with (2 := cl); simpl. + fourier. +assert (cun : cos (7/4) < 0). + replace (7/4) with (7/8 + 7/8) by field. + rewrite cos_plus. + apply Rlt_minus; apply Rsqr_incrst_1. + exact sin_gt_cos_7_8. + apply Rlt_le; assumption. + apply Rlt_le; apply Rlt_trans with (1 := cvp); exact sin_gt_cos_7_8. +apply IVT; auto; fourier. +Qed. + +Definition PI2 := proj1_sig PI_2_aux. + +Definition PI := 2 * PI2. + +Lemma cos_pi2 : cos PI2 = 0. +unfold PI2; case PI_2_aux; simpl. +intros x [_ q]; rewrite <- (Ropp_involutive (cos x)), q; apply Ropp_0. +Qed. + +Lemma pi2_int : 7/8 <= PI2 <= 7/4. +unfold PI2; case PI_2_aux; simpl; tauto. +Qed. + +(**********) +Lemma cos_minus : forall x y:R, cos (x - y) = cos x * cos y + sin x * sin y. +Proof. + intros; unfold Rminus in |- *; rewrite cos_plus. + rewrite <- cos_sym; rewrite sin_antisym; ring. +Qed. + +(**********) +Lemma sin2_cos2 : forall x:R, Rsqr (sin x) + Rsqr (cos x) = 1. +Proof. + intro; unfold Rsqr in |- *; rewrite Rplus_comm; rewrite <- (cos_minus x x); + unfold Rminus in |- *; rewrite Rplus_opp_r; apply cos_0. +Qed. + +Lemma cos2 : forall x:R, Rsqr (cos x) = 1 - Rsqr (sin x). +Proof. + intros x; rewrite <- (sin2_cos2 x); ring. +Qed. + +Lemma sin2 : forall x:R, Rsqr (sin x) = 1 - Rsqr (cos x). +Proof. + intro x; generalize (cos2 x); intro H1; rewrite H1. + unfold Rminus in |- *; rewrite Ropp_plus_distr; rewrite <- Rplus_assoc; + rewrite Rplus_opp_r; rewrite Rplus_0_l; symmetry in |- *; + apply Ropp_involutive. +Qed. + +(**********) +Lemma cos_PI2 : cos (PI / 2) = 0. +Proof. + unfold PI; generalize cos_pi2; replace ((2 * PI2)/2) with PI2 by field; tauto. +Qed. + +Lemma sin_pos_tech : forall x, 0 < x < 2 -> 0 < sin x. +intros x [int1 int2]. +assert (lo : 0 <= x) by (apply Rlt_le; assumption). +assert (up : x <= 4) by (apply Rlt_le, Rlt_trans with (1:=int2); fourier). +destruct (pre_sin_bound _ 0 lo up) as [t _]; clear lo up. +apply Rlt_le_trans with (2:= t); clear t. +unfold sin_approx; simpl sum_f_R0; unfold sin_term; simpl. +match goal with |- _ < ?a => + replace a with (x * (1 - x^2/6)) by (simpl; field) +end. +assert (t' : x ^ 2 <= 4). + replace 4 with (2 ^ 2) by field. + apply (pow_incr x 2); split; apply Rlt_le; assumption. +apply Rmult_lt_0_compat;[assumption | fourier ]. +Qed. + +Lemma sin_PI2 : sin (PI / 2) = 1. +replace (PI / 2) with PI2 by (unfold PI; field). +assert (int' : 0 < PI2 < 2). + destruct pi2_int; split; fourier. +assert (lo2 := sin_pos_tech PI2 int'). +assert (t2 : Rabs (sin PI2) = 1). + rewrite <- Rabs_R1; apply Rsqr_eq_abs_0. + rewrite Rsqr_1, sin2, cos_pi2, Rsqr_0, Rminus_0_r; reflexivity. +revert t2; rewrite Rabs_pos_eq;[| apply Rlt_le]; tauto. +Qed. + +Lemma PI_RGT_0 : PI > 0. +Proof. unfold PI; destruct pi2_int; fourier. Qed. + +Lemma PI_4 : PI <= 4. +Proof. unfold PI; destruct pi2_int; fourier. Qed. + +(**********) +Lemma PI_neq0 : PI <> 0. +Proof. + red in |- *; intro; assert (H0 := PI_RGT_0); rewrite H in H0; + elim (Rlt_irrefl _ H0). +Qed. + + +(**********) +Lemma cos_PI : cos PI = -1. +Proof. + replace PI with (PI / 2 + PI / 2). + rewrite cos_plus. + rewrite sin_PI2; rewrite cos_PI2. + ring. + symmetry in |- *; apply double_var. +Qed. + +Lemma sin_PI : sin PI = 0. +Proof. + assert (H := sin2_cos2 PI). + rewrite cos_PI in H. + rewrite <- Rsqr_neg in H. + rewrite Rsqr_1 in H. + cut (Rsqr (sin PI) = 0). + intro; apply (Rsqr_eq_0 _ H0). + apply Rplus_eq_reg_l with 1. + rewrite Rplus_0_r; rewrite Rplus_comm; exact H. +Qed. + +Lemma sin_bound : forall (a : R) (n : nat), 0 <= a -> a <= PI -> + sin_approx a (2 * n + 1) <= sin a <= sin_approx a (2 * (n + 1)). +Proof. +intros a n a0 api; apply pre_sin_bound. + assumption. +apply Rle_trans with (1:= api) (2 := PI_4). +Qed. + +Lemma cos_bound : forall (a : R) (n : nat), - PI / 2 <= a -> a <= PI / 2 -> + cos_approx a (2 * n + 1) <= cos a <= cos_approx a (2 * (n + 1)). +Proof. +intros a n lower upper; apply pre_cos_bound. + apply Rle_trans with (2 := lower). + apply Rmult_le_reg_r with 2; [fourier |]. + replace ((-PI/2) * 2) with (-PI) by field. + assert (t := PI_4); fourier. +apply Rle_trans with (1 := upper). +apply Rmult_le_reg_r with 2; [fourier | ]. +replace ((PI/2) * 2) with PI by field. +generalize PI_4; intros; fourier. +Qed. +(**********) +Lemma neg_cos : forall x:R, cos (x + PI) = - cos x. +Proof. + intro x; rewrite cos_plus; rewrite sin_PI; rewrite cos_PI; ring. +Qed. + +(**********) +Lemma sin_cos : forall x:R, sin x = - cos (PI / 2 + x). +Proof. + intro x; rewrite cos_plus; rewrite sin_PI2; rewrite cos_PI2; ring. +Qed. + +(**********) +Lemma sin_plus : forall x y:R, sin (x + y) = sin x * cos y + cos x * sin y. +Proof. + intros. + rewrite (sin_cos (x + y)). + replace (PI / 2 + (x + y)) with (PI / 2 + x + y); [ rewrite cos_plus | ring ]. + rewrite (sin_cos (PI / 2 + x)). + replace (PI / 2 + (PI / 2 + x)) with (x + PI). + rewrite neg_cos. + replace (cos (PI / 2 + x)) with (- sin x). + ring. + rewrite sin_cos; rewrite Ropp_involutive; reflexivity. + pattern PI at 1 in |- *; rewrite (double_var PI); ring. +Qed. + +Lemma sin_minus : forall x y:R, sin (x - y) = sin x * cos y - cos x * sin y. +Proof. + intros; unfold Rminus in |- *; rewrite sin_plus. + rewrite <- cos_sym; rewrite sin_antisym; ring. +Qed. + +(**********) +Definition tan (x:R) : R := sin x / cos x. + +Lemma tan_plus : + forall x y:R, + cos x <> 0 -> + cos y <> 0 -> + cos (x + y) <> 0 -> + 1 - tan x * tan y <> 0 -> + tan (x + y) = (tan x + tan y) / (1 - tan x * tan y). +Proof. + intros; unfold tan in |- *; rewrite sin_plus; rewrite cos_plus; + unfold Rdiv in |- *; + replace (cos x * cos y - sin x * sin y) with + (cos x * cos y * (1 - sin x * / cos x * (sin y * / cos y))). + rewrite Rinv_mult_distr. + repeat rewrite <- Rmult_assoc; + replace ((sin x * cos y + cos x * sin y) * / (cos x * cos y)) with + (sin x * / cos x + sin y * / cos y). + reflexivity. + rewrite Rmult_plus_distr_r; rewrite Rinv_mult_distr. + repeat rewrite Rmult_assoc; repeat rewrite (Rmult_comm (sin x)); + repeat rewrite <- Rmult_assoc. + repeat rewrite Rinv_r_simpl_m; [ reflexivity | assumption | assumption ]. + assumption. + assumption. + apply prod_neq_R0; assumption. + assumption. + unfold Rminus in |- *; rewrite Rmult_plus_distr_l; rewrite Rmult_1_r; + apply Rplus_eq_compat_l; repeat rewrite Rmult_assoc; + rewrite (Rmult_comm (sin x)); rewrite (Rmult_comm (cos y)); + rewrite <- Ropp_mult_distr_r_reverse; repeat rewrite <- Rmult_assoc; + rewrite <- Rinv_r_sym. + rewrite Rmult_1_l; rewrite (Rmult_comm (sin x)); + rewrite <- Ropp_mult_distr_r_reverse; repeat rewrite Rmult_assoc; + apply Rmult_eq_compat_l; rewrite (Rmult_comm (/ cos y)); + rewrite Rmult_assoc; rewrite <- Rinv_r_sym. + apply Rmult_1_r. + assumption. + assumption. +Qed. + +(*******************************************************) +(** * Some properties of cos, sin and tan *) +(*******************************************************) + +Lemma sin_2a : forall x:R, sin (2 * x) = 2 * sin x * cos x. +Proof. + intro x; rewrite double; rewrite sin_plus. + rewrite <- (Rmult_comm (sin x)); symmetry in |- *; rewrite Rmult_assoc; + apply double. +Qed. + +Lemma cos_2a : forall x:R, cos (2 * x) = cos x * cos x - sin x * sin x. +Proof. + intro x; rewrite double; apply cos_plus. +Qed. + +Lemma cos_2a_cos : forall x:R, cos (2 * x) = 2 * cos x * cos x - 1. +Proof. + intro x; rewrite double; unfold Rminus in |- *; rewrite Rmult_assoc; + rewrite cos_plus; generalize (sin2_cos2 x); rewrite double; + intro H1; rewrite <- H1; ring_Rsqr. +Qed. + +Lemma cos_2a_sin : forall x:R, cos (2 * x) = 1 - 2 * sin x * sin x. +Proof. + intro x; rewrite Rmult_assoc; unfold Rminus in |- *; repeat rewrite double. + generalize (sin2_cos2 x); intro H1; rewrite <- H1; rewrite cos_plus; + ring_Rsqr. +Qed. + +Lemma tan_2a : + forall x:R, + cos x <> 0 -> + cos (2 * x) <> 0 -> + 1 - tan x * tan x <> 0 -> tan (2 * x) = 2 * tan x / (1 - tan x * tan x). +Proof. + repeat rewrite double; intros; repeat rewrite double; rewrite double in H0; + apply tan_plus; assumption. +Qed. + +Lemma sin_neg : forall x:R, sin (- x) = - sin x. +Proof. + apply sin_antisym. +Qed. + +Lemma cos_neg : forall x:R, cos (- x) = cos x. +Proof. + intro; symmetry in |- *; apply cos_sym. +Qed. + +Lemma tan_0 : tan 0 = 0. +Proof. + unfold tan in |- *; rewrite sin_0; rewrite cos_0. + unfold Rdiv in |- *; apply Rmult_0_l. +Qed. + +Lemma tan_neg : forall x:R, tan (- x) = - tan x. +Proof. + intros x; unfold tan in |- *; rewrite sin_neg; rewrite cos_neg; + unfold Rdiv in |- *. + apply Ropp_mult_distr_l_reverse. +Qed. + +Lemma tan_minus : + forall x y:R, + cos x <> 0 -> + cos y <> 0 -> + cos (x - y) <> 0 -> + 1 + tan x * tan y <> 0 -> + tan (x - y) = (tan x - tan y) / (1 + tan x * tan y). +Proof. + intros; unfold Rminus in |- *; rewrite tan_plus. + rewrite tan_neg; unfold Rminus in |- *; rewrite <- Ropp_mult_distr_l_reverse; + rewrite Rmult_opp_opp; reflexivity. + assumption. + rewrite cos_neg; assumption. + assumption. + rewrite tan_neg; unfold Rminus in |- *; rewrite <- Ropp_mult_distr_l_reverse; + rewrite Rmult_opp_opp; assumption. +Qed. + +Lemma cos_3PI2 : cos (3 * (PI / 2)) = 0. +Proof. + replace (3 * (PI / 2)) with (PI + PI / 2). + rewrite cos_plus; rewrite sin_PI; rewrite cos_PI2; ring. + pattern PI at 1 in |- *; rewrite (double_var PI). + ring. +Qed. + +Lemma sin_2PI : sin (2 * PI) = 0. +Proof. + rewrite sin_2a; rewrite sin_PI; ring. +Qed. + +Lemma cos_2PI : cos (2 * PI) = 1. +Proof. + rewrite cos_2a; rewrite sin_PI; rewrite cos_PI; ring. +Qed. + +Lemma neg_sin : forall x:R, sin (x + PI) = - sin x. +Proof. + intro x; rewrite sin_plus; rewrite sin_PI; rewrite cos_PI; ring. +Qed. + +Lemma sin_PI_x : forall x:R, sin (PI - x) = sin x. +Proof. + intro x; rewrite sin_minus; rewrite sin_PI; rewrite cos_PI; rewrite Rmult_0_l; + unfold Rminus in |- *; rewrite Rplus_0_l; rewrite Ropp_mult_distr_l_reverse; + rewrite Ropp_involutive; apply Rmult_1_l. +Qed. + +Lemma sin_period : forall (x:R) (k:nat), sin (x + 2 * INR k * PI) = sin x. +Proof. + intros x k; induction k as [| k Hreck]. + simpl in |- *; ring_simplify (x + 2 * 0 * PI). + trivial. + + replace (x + 2 * INR (S k) * PI) with (x + 2 * INR k * PI + 2 * PI). + rewrite sin_plus in |- *; rewrite sin_2PI in |- *; rewrite cos_2PI in |- *. + ring_simplify; trivial. + rewrite S_INR in |- *; ring. +Qed. + +Lemma cos_period : forall (x:R) (k:nat), cos (x + 2 * INR k * PI) = cos x. +Proof. + intros x k; induction k as [| k Hreck]. + simpl in |- *; ring_simplify (x + 2 * 0 * PI). + trivial. + + replace (x + 2 * INR (S k) * PI) with (x + 2 * INR k * PI + 2 * PI). + rewrite cos_plus in |- *; rewrite sin_2PI in |- *; rewrite cos_2PI in |- *. + ring_simplify; trivial. + rewrite S_INR in |- *; ring. +Qed. + +Lemma sin_shift : forall x:R, sin (PI / 2 - x) = cos x. +Proof. + intro x; rewrite sin_minus; rewrite sin_PI2; rewrite cos_PI2; ring. +Qed. + +Lemma cos_shift : forall x:R, cos (PI / 2 - x) = sin x. +Proof. + intro x; rewrite cos_minus; rewrite sin_PI2; rewrite cos_PI2; ring. +Qed. + +Lemma cos_sin : forall x:R, cos x = sin (PI / 2 + x). +Proof. + intro x; rewrite sin_plus; rewrite sin_PI2; rewrite cos_PI2; ring. +Qed. + +Lemma PI2_RGT_0 : 0 < PI / 2. +Proof. + unfold Rdiv in |- *; apply Rmult_lt_0_compat; + [ apply PI_RGT_0 | apply Rinv_0_lt_compat; prove_sup ]. +Qed. + +Lemma SIN_bound : forall x:R, -1 <= sin x <= 1. +Proof. + intro; case (Rle_dec (-1) (sin x)); intro. + case (Rle_dec (sin x) 1); intro. + split; assumption. + cut (1 < sin x). + intro; + generalize + (Rsqr_incrst_1 1 (sin x) H (Rlt_le 0 1 Rlt_0_1) + (Rlt_le 0 (sin x) (Rlt_trans 0 1 (sin x) Rlt_0_1 H))); + rewrite Rsqr_1; intro; rewrite sin2 in H0; unfold Rminus in H0; + generalize (Rplus_lt_compat_l (-1) 1 (1 + - Rsqr (cos x)) H0); + repeat rewrite <- Rplus_assoc; repeat rewrite Rplus_opp_l; + rewrite Rplus_0_l; intro; rewrite <- Ropp_0 in H1; + generalize (Ropp_lt_gt_contravar (-0) (- Rsqr (cos x)) H1); + repeat rewrite Ropp_involutive; intro; generalize (Rle_0_sqr (cos x)); + intro; elim (Rlt_irrefl 0 (Rle_lt_trans 0 (Rsqr (cos x)) 0 H3 H2)). + auto with real. + cut (sin x < -1). + intro; generalize (Ropp_lt_gt_contravar (sin x) (-1) H); + rewrite Ropp_involutive; clear H; intro; + generalize + (Rsqr_incrst_1 1 (- sin x) H (Rlt_le 0 1 Rlt_0_1) + (Rlt_le 0 (- sin x) (Rlt_trans 0 1 (- sin x) Rlt_0_1 H))); + rewrite Rsqr_1; intro; rewrite <- Rsqr_neg in H0; + rewrite sin2 in H0; unfold Rminus in H0; + generalize (Rplus_lt_compat_l (-1) 1 (1 + - Rsqr (cos x)) H0); + repeat rewrite <- Rplus_assoc; repeat rewrite Rplus_opp_l; + rewrite Rplus_0_l; intro; rewrite <- Ropp_0 in H1; + generalize (Ropp_lt_gt_contravar (-0) (- Rsqr (cos x)) H1); + repeat rewrite Ropp_involutive; intro; generalize (Rle_0_sqr (cos x)); + intro; elim (Rlt_irrefl 0 (Rle_lt_trans 0 (Rsqr (cos x)) 0 H3 H2)). + auto with real. +Qed. + +Lemma COS_bound : forall x:R, -1 <= cos x <= 1. +Proof. + intro; rewrite <- sin_shift; apply SIN_bound. +Qed. + +Lemma cos_sin_0 : forall x:R, ~ (cos x = 0 /\ sin x = 0). +Proof. + intro; red in |- *; intro; elim H; intros; generalize (sin2_cos2 x); intro; + rewrite H0 in H2; rewrite H1 in H2; repeat rewrite Rsqr_0 in H2; + rewrite Rplus_0_r in H2; generalize Rlt_0_1; intro; + rewrite <- H2 in H3; elim (Rlt_irrefl 0 H3). +Qed. + +Lemma cos_sin_0_var : forall x:R, cos x <> 0 \/ sin x <> 0. +Proof. + intros x. + destruct (Req_dec (cos x) 0). 2: now left. + right. intros H'. + apply (cos_sin_0 x). + now split. +Qed. + +(*****************************************************************) +(** * Using series definitions of cos and sin *) +(*****************************************************************) + +Definition sin_lb (a:R) : R := sin_approx a 3. +Definition sin_ub (a:R) : R := sin_approx a 4. +Definition cos_lb (a:R) : R := cos_approx a 3. +Definition cos_ub (a:R) : R := cos_approx a 4. + +Lemma sin_lb_gt_0 : forall a:R, 0 < a -> a <= PI / 2 -> 0 < sin_lb a. +Proof. + intros. + unfold sin_lb in |- *; unfold sin_approx in |- *; unfold sin_term in |- *. + set (Un := fun i:nat => a ^ (2 * i + 1) / INR (fact (2 * i + 1))). + replace + (sum_f_R0 + (fun i:nat => (-1) ^ i * (a ^ (2 * i + 1) / INR (fact (2 * i + 1)))) 3) + with (sum_f_R0 (fun i:nat => (-1) ^ i * Un i) 3); + [ idtac | apply sum_eq; intros; unfold Un in |- *; reflexivity ]. + cut (forall n:nat, Un (S n) < Un n). + intro; simpl in |- *. + repeat rewrite Rmult_1_l; repeat rewrite Rmult_1_r; + replace (-1 * Un 1%nat) with (- Un 1%nat); [ idtac | ring ]; + replace (-1 * -1 * Un 2%nat) with (Un 2%nat); [ idtac | ring ]; + replace (-1 * (-1 * -1) * Un 3%nat) with (- Un 3%nat); + [ idtac | ring ]; + replace (Un 0%nat + - Un 1%nat + Un 2%nat + - Un 3%nat) with + (Un 0%nat - Un 1%nat + (Un 2%nat - Un 3%nat)); [ idtac | ring ]. + apply Rplus_lt_0_compat. + unfold Rminus in |- *; apply Rplus_lt_reg_r with (Un 1%nat); + rewrite Rplus_0_r; rewrite (Rplus_comm (Un 1%nat)); + rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; + apply H1. + unfold Rminus in |- *; apply Rplus_lt_reg_r with (Un 3%nat); + rewrite Rplus_0_r; rewrite (Rplus_comm (Un 3%nat)); + rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; + apply H1. + intro; unfold Un in |- *. + cut ((2 * S n + 1)%nat = (2 * n + 1 + 2)%nat). + intro; rewrite H1. + rewrite pow_add; unfold Rdiv in |- *; rewrite Rmult_assoc; + apply Rmult_lt_compat_l. + apply pow_lt; assumption. + rewrite <- H1; apply Rmult_lt_reg_l with (INR (fact (2 * n + 1))). + apply lt_INR_0; apply neq_O_lt. + assert (H2 := fact_neq_0 (2 * n + 1)). + red in |- *; intro; elim H2; symmetry in |- *; assumption. + rewrite <- Rinv_r_sym. + apply Rmult_lt_reg_l with (INR (fact (2 * S n + 1))). + apply lt_INR_0; apply neq_O_lt. + assert (H2 := fact_neq_0 (2 * S n + 1)). + red in |- *; intro; elim H2; symmetry in |- *; assumption. + rewrite (Rmult_comm (INR (fact (2 * S n + 1)))); repeat rewrite Rmult_assoc; + rewrite <- Rinv_l_sym. + do 2 rewrite Rmult_1_r; apply Rle_lt_trans with (INR (fact (2 * n + 1)) * 4). + apply Rmult_le_compat_l. + replace 0 with (INR 0); [ idtac | reflexivity ]; apply le_INR; apply le_O_n. + simpl in |- *; rewrite Rmult_1_r; replace 4 with (Rsqr 2); + [ idtac | ring_Rsqr ]; replace (a * a) with (Rsqr a); + [ idtac | reflexivity ]; apply Rsqr_incr_1. + apply Rle_trans with (PI / 2); + [ assumption + | unfold Rdiv in |- *; apply Rmult_le_reg_l with 2; + [ prove_sup0 + | rewrite <- Rmult_assoc; rewrite Rinv_r_simpl_m; + [ replace 4 with 4; [ apply PI_4 | ring ] | discrR ] ] ]. + left; assumption. + left; prove_sup0. + rewrite H1; replace (2 * n + 1 + 2)%nat with (S (S (2 * n + 1))). + do 2 rewrite fact_simpl; do 2 rewrite mult_INR. + repeat rewrite <- Rmult_assoc. + rewrite <- (Rmult_comm (INR (fact (2 * n + 1)))). + rewrite Rmult_assoc. + apply Rmult_lt_compat_l. + apply lt_INR_0; apply neq_O_lt. + assert (H2 := fact_neq_0 (2 * n + 1)). + red in |- *; intro; elim H2; symmetry in |- *; assumption. + do 2 rewrite S_INR; rewrite plus_INR; rewrite mult_INR; set (x := INR n); + unfold INR in |- *. + replace ((2 * x + 1 + 1 + 1) * (2 * x + 1 + 1)) with (4 * x * x + 10 * x + 6); + [ idtac | ring ]. + apply Rplus_lt_reg_r with (-4); rewrite Rplus_opp_l; + replace (-4 + (4 * x * x + 10 * x + 6)) with (4 * x * x + 10 * x + 2); + [ idtac | ring ]. + apply Rplus_le_lt_0_compat. + cut (0 <= x). + intro; apply Rplus_le_le_0_compat; repeat apply Rmult_le_pos; + assumption || left; prove_sup. + unfold x in |- *; replace 0 with (INR 0); + [ apply le_INR; apply le_O_n | reflexivity ]. + prove_sup0. + ring. + apply INR_fact_neq_0. + apply INR_fact_neq_0. + ring. +Qed. + +Lemma SIN : forall a:R, 0 <= a -> a <= PI -> sin_lb a <= sin a <= sin_ub a. + intros; unfold sin_lb, sin_ub in |- *; apply (sin_bound a 1 H H0). +Qed. + +Lemma COS : + forall a:R, - PI / 2 <= a -> a <= PI / 2 -> cos_lb a <= cos a <= cos_ub a. + intros; unfold cos_lb, cos_ub in |- *; apply (cos_bound a 1 H H0). +Qed. + +(**********) +Lemma _PI2_RLT_0 : - (PI / 2) < 0. +Proof. + rewrite <- Ropp_0; apply Ropp_lt_contravar; apply PI2_RGT_0. +Qed. + +Lemma PI4_RLT_PI2 : PI / 4 < PI / 2. +Proof. + unfold Rdiv in |- *; apply Rmult_lt_compat_l. + apply PI_RGT_0. + apply Rinv_lt_contravar. + apply Rmult_lt_0_compat; prove_sup0. + pattern 2 at 1 in |- *; rewrite <- Rplus_0_r. + replace 4 with (2 + 2); [ apply Rplus_lt_compat_l; prove_sup0 | ring ]. +Qed. + +Lemma PI2_Rlt_PI : PI / 2 < PI. +Proof. + unfold Rdiv in |- *; pattern PI at 2 in |- *; rewrite <- Rmult_1_r. + apply Rmult_lt_compat_l. + apply PI_RGT_0. + pattern 1 at 3 in |- *; rewrite <- Rinv_1; apply Rinv_lt_contravar. + rewrite Rmult_1_l; prove_sup0. + pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; + apply Rlt_0_1. +Qed. + +(***************************************************) +(** * Increasing and decreasing of [cos] and [sin] *) +(***************************************************) +Theorem sin_gt_0 : forall x:R, 0 < x -> x < PI -> 0 < sin x. +Proof. + intros; elim (SIN x (Rlt_le 0 x H) (Rlt_le x PI H0)); intros H1 _; + case (Rtotal_order x (PI / 2)); intro H2. + apply Rlt_le_trans with (sin_lb x). + apply sin_lb_gt_0; [ assumption | left; assumption ]. + assumption. + elim H2; intro H3. + rewrite H3; rewrite sin_PI2; apply Rlt_0_1. + rewrite <- sin_PI_x; generalize (Ropp_gt_lt_contravar x (PI / 2) H3); + intro H4; generalize (Rplus_lt_compat_l PI (- x) (- (PI / 2)) H4). + replace (PI + - x) with (PI - x). + replace (PI + - (PI / 2)) with (PI / 2). + intro H5; generalize (Ropp_lt_gt_contravar x PI H0); intro H6; + change (- PI < - x) in H6; generalize (Rplus_lt_compat_l PI (- PI) (- x) H6). + rewrite Rplus_opp_r. + replace (PI + - x) with (PI - x). + intro H7; + elim + (SIN (PI - x) (Rlt_le 0 (PI - x) H7) + (Rlt_le (PI - x) PI (Rlt_trans (PI - x) (PI / 2) PI H5 PI2_Rlt_PI))); + intros H8 _; + generalize (sin_lb_gt_0 (PI - x) H7 (Rlt_le (PI - x) (PI / 2) H5)); + intro H9; apply (Rlt_le_trans 0 (sin_lb (PI - x)) (sin (PI - x)) H9 H8). + reflexivity. + pattern PI at 2 in |- *; rewrite double_var; ring. + reflexivity. +Qed. + +Theorem cos_gt_0 : forall x:R, - (PI / 2) < x -> x < PI / 2 -> 0 < cos x. +Proof. + intros; rewrite cos_sin; + generalize (Rplus_lt_compat_l (PI / 2) (- (PI / 2)) x H). + rewrite Rplus_opp_r; intro H1; + generalize (Rplus_lt_compat_l (PI / 2) x (PI / 2) H0); + rewrite <- double_var; intro H2; apply (sin_gt_0 (PI / 2 + x) H1 H2). +Qed. + +Lemma sin_ge_0 : forall x:R, 0 <= x -> x <= PI -> 0 <= sin x. +Proof. + intros x H1 H2; elim H1; intro H3; + [ elim H2; intro H4; + [ left; apply (sin_gt_0 x H3 H4) + | rewrite H4; right; symmetry in |- *; apply sin_PI ] + | rewrite <- H3; right; symmetry in |- *; apply sin_0 ]. +Qed. + +Lemma cos_ge_0 : forall x:R, - (PI / 2) <= x -> x <= PI / 2 -> 0 <= cos x. +Proof. + intros x H1 H2; elim H1; intro H3; + [ elim H2; intro H4; + [ left; apply (cos_gt_0 x H3 H4) + | rewrite H4; right; symmetry in |- *; apply cos_PI2 ] + | rewrite <- H3; rewrite cos_neg; right; symmetry in |- *; apply cos_PI2 ]. +Qed. + +Lemma sin_le_0 : forall x:R, PI <= x -> x <= 2 * PI -> sin x <= 0. +Proof. + intros x H1 H2; apply Rge_le; rewrite <- Ropp_0; + rewrite <- (Ropp_involutive (sin x)); apply Ropp_le_ge_contravar; + rewrite <- neg_sin; replace (x + PI) with (x - PI + 2 * INR 1 * PI); + [ rewrite (sin_period (x - PI) 1); apply sin_ge_0; + [ replace (x - PI) with (x + - PI); + [ rewrite Rplus_comm; replace 0 with (- PI + PI); + [ apply Rplus_le_compat_l; assumption | ring ] + | ring ] + | replace (x - PI) with (x + - PI); rewrite Rplus_comm; + [ pattern PI at 2 in |- *; replace PI with (- PI + 2 * PI); + [ apply Rplus_le_compat_l; assumption | ring ] + | ring ] ] + | unfold INR in |- *; ring ]. +Qed. + +Lemma cos_le_0 : forall x:R, PI / 2 <= x -> x <= 3 * (PI / 2) -> cos x <= 0. +Proof. + intros x H1 H2; apply Rge_le; rewrite <- Ropp_0; + rewrite <- (Ropp_involutive (cos x)); apply Ropp_le_ge_contravar; + rewrite <- neg_cos; replace (x + PI) with (x - PI + 2 * INR 1 * PI). + rewrite cos_period; apply cos_ge_0. + replace (- (PI / 2)) with (- PI + PI / 2). + unfold Rminus in |- *; rewrite (Rplus_comm x); apply Rplus_le_compat_l; + assumption. + pattern PI at 1 in |- *; rewrite (double_var PI); rewrite Ropp_plus_distr; + ring. + unfold Rminus in |- *; rewrite Rplus_comm; + replace (PI / 2) with (- PI + 3 * (PI / 2)). + apply Rplus_le_compat_l; assumption. + pattern PI at 1 in |- *; rewrite (double_var PI); rewrite Ropp_plus_distr; + ring. + unfold INR in |- *; ring. +Qed. + +Lemma sin_lt_0 : forall x:R, PI < x -> x < 2 * PI -> sin x < 0. +Proof. + intros x H1 H2; rewrite <- Ropp_0; rewrite <- (Ropp_involutive (sin x)); + apply Ropp_lt_gt_contravar; rewrite <- neg_sin; + replace (x + PI) with (x - PI + 2 * INR 1 * PI); + [ rewrite (sin_period (x - PI) 1); apply sin_gt_0; + [ replace (x - PI) with (x + - PI); + [ rewrite Rplus_comm; replace 0 with (- PI + PI); + [ apply Rplus_lt_compat_l; assumption | ring ] + | ring ] + | replace (x - PI) with (x + - PI); rewrite Rplus_comm; + [ pattern PI at 2 in |- *; replace PI with (- PI + 2 * PI); + [ apply Rplus_lt_compat_l; assumption | ring ] + | ring ] ] + | unfold INR in |- *; ring ]. +Qed. + +Lemma sin_lt_0_var : forall x:R, - PI < x -> x < 0 -> sin x < 0. +Proof. + intros; generalize (Rplus_lt_compat_l (2 * PI) (- PI) x H); + replace (2 * PI + - PI) with PI; + [ intro H1; rewrite Rplus_comm in H1; + generalize (Rplus_lt_compat_l (2 * PI) x 0 H0); + intro H2; rewrite (Rplus_comm (2 * PI)) in H2; + rewrite <- (Rplus_comm 0) in H2; rewrite Rplus_0_l in H2; + rewrite <- (sin_period x 1); unfold INR in |- *; + replace (2 * 1 * PI) with (2 * PI); + [ apply (sin_lt_0 (x + 2 * PI) H1 H2) | ring ] + | ring ]. +Qed. + +Lemma cos_lt_0 : forall x:R, PI / 2 < x -> x < 3 * (PI / 2) -> cos x < 0. +Proof. + intros x H1 H2; rewrite <- Ropp_0; rewrite <- (Ropp_involutive (cos x)); + apply Ropp_lt_gt_contravar; rewrite <- neg_cos; + replace (x + PI) with (x - PI + 2 * INR 1 * PI). + rewrite cos_period; apply cos_gt_0. + replace (- (PI / 2)) with (- PI + PI / 2). + unfold Rminus in |- *; rewrite (Rplus_comm x); apply Rplus_lt_compat_l; + assumption. + pattern PI at 1 in |- *; rewrite (double_var PI); rewrite Ropp_plus_distr; + ring. + unfold Rminus in |- *; rewrite Rplus_comm; + replace (PI / 2) with (- PI + 3 * (PI / 2)). + apply Rplus_lt_compat_l; assumption. + pattern PI at 1 in |- *; rewrite (double_var PI); rewrite Ropp_plus_distr; + ring. + unfold INR in |- *; ring. +Qed. + +Lemma tan_gt_0 : forall x:R, 0 < x -> x < PI / 2 -> 0 < tan x. +Proof. + intros x H1 H2; unfold tan in |- *; generalize _PI2_RLT_0; + generalize (Rlt_trans 0 x (PI / 2) H1 H2); intros; + generalize (Rlt_trans (- (PI / 2)) 0 x H0 H1); intro H5; + generalize (Rlt_trans x (PI / 2) PI H2 PI2_Rlt_PI); + intro H7; unfold Rdiv in |- *; apply Rmult_lt_0_compat. + apply sin_gt_0; assumption. + apply Rinv_0_lt_compat; apply cos_gt_0; assumption. +Qed. + +Lemma tan_lt_0 : forall x:R, - (PI / 2) < x -> x < 0 -> tan x < 0. +Proof. + intros x H1 H2; unfold tan in |- *; + generalize (cos_gt_0 x H1 (Rlt_trans x 0 (PI / 2) H2 PI2_RGT_0)); + intro H3; rewrite <- Ropp_0; + replace (sin x / cos x) with (- (- sin x / cos x)). + rewrite <- sin_neg; apply Ropp_gt_lt_contravar; + change (0 < sin (- x) / cos x) in |- *; unfold Rdiv in |- *; + apply Rmult_lt_0_compat. + apply sin_gt_0. + rewrite <- Ropp_0; apply Ropp_gt_lt_contravar; assumption. + apply Rlt_trans with (PI / 2). + rewrite <- (Ropp_involutive (PI / 2)); apply Ropp_gt_lt_contravar; assumption. + apply PI2_Rlt_PI. + apply Rinv_0_lt_compat; assumption. + unfold Rdiv in |- *; ring. +Qed. + +Lemma cos_ge_0_3PI2 : + forall x:R, 3 * (PI / 2) <= x -> x <= 2 * PI -> 0 <= cos x. +Proof. + intros; rewrite <- cos_neg; rewrite <- (cos_period (- x) 1); + unfold INR in |- *; replace (- x + 2 * 1 * PI) with (2 * PI - x). + generalize (Ropp_le_ge_contravar x (2 * PI) H0); intro H1; + generalize (Rge_le (- x) (- (2 * PI)) H1); clear H1; + intro H1; generalize (Rplus_le_compat_l (2 * PI) (- (2 * PI)) (- x) H1). + rewrite Rplus_opp_r. + intro H2; generalize (Ropp_le_ge_contravar (3 * (PI / 2)) x H); intro H3; + generalize (Rge_le (- (3 * (PI / 2))) (- x) H3); clear H3; + intro H3; + generalize (Rplus_le_compat_l (2 * PI) (- x) (- (3 * (PI / 2))) H3). + replace (2 * PI + - (3 * (PI / 2))) with (PI / 2). + intro H4; + apply + (cos_ge_0 (2 * PI - x) + (Rlt_le (- (PI / 2)) (2 * PI - x) + (Rlt_le_trans (- (PI / 2)) 0 (2 * PI - x) _PI2_RLT_0 H2)) H4). + rewrite double; pattern PI at 2 3 in |- *; rewrite double_var; ring. + ring. +Qed. + +Lemma form1 : + forall p q:R, cos p + cos q = 2 * cos ((p - q) / 2) * cos ((p + q) / 2). +Proof. + intros p q; pattern p at 1 in |- *; + replace p with ((p - q) / 2 + (p + q) / 2). + rewrite <- (cos_neg q); replace (- q) with ((p - q) / 2 - (p + q) / 2). + rewrite cos_plus; rewrite cos_minus; ring. + pattern q at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. + pattern p at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. +Qed. + +Lemma form2 : + forall p q:R, cos p - cos q = -2 * sin ((p - q) / 2) * sin ((p + q) / 2). +Proof. + intros p q; pattern p at 1 in |- *; + replace p with ((p - q) / 2 + (p + q) / 2). + rewrite <- (cos_neg q); replace (- q) with ((p - q) / 2 - (p + q) / 2). + rewrite cos_plus; rewrite cos_minus; ring. + pattern q at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. + pattern p at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. +Qed. + +Lemma form3 : + forall p q:R, sin p + sin q = 2 * cos ((p - q) / 2) * sin ((p + q) / 2). +Proof. + intros p q; pattern p at 1 in |- *; + replace p with ((p - q) / 2 + (p + q) / 2). + pattern q at 3 in |- *; replace q with ((p + q) / 2 - (p - q) / 2). + rewrite sin_plus; rewrite sin_minus; ring. + pattern q at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. + pattern p at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. +Qed. + +Lemma form4 : + forall p q:R, sin p - sin q = 2 * cos ((p + q) / 2) * sin ((p - q) / 2). +Proof. + intros p q; pattern p at 1 in |- *; + replace p with ((p - q) / 2 + (p + q) / 2). + pattern q at 3 in |- *; replace q with ((p + q) / 2 - (p - q) / 2). + rewrite sin_plus; rewrite sin_minus; ring. + pattern q at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. + pattern p at 3 in |- *; rewrite double_var; unfold Rdiv in |- *; ring. + +Qed. + +Lemma sin_increasing_0 : + forall x y:R, + - (PI / 2) <= x -> + x <= PI / 2 -> - (PI / 2) <= y -> y <= PI / 2 -> sin x < sin y -> x < y. +Proof. + intros; cut (sin ((x - y) / 2) < 0). + intro H4; case (Rtotal_order ((x - y) / 2) 0); intro H5. + assert (Hyp : 0 < 2). + prove_sup0. + generalize (Rmult_lt_compat_l 2 ((x - y) / 2) 0 Hyp H5). + unfold Rdiv in |- *. + rewrite <- Rmult_assoc. + rewrite Rinv_r_simpl_m. + rewrite Rmult_0_r. + clear H5; intro H5; apply Rminus_lt; assumption. + discrR. + elim H5; intro H6. + rewrite H6 in H4; rewrite sin_0 in H4; elim (Rlt_irrefl 0 H4). + change (0 < (x - y) / 2) in H6; + generalize (Ropp_le_ge_contravar (- (PI / 2)) y H1). + rewrite Ropp_involutive. + intro H7; generalize (Rge_le (PI / 2) (- y) H7); clear H7; intro H7; + generalize (Rplus_le_compat x (PI / 2) (- y) (PI / 2) H0 H7). + rewrite <- double_var. + intro H8. + assert (Hyp : 0 < 2). + prove_sup0. + generalize + (Rmult_le_compat_l (/ 2) (x - y) PI + (Rlt_le 0 (/ 2) (Rinv_0_lt_compat 2 Hyp)) H8). + repeat rewrite (Rmult_comm (/ 2)). + intro H9; + generalize + (sin_gt_0 ((x - y) / 2) H6 + (Rle_lt_trans ((x - y) / 2) (PI / 2) PI H9 PI2_Rlt_PI)); + intro H10; + elim + (Rlt_irrefl (sin ((x - y) / 2)) + (Rlt_trans (sin ((x - y) / 2)) 0 (sin ((x - y) / 2)) H4 H10)). + generalize (Rlt_minus (sin x) (sin y) H3); clear H3; intro H3; + rewrite form4 in H3; + generalize (Rplus_le_compat x (PI / 2) y (PI / 2) H0 H2). + rewrite <- double_var. + assert (Hyp : 0 < 2). + prove_sup0. + intro H4; + generalize + (Rmult_le_compat_l (/ 2) (x + y) PI + (Rlt_le 0 (/ 2) (Rinv_0_lt_compat 2 Hyp)) H4). + repeat rewrite (Rmult_comm (/ 2)). + clear H4; intro H4; + generalize (Rplus_le_compat (- (PI / 2)) x (- (PI / 2)) y H H1); + replace (- (PI / 2) + - (PI / 2)) with (- PI). + intro H5; + generalize + (Rmult_le_compat_l (/ 2) (- PI) (x + y) + (Rlt_le 0 (/ 2) (Rinv_0_lt_compat 2 Hyp)) H5). + replace (/ 2 * (x + y)) with ((x + y) / 2). + replace (/ 2 * - PI) with (- (PI / 2)). + clear H5; intro H5; elim H4; intro H40. + elim H5; intro H50. + generalize (cos_gt_0 ((x + y) / 2) H50 H40); intro H6; + generalize (Rmult_lt_compat_l 2 0 (cos ((x + y) / 2)) Hyp H6). + rewrite Rmult_0_r. + clear H6; intro H6; case (Rcase_abs (sin ((x - y) / 2))); intro H7. + assumption. + generalize (Rge_le (sin ((x - y) / 2)) 0 H7); clear H7; intro H7; + generalize + (Rmult_le_pos (2 * cos ((x + y) / 2)) (sin ((x - y) / 2)) + (Rlt_le 0 (2 * cos ((x + y) / 2)) H6) H7); intro H8; + generalize + (Rle_lt_trans 0 (2 * cos ((x + y) / 2) * sin ((x - y) / 2)) 0 H8 H3); + intro H9; elim (Rlt_irrefl 0 H9). + rewrite <- H50 in H3; rewrite cos_neg in H3; rewrite cos_PI2 in H3; + rewrite Rmult_0_r in H3; rewrite Rmult_0_l in H3; + elim (Rlt_irrefl 0 H3). + unfold Rdiv in H3. + rewrite H40 in H3; assert (H50 := cos_PI2); unfold Rdiv in H50; + rewrite H50 in H3; rewrite Rmult_0_r in H3; rewrite Rmult_0_l in H3; + elim (Rlt_irrefl 0 H3). + unfold Rdiv in |- *. + rewrite <- Ropp_mult_distr_l_reverse. + apply Rmult_comm. + unfold Rdiv in |- *; apply Rmult_comm. + pattern PI at 1 in |- *; rewrite double_var. + rewrite Ropp_plus_distr. + reflexivity. +Qed. + +Lemma sin_increasing_1 : + forall x y:R, + - (PI / 2) <= x -> + x <= PI / 2 -> - (PI / 2) <= y -> y <= PI / 2 -> x < y -> sin x < sin y. +Proof. + intros; generalize (Rplus_lt_compat_l x x y H3); intro H4; + generalize (Rplus_le_compat (- (PI / 2)) x (- (PI / 2)) x H H); + replace (- (PI / 2) + - (PI / 2)) with (- PI). + assert (Hyp : 0 < 2). + prove_sup0. + intro H5; generalize (Rle_lt_trans (- PI) (x + x) (x + y) H5 H4); intro H6; + generalize + (Rmult_lt_compat_l (/ 2) (- PI) (x + y) (Rinv_0_lt_compat 2 Hyp) H6); + replace (/ 2 * - PI) with (- (PI / 2)). + replace (/ 2 * (x + y)) with ((x + y) / 2). + clear H4 H5 H6; intro H4; generalize (Rplus_lt_compat_l y x y H3); intro H5; + rewrite Rplus_comm in H5; + generalize (Rplus_le_compat y (PI / 2) y (PI / 2) H2 H2). + rewrite <- double_var. + intro H6; generalize (Rlt_le_trans (x + y) (y + y) PI H5 H6); intro H7; + generalize (Rmult_lt_compat_l (/ 2) (x + y) PI (Rinv_0_lt_compat 2 Hyp) H7); + replace (/ 2 * PI) with (PI / 2). + replace (/ 2 * (x + y)) with ((x + y) / 2). + clear H5 H6 H7; intro H5; generalize (Ropp_le_ge_contravar (- (PI / 2)) y H1); + rewrite Ropp_involutive; clear H1; intro H1; + generalize (Rge_le (PI / 2) (- y) H1); clear H1; intro H1; + generalize (Ropp_le_ge_contravar y (PI / 2) H2); clear H2; + intro H2; generalize (Rge_le (- y) (- (PI / 2)) H2); + clear H2; intro H2; generalize (Rplus_lt_compat_l (- y) x y H3); + replace (- y + x) with (x - y). + rewrite Rplus_opp_l. + intro H6; + generalize (Rmult_lt_compat_l (/ 2) (x - y) 0 (Rinv_0_lt_compat 2 Hyp) H6); + rewrite Rmult_0_r; replace (/ 2 * (x - y)) with ((x - y) / 2). + clear H6; intro H6; + generalize (Rplus_le_compat (- (PI / 2)) x (- (PI / 2)) (- y) H H2); + replace (- (PI / 2) + - (PI / 2)) with (- PI). + replace (x + - y) with (x - y). + intro H7; + generalize + (Rmult_le_compat_l (/ 2) (- PI) (x - y) + (Rlt_le 0 (/ 2) (Rinv_0_lt_compat 2 Hyp)) H7); + replace (/ 2 * - PI) with (- (PI / 2)). + replace (/ 2 * (x - y)) with ((x - y) / 2). + clear H7; intro H7; clear H H0 H1 H2; apply Rminus_lt; rewrite form4; + generalize (cos_gt_0 ((x + y) / 2) H4 H5); intro H8; + generalize (Rmult_lt_0_compat 2 (cos ((x + y) / 2)) Hyp H8); + clear H8; intro H8; cut (- PI < - (PI / 2)). + intro H9; + generalize + (sin_lt_0_var ((x - y) / 2) + (Rlt_le_trans (- PI) (- (PI / 2)) ((x - y) / 2) H9 H7) H6); + intro H10; + generalize + (Rmult_lt_gt_compat_neg_l (sin ((x - y) / 2)) 0 ( + 2 * cos ((x + y) / 2)) H10 H8); intro H11; rewrite Rmult_0_r in H11; + rewrite Rmult_comm; assumption. + apply Ropp_lt_gt_contravar; apply PI2_Rlt_PI. + unfold Rdiv in |- *; apply Rmult_comm. + unfold Rdiv in |- *; rewrite <- Ropp_mult_distr_l_reverse; apply Rmult_comm. + reflexivity. + pattern PI at 1 in |- *; rewrite double_var. + rewrite Ropp_plus_distr. + reflexivity. + unfold Rdiv in |- *; apply Rmult_comm. + unfold Rminus in |- *; apply Rplus_comm. + unfold Rdiv in |- *; apply Rmult_comm. + unfold Rdiv in |- *; apply Rmult_comm. + unfold Rdiv in |- *; apply Rmult_comm. + unfold Rdiv in |- *. + rewrite <- Ropp_mult_distr_l_reverse. + apply Rmult_comm. + pattern PI at 1 in |- *; rewrite double_var. + rewrite Ropp_plus_distr. + reflexivity. +Qed. + +Lemma sin_decreasing_0 : + forall x y:R, + x <= 3 * (PI / 2) -> + PI / 2 <= x -> y <= 3 * (PI / 2) -> PI / 2 <= y -> sin x < sin y -> y < x. +Proof. + intros; rewrite <- (sin_PI_x x) in H3; rewrite <- (sin_PI_x y) in H3; + generalize (Ropp_lt_gt_contravar (sin (PI - x)) (sin (PI - y)) H3); + repeat rewrite <- sin_neg; + generalize (Rplus_le_compat_l (- PI) x (3 * (PI / 2)) H); + generalize (Rplus_le_compat_l (- PI) (PI / 2) x H0); + generalize (Rplus_le_compat_l (- PI) y (3 * (PI / 2)) H1); + generalize (Rplus_le_compat_l (- PI) (PI / 2) y H2); + replace (- PI + x) with (x - PI). + replace (- PI + PI / 2) with (- (PI / 2)). + replace (- PI + y) with (y - PI). + replace (- PI + 3 * (PI / 2)) with (PI / 2). + replace (- (PI - x)) with (x - PI). + replace (- (PI - y)) with (y - PI). + intros; change (sin (y - PI) < sin (x - PI)) in H8; + apply Rplus_lt_reg_r with (- PI); rewrite Rplus_comm; + replace (y + - PI) with (y - PI). + rewrite Rplus_comm; replace (x + - PI) with (x - PI). + apply (sin_increasing_0 (y - PI) (x - PI) H4 H5 H6 H7 H8). + reflexivity. + reflexivity. + unfold Rminus in |- *; rewrite Ropp_plus_distr. + rewrite Ropp_involutive. + apply Rplus_comm. + unfold Rminus in |- *; rewrite Ropp_plus_distr. + rewrite Ropp_involutive. + apply Rplus_comm. + pattern PI at 2 in |- *; rewrite double_var. + rewrite Ropp_plus_distr. + ring. + unfold Rminus in |- *; apply Rplus_comm. + pattern PI at 2 in |- *; rewrite double_var. + rewrite Ropp_plus_distr. + ring. + unfold Rminus in |- *; apply Rplus_comm. +Qed. + +Lemma sin_decreasing_1 : + forall x y:R, + x <= 3 * (PI / 2) -> + PI / 2 <= x -> y <= 3 * (PI / 2) -> PI / 2 <= y -> x < y -> sin y < sin x. +Proof. + intros; rewrite <- (sin_PI_x x); rewrite <- (sin_PI_x y); + generalize (Rplus_le_compat_l (- PI) x (3 * (PI / 2)) H); + generalize (Rplus_le_compat_l (- PI) (PI / 2) x H0); + generalize (Rplus_le_compat_l (- PI) y (3 * (PI / 2)) H1); + generalize (Rplus_le_compat_l (- PI) (PI / 2) y H2); + generalize (Rplus_lt_compat_l (- PI) x y H3); + replace (- PI + PI / 2) with (- (PI / 2)). + replace (- PI + y) with (y - PI). + replace (- PI + 3 * (PI / 2)) with (PI / 2). + replace (- PI + x) with (x - PI). + intros; apply Ropp_lt_cancel; repeat rewrite <- sin_neg; + replace (- (PI - x)) with (x - PI). + replace (- (PI - y)) with (y - PI). + apply (sin_increasing_1 (x - PI) (y - PI) H7 H8 H5 H6 H4). + unfold Rminus in |- *; rewrite Ropp_plus_distr. + rewrite Ropp_involutive. + apply Rplus_comm. + unfold Rminus in |- *; rewrite Ropp_plus_distr. + rewrite Ropp_involutive. + apply Rplus_comm. + unfold Rminus in |- *; apply Rplus_comm. + pattern PI at 2 in |- *; rewrite double_var; ring. + unfold Rminus in |- *; apply Rplus_comm. + pattern PI at 2 in |- *; rewrite double_var; ring. +Qed. + +Lemma cos_increasing_0 : + forall x y:R, + PI <= x -> x <= 2 * PI -> PI <= y -> y <= 2 * PI -> cos x < cos y -> x < y. +Proof. + intros x y H1 H2 H3 H4; rewrite <- (cos_neg x); rewrite <- (cos_neg y); + rewrite <- (cos_period (- x) 1); rewrite <- (cos_period (- y) 1); + unfold INR in |- *; + replace (- x + 2 * 1 * PI) with (PI / 2 - (x - 3 * (PI / 2))). + replace (- y + 2 * 1 * PI) with (PI / 2 - (y - 3 * (PI / 2))). + repeat rewrite cos_shift; intro H5; + generalize (Rplus_le_compat_l (-3 * (PI / 2)) PI x H1); + generalize (Rplus_le_compat_l (-3 * (PI / 2)) x (2 * PI) H2); + generalize (Rplus_le_compat_l (-3 * (PI / 2)) PI y H3); + generalize (Rplus_le_compat_l (-3 * (PI / 2)) y (2 * PI) H4). + replace (-3 * (PI / 2) + y) with (y - 3 * (PI / 2)). + replace (-3 * (PI / 2) + x) with (x - 3 * (PI / 2)). + replace (-3 * (PI / 2) + 2 * PI) with (PI / 2). + replace (-3 * (PI / 2) + PI) with (- (PI / 2)). + clear H1 H2 H3 H4; intros H1 H2 H3 H4; + apply Rplus_lt_reg_r with (-3 * (PI / 2)); + replace (-3 * (PI / 2) + x) with (x - 3 * (PI / 2)). + replace (-3 * (PI / 2) + y) with (y - 3 * (PI / 2)). + apply (sin_increasing_0 (x - 3 * (PI / 2)) (y - 3 * (PI / 2)) H4 H3 H2 H1 H5). + unfold Rminus in |- *. + rewrite Ropp_mult_distr_l_reverse. + apply Rplus_comm. + unfold Rminus in |- *. + rewrite Ropp_mult_distr_l_reverse. + apply Rplus_comm. + pattern PI at 3 in |- *; rewrite double_var. + ring. + rewrite double; pattern PI at 3 4 in |- *; rewrite double_var. + ring. + unfold Rminus in |- *. + rewrite Ropp_mult_distr_l_reverse. + apply Rplus_comm. + unfold Rminus in |- *. + rewrite Ropp_mult_distr_l_reverse. + apply Rplus_comm. + rewrite Rmult_1_r. + rewrite (double PI); pattern PI at 3 4 in |- *; rewrite double_var. + ring. + rewrite Rmult_1_r. + rewrite (double PI); pattern PI at 3 4 in |- *; rewrite double_var. + ring. +Qed. + +Lemma cos_increasing_1 : + forall x y:R, + PI <= x -> x <= 2 * PI -> PI <= y -> y <= 2 * PI -> x < y -> cos x < cos y. +Proof. + intros x y H1 H2 H3 H4 H5; + generalize (Rplus_le_compat_l (-3 * (PI / 2)) PI x H1); + generalize (Rplus_le_compat_l (-3 * (PI / 2)) x (2 * PI) H2); + generalize (Rplus_le_compat_l (-3 * (PI / 2)) PI y H3); + generalize (Rplus_le_compat_l (-3 * (PI / 2)) y (2 * PI) H4); + generalize (Rplus_lt_compat_l (-3 * (PI / 2)) x y H5); + rewrite <- (cos_neg x); rewrite <- (cos_neg y); + rewrite <- (cos_period (- x) 1); rewrite <- (cos_period (- y) 1); + unfold INR in |- *; replace (-3 * (PI / 2) + x) with (x - 3 * (PI / 2)). + replace (-3 * (PI / 2) + y) with (y - 3 * (PI / 2)). + replace (-3 * (PI / 2) + PI) with (- (PI / 2)). + replace (-3 * (PI / 2) + 2 * PI) with (PI / 2). + clear H1 H2 H3 H4 H5; intros H1 H2 H3 H4 H5; + replace (- x + 2 * 1 * PI) with (PI / 2 - (x - 3 * (PI / 2))). + replace (- y + 2 * 1 * PI) with (PI / 2 - (y - 3 * (PI / 2))). + repeat rewrite cos_shift; + apply + (sin_increasing_1 (x - 3 * (PI / 2)) (y - 3 * (PI / 2)) H5 H4 H3 H2 H1). + rewrite Rmult_1_r. + rewrite (double PI); pattern PI at 3 4 in |- *; rewrite double_var. + ring. + rewrite Rmult_1_r. + rewrite (double PI); pattern PI at 3 4 in |- *; rewrite double_var. + ring. + rewrite (double PI); pattern PI at 3 4 in |- *; rewrite double_var. + ring. + pattern PI at 3 in |- *; rewrite double_var; ring. + unfold Rminus in |- *. + rewrite <- Ropp_mult_distr_l_reverse. + apply Rplus_comm. + unfold Rminus in |- *. + rewrite <- Ropp_mult_distr_l_reverse. + apply Rplus_comm. +Qed. + +Lemma cos_decreasing_0 : + forall x y:R, + 0 <= x -> x <= PI -> 0 <= y -> y <= PI -> cos x < cos y -> y < x. +Proof. + intros; generalize (Ropp_lt_gt_contravar (cos x) (cos y) H3); + repeat rewrite <- neg_cos; intro H4; + change (cos (y + PI) < cos (x + PI)) in H4; rewrite (Rplus_comm x) in H4; + rewrite (Rplus_comm y) in H4; generalize (Rplus_le_compat_l PI 0 x H); + generalize (Rplus_le_compat_l PI x PI H0); + generalize (Rplus_le_compat_l PI 0 y H1); + generalize (Rplus_le_compat_l PI y PI H2); rewrite Rplus_0_r. + rewrite <- double. + clear H H0 H1 H2 H3; intros; apply Rplus_lt_reg_r with PI; + apply (cos_increasing_0 (PI + y) (PI + x) H0 H H2 H1 H4). +Qed. + +Lemma cos_decreasing_1 : + forall x y:R, + 0 <= x -> x <= PI -> 0 <= y -> y <= PI -> x < y -> cos y < cos x. +Proof. + intros; apply Ropp_lt_cancel; repeat rewrite <- neg_cos; + rewrite (Rplus_comm x); rewrite (Rplus_comm y); + generalize (Rplus_le_compat_l PI 0 x H); + generalize (Rplus_le_compat_l PI x PI H0); + generalize (Rplus_le_compat_l PI 0 y H1); + generalize (Rplus_le_compat_l PI y PI H2); rewrite Rplus_0_r. + rewrite <- double. + generalize (Rplus_lt_compat_l PI x y H3); clear H H0 H1 H2 H3; intros; + apply (cos_increasing_1 (PI + x) (PI + y) H3 H2 H1 H0 H). +Qed. + +Lemma tan_diff : + forall x y:R, + cos x <> 0 -> cos y <> 0 -> tan x - tan y = sin (x - y) / (cos x * cos y). +Proof. + intros; unfold tan in |- *; rewrite sin_minus. + unfold Rdiv in |- *. + unfold Rminus in |- *. + rewrite Rmult_plus_distr_r. + rewrite Rinv_mult_distr. + repeat rewrite (Rmult_comm (sin x)). + repeat rewrite Rmult_assoc. + rewrite (Rmult_comm (cos y)). + repeat rewrite Rmult_assoc. + rewrite <- Rinv_l_sym. + rewrite Rmult_1_r. + rewrite (Rmult_comm (sin x)). + apply Rplus_eq_compat_l. + rewrite <- Ropp_mult_distr_l_reverse. + rewrite <- Ropp_mult_distr_r_reverse. + rewrite (Rmult_comm (/ cos x)). + repeat rewrite Rmult_assoc. + rewrite (Rmult_comm (cos x)). + repeat rewrite Rmult_assoc. + rewrite <- Rinv_l_sym. + rewrite Rmult_1_r. + reflexivity. + assumption. + assumption. + assumption. + assumption. +Qed. + +Lemma tan_increasing_0 : + forall x y:R, + - (PI / 4) <= x -> + x <= PI / 4 -> - (PI / 4) <= y -> y <= PI / 4 -> tan x < tan y -> x < y. +Proof. + intros; generalize PI4_RLT_PI2; intro H4; + generalize (Ropp_lt_gt_contravar (PI / 4) (PI / 2) H4); + intro H5; change (- (PI / 2) < - (PI / 4)) in H5; + generalize + (cos_gt_0 x (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) x H5 H) + (Rle_lt_trans x (PI / 4) (PI / 2) H0 H4)); intro HP1; + generalize + (cos_gt_0 y (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) y H5 H1) + (Rle_lt_trans y (PI / 4) (PI / 2) H2 H4)); intro HP2; + generalize + (not_eq_sym + (Rlt_not_eq 0 (cos x) + (cos_gt_0 x (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) x H5 H) + (Rle_lt_trans x (PI / 4) (PI / 2) H0 H4)))); + intro H6; + generalize + (not_eq_sym + (Rlt_not_eq 0 (cos y) + (cos_gt_0 y (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) y H5 H1) + (Rle_lt_trans y (PI / 4) (PI / 2) H2 H4)))); + intro H7; generalize (tan_diff x y H6 H7); intro H8; + generalize (Rlt_minus (tan x) (tan y) H3); clear H3; + intro H3; rewrite H8 in H3; cut (sin (x - y) < 0). + intro H9; generalize (Ropp_le_ge_contravar (- (PI / 4)) y H1); + rewrite Ropp_involutive; intro H10; generalize (Rge_le (PI / 4) (- y) H10); + clear H10; intro H10; generalize (Ropp_le_ge_contravar y (PI / 4) H2); + intro H11; generalize (Rge_le (- y) (- (PI / 4)) H11); + clear H11; intro H11; + generalize (Rplus_le_compat (- (PI / 4)) x (- (PI / 4)) (- y) H H11); + generalize (Rplus_le_compat x (PI / 4) (- y) (PI / 4) H0 H10); + replace (x + - y) with (x - y). + replace (PI / 4 + PI / 4) with (PI / 2). + replace (- (PI / 4) + - (PI / 4)) with (- (PI / 2)). + intros; case (Rtotal_order 0 (x - y)); intro H14. + generalize + (sin_gt_0 (x - y) H14 (Rle_lt_trans (x - y) (PI / 2) PI H12 PI2_Rlt_PI)); + intro H15; elim (Rlt_irrefl 0 (Rlt_trans 0 (sin (x - y)) 0 H15 H9)). + elim H14; intro H15. + rewrite <- H15 in H9; rewrite sin_0 in H9; elim (Rlt_irrefl 0 H9). + apply Rminus_lt; assumption. + pattern PI at 1 in |- *; rewrite double_var. + unfold Rdiv in |- *. + rewrite Rmult_plus_distr_r. + repeat rewrite Rmult_assoc. + rewrite <- Rinv_mult_distr. + rewrite Ropp_plus_distr. + replace 4 with 4. + reflexivity. + ring. + discrR. + discrR. + pattern PI at 1 in |- *; rewrite double_var. + unfold Rdiv in |- *. + rewrite Rmult_plus_distr_r. + repeat rewrite Rmult_assoc. + rewrite <- Rinv_mult_distr. + replace 4 with 4. + reflexivity. + ring. + discrR. + discrR. + reflexivity. + case (Rcase_abs (sin (x - y))); intro H9. + assumption. + generalize (Rge_le (sin (x - y)) 0 H9); clear H9; intro H9; + generalize (Rinv_0_lt_compat (cos x) HP1); intro H10; + generalize (Rinv_0_lt_compat (cos y) HP2); intro H11; + generalize (Rmult_lt_0_compat (/ cos x) (/ cos y) H10 H11); + replace (/ cos x * / cos y) with (/ (cos x * cos y)). + intro H12; + generalize + (Rmult_le_pos (sin (x - y)) (/ (cos x * cos y)) H9 + (Rlt_le 0 (/ (cos x * cos y)) H12)); intro H13; + elim + (Rlt_irrefl 0 (Rle_lt_trans 0 (sin (x - y) * / (cos x * cos y)) 0 H13 H3)). + rewrite Rinv_mult_distr. + reflexivity. + assumption. + assumption. +Qed. + +Lemma tan_increasing_1 : + forall x y:R, + - (PI / 4) <= x -> + x <= PI / 4 -> - (PI / 4) <= y -> y <= PI / 4 -> x < y -> tan x < tan y. +Proof. + intros; apply Rminus_lt; generalize PI4_RLT_PI2; intro H4; + generalize (Ropp_lt_gt_contravar (PI / 4) (PI / 2) H4); + intro H5; change (- (PI / 2) < - (PI / 4)) in H5; + generalize + (cos_gt_0 x (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) x H5 H) + (Rle_lt_trans x (PI / 4) (PI / 2) H0 H4)); intro HP1; + generalize + (cos_gt_0 y (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) y H5 H1) + (Rle_lt_trans y (PI / 4) (PI / 2) H2 H4)); intro HP2; + generalize + (not_eq_sym + (Rlt_not_eq 0 (cos x) + (cos_gt_0 x (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) x H5 H) + (Rle_lt_trans x (PI / 4) (PI / 2) H0 H4)))); + intro H6; + generalize + (not_eq_sym + (Rlt_not_eq 0 (cos y) + (cos_gt_0 y (Rlt_le_trans (- (PI / 2)) (- (PI / 4)) y H5 H1) + (Rle_lt_trans y (PI / 4) (PI / 2) H2 H4)))); + intro H7; rewrite (tan_diff x y H6 H7); + generalize (Rinv_0_lt_compat (cos x) HP1); intro H10; + generalize (Rinv_0_lt_compat (cos y) HP2); intro H11; + generalize (Rmult_lt_0_compat (/ cos x) (/ cos y) H10 H11); + replace (/ cos x * / cos y) with (/ (cos x * cos y)). + clear H10 H11; intro H8; generalize (Ropp_le_ge_contravar y (PI / 4) H2); + intro H11; generalize (Rge_le (- y) (- (PI / 4)) H11); + clear H11; intro H11; + generalize (Rplus_le_compat (- (PI / 4)) x (- (PI / 4)) (- y) H H11); + replace (x + - y) with (x - y). + replace (- (PI / 4) + - (PI / 4)) with (- (PI / 2)). + clear H11; intro H9; generalize (Rlt_minus x y H3); clear H3; intro H3; + clear H H0 H1 H2 H4 H5 HP1 HP2; generalize PI2_Rlt_PI; + intro H1; generalize (Ropp_lt_gt_contravar (PI / 2) PI H1); + clear H1; intro H1; + generalize + (sin_lt_0_var (x - y) (Rlt_le_trans (- PI) (- (PI / 2)) (x - y) H1 H9) H3); + intro H2; + generalize + (Rmult_lt_gt_compat_neg_l (sin (x - y)) 0 (/ (cos x * cos y)) H2 H8); + rewrite Rmult_0_r; intro H4; assumption. + pattern PI at 1 in |- *; rewrite double_var. + unfold Rdiv in |- *. + rewrite Rmult_plus_distr_r. + repeat rewrite Rmult_assoc. + rewrite <- Rinv_mult_distr. + replace 4 with 4. + rewrite Ropp_plus_distr. + reflexivity. + ring. + discrR. + discrR. + reflexivity. + apply Rinv_mult_distr; assumption. +Qed. + +Lemma sin_incr_0 : + forall x y:R, + - (PI / 2) <= x -> + x <= PI / 2 -> - (PI / 2) <= y -> y <= PI / 2 -> sin x <= sin y -> x <= y. +Proof. + intros; case (Rtotal_order (sin x) (sin y)); intro H4; + [ left; apply (sin_increasing_0 x y H H0 H1 H2 H4) + | elim H4; intro H5; + [ case (Rtotal_order x y); intro H6; + [ left; assumption + | elim H6; intro H7; + [ right; assumption + | generalize (sin_increasing_1 y x H1 H2 H H0 H7); intro H8; + rewrite H5 in H8; elim (Rlt_irrefl (sin y) H8) ] ] + | elim (Rlt_irrefl (sin x) (Rle_lt_trans (sin x) (sin y) (sin x) H3 H5)) ] ]. +Qed. + +Lemma sin_incr_1 : + forall x y:R, + - (PI / 2) <= x -> + x <= PI / 2 -> - (PI / 2) <= y -> y <= PI / 2 -> x <= y -> sin x <= sin y. +Proof. + intros; case (Rtotal_order x y); intro H4; + [ left; apply (sin_increasing_1 x y H H0 H1 H2 H4) + | elim H4; intro H5; + [ case (Rtotal_order (sin x) (sin y)); intro H6; + [ left; assumption + | elim H6; intro H7; + [ right; assumption + | generalize (sin_increasing_0 y x H1 H2 H H0 H7); intro H8; + rewrite H5 in H8; elim (Rlt_irrefl y H8) ] ] + | elim (Rlt_irrefl x (Rle_lt_trans x y x H3 H5)) ] ]. +Qed. + +Lemma sin_decr_0 : + forall x y:R, + x <= 3 * (PI / 2) -> + PI / 2 <= x -> + y <= 3 * (PI / 2) -> PI / 2 <= y -> sin x <= sin y -> y <= x. +Proof. + intros; case (Rtotal_order (sin x) (sin y)); intro H4; + [ left; apply (sin_decreasing_0 x y H H0 H1 H2 H4) + | elim H4; intro H5; + [ case (Rtotal_order x y); intro H6; + [ generalize (sin_decreasing_1 x y H H0 H1 H2 H6); intro H8; + rewrite H5 in H8; elim (Rlt_irrefl (sin y) H8) + | elim H6; intro H7; + [ right; symmetry in |- *; assumption | left; assumption ] ] + | elim (Rlt_irrefl (sin x) (Rle_lt_trans (sin x) (sin y) (sin x) H3 H5)) ] ]. +Qed. + +Lemma sin_decr_1 : + forall x y:R, + x <= 3 * (PI / 2) -> + PI / 2 <= x -> + y <= 3 * (PI / 2) -> PI / 2 <= y -> x <= y -> sin y <= sin x. +Proof. + intros; case (Rtotal_order x y); intro H4; + [ left; apply (sin_decreasing_1 x y H H0 H1 H2 H4) + | elim H4; intro H5; + [ case (Rtotal_order (sin x) (sin y)); intro H6; + [ generalize (sin_decreasing_0 x y H H0 H1 H2 H6); intro H8; + rewrite H5 in H8; elim (Rlt_irrefl y H8) + | elim H6; intro H7; + [ right; symmetry in |- *; assumption | left; assumption ] ] + | elim (Rlt_irrefl x (Rle_lt_trans x y x H3 H5)) ] ]. +Qed. + +Lemma cos_incr_0 : + forall x y:R, + PI <= x -> + x <= 2 * PI -> PI <= y -> y <= 2 * PI -> cos x <= cos y -> x <= y. +Proof. + intros; case (Rtotal_order (cos x) (cos y)); intro H4; + [ left; apply (cos_increasing_0 x y H H0 H1 H2 H4) + | elim H4; intro H5; + [ case (Rtotal_order x y); intro H6; + [ left; assumption + | elim H6; intro H7; + [ right; assumption + | generalize (cos_increasing_1 y x H1 H2 H H0 H7); intro H8; + rewrite H5 in H8; elim (Rlt_irrefl (cos y) H8) ] ] + | elim (Rlt_irrefl (cos x) (Rle_lt_trans (cos x) (cos y) (cos x) H3 H5)) ] ]. +Qed. + +Lemma cos_incr_1 : + forall x y:R, + PI <= x -> + x <= 2 * PI -> PI <= y -> y <= 2 * PI -> x <= y -> cos x <= cos y. +Proof. + intros; case (Rtotal_order x y); intro H4; + [ left; apply (cos_increasing_1 x y H H0 H1 H2 H4) + | elim H4; intro H5; + [ case (Rtotal_order (cos x) (cos y)); intro H6; + [ left; assumption + | elim H6; intro H7; + [ right; assumption + | generalize (cos_increasing_0 y x H1 H2 H H0 H7); intro H8; + rewrite H5 in H8; elim (Rlt_irrefl y H8) ] ] + | elim (Rlt_irrefl x (Rle_lt_trans x y x H3 H5)) ] ]. +Qed. + +Lemma cos_decr_0 : + forall x y:R, + 0 <= x -> x <= PI -> 0 <= y -> y <= PI -> cos x <= cos y -> y <= x. +Proof. + intros; case (Rtotal_order (cos x) (cos y)); intro H4; + [ left; apply (cos_decreasing_0 x y H H0 H1 H2 H4) + | elim H4; intro H5; + [ case (Rtotal_order x y); intro H6; + [ generalize (cos_decreasing_1 x y H H0 H1 H2 H6); intro H8; + rewrite H5 in H8; elim (Rlt_irrefl (cos y) H8) + | elim H6; intro H7; + [ right; symmetry in |- *; assumption | left; assumption ] ] + | elim (Rlt_irrefl (cos x) (Rle_lt_trans (cos x) (cos y) (cos x) H3 H5)) ] ]. +Qed. + +Lemma cos_decr_1 : + forall x y:R, + 0 <= x -> x <= PI -> 0 <= y -> y <= PI -> x <= y -> cos y <= cos x. +Proof. + intros; case (Rtotal_order x y); intro H4; + [ left; apply (cos_decreasing_1 x y H H0 H1 H2 H4) + | elim H4; intro H5; + [ case (Rtotal_order (cos x) (cos y)); intro H6; + [ generalize (cos_decreasing_0 x y H H0 H1 H2 H6); intro H8; + rewrite H5 in H8; elim (Rlt_irrefl y H8) + | elim H6; intro H7; + [ right; symmetry in |- *; assumption | left; assumption ] ] + | elim (Rlt_irrefl x (Rle_lt_trans x y x H3 H5)) ] ]. +Qed. + +Lemma tan_incr_0 : + forall x y:R, + - (PI / 4) <= x -> + x <= PI / 4 -> - (PI / 4) <= y -> y <= PI / 4 -> tan x <= tan y -> x <= y. +Proof. + intros; case (Rtotal_order (tan x) (tan y)); intro H4; + [ left; apply (tan_increasing_0 x y H H0 H1 H2 H4) + | elim H4; intro H5; + [ case (Rtotal_order x y); intro H6; + [ left; assumption + | elim H6; intro H7; + [ right; assumption + | generalize (tan_increasing_1 y x H1 H2 H H0 H7); intro H8; + rewrite H5 in H8; elim (Rlt_irrefl (tan y) H8) ] ] + | elim (Rlt_irrefl (tan x) (Rle_lt_trans (tan x) (tan y) (tan x) H3 H5)) ] ]. +Qed. + +Lemma tan_incr_1 : + forall x y:R, + - (PI / 4) <= x -> + x <= PI / 4 -> - (PI / 4) <= y -> y <= PI / 4 -> x <= y -> tan x <= tan y. +Proof. + intros; case (Rtotal_order x y); intro H4; + [ left; apply (tan_increasing_1 x y H H0 H1 H2 H4) + | elim H4; intro H5; + [ case (Rtotal_order (tan x) (tan y)); intro H6; + [ left; assumption + | elim H6; intro H7; + [ right; assumption + | generalize (tan_increasing_0 y x H1 H2 H H0 H7); intro H8; + rewrite H5 in H8; elim (Rlt_irrefl y H8) ] ] + | elim (Rlt_irrefl x (Rle_lt_trans x y x H3 H5)) ] ]. +Qed. + +(**********) +Lemma sin_eq_0_1 : forall x:R, (exists k : Z, x = IZR k * PI) -> sin x = 0. +Proof. + intros. + elim H; intros. + apply (Zcase_sign x0). + intro. + rewrite H1 in H0. + simpl in H0. + rewrite H0; rewrite Rmult_0_l; apply sin_0. + intro. + cut (0 <= x0)%Z. + intro. + elim (IZN x0 H2); intros. + rewrite H3 in H0. + rewrite <- INR_IZR_INZ in H0. + rewrite H0. + elim (even_odd_cor x1); intros. + elim H4; intro. + rewrite H5. + rewrite mult_INR. + simpl in |- *. + rewrite <- (Rplus_0_l (2 * INR x2 * PI)). + rewrite sin_period. + apply sin_0. + rewrite H5. + rewrite S_INR; rewrite mult_INR. + simpl in |- *. + rewrite Rmult_plus_distr_r. + rewrite Rmult_1_l; rewrite sin_plus. + rewrite sin_PI. + rewrite Rmult_0_r. + rewrite <- (Rplus_0_l (2 * INR x2 * PI)). + rewrite sin_period. + rewrite sin_0; ring. + apply le_IZR. + left; apply IZR_lt. + assert (H2 := Z.gt_lt_iff). + elim (H2 x0 0%Z); intros. + apply H3; assumption. + intro. + rewrite H0. + replace (sin (IZR x0 * PI)) with (- sin (- IZR x0 * PI)). + cut (0 <= - x0)%Z. + intro. + rewrite <- Ropp_Ropp_IZR. + elim (IZN (- x0) H2); intros. + rewrite H3. + rewrite <- INR_IZR_INZ. + elim (even_odd_cor x1); intros. + elim H4; intro. + rewrite H5. + rewrite mult_INR. + simpl in |- *. + rewrite <- (Rplus_0_l (2 * INR x2 * PI)). + rewrite sin_period. + rewrite sin_0; ring. + rewrite H5. + rewrite S_INR; rewrite mult_INR. + simpl in |- *. + rewrite Rmult_plus_distr_r. + rewrite Rmult_1_l; rewrite sin_plus. + rewrite sin_PI. + rewrite Rmult_0_r. + rewrite <- (Rplus_0_l (2 * INR x2 * PI)). + rewrite sin_period. + rewrite sin_0; ring. + apply le_IZR. + apply Rplus_le_reg_l with (IZR x0). + rewrite Rplus_0_r. + rewrite Ropp_Ropp_IZR. + rewrite Rplus_opp_r. + left; replace 0 with (IZR 0); [ apply IZR_lt | reflexivity ]. + assumption. + rewrite <- sin_neg. + rewrite Ropp_mult_distr_l_reverse. + rewrite Ropp_involutive. + reflexivity. +Qed. + +Lemma sin_eq_0_0 (x:R) : sin x = 0 -> exists k : Z, x = IZR k * PI. +Proof. + intros Hx. + destruct (euclidian_division x PI PI_neq0) as (q & r & EQ & Hr & Hr'). + exists q. + rewrite <- (Rplus_0_r (_*_)). subst. apply Rplus_eq_compat_l. + rewrite sin_plus in Hx. + assert (H : sin (IZR q * PI) = 0) by (apply sin_eq_0_1; now exists q). + rewrite H, Rmult_0_l, Rplus_0_l in Hx. + destruct (Rmult_integral _ _ Hx) as [H'|H']. + - exfalso. + generalize (sin2_cos2 (IZR q * PI)). + rewrite H, H', Rsqr_0, Rplus_0_l. + intros; now apply R1_neq_R0. + - rewrite Rabs_right in Hr'; [|left; apply PI_RGT_0]. + destruct Hr as [Hr | ->]; trivial. + exfalso. + generalize (sin_gt_0 r Hr Hr'). rewrite H'. apply Rlt_irrefl. +Qed. + +Lemma cos_eq_0_0 (x:R) : + cos x = 0 -> exists k : Z, x = IZR k * PI + PI / 2. +Proof. + rewrite cos_sin. intros Hx. + destruct (sin_eq_0_0 (PI/2 + x) Hx) as (k,Hk). clear Hx. + exists (k-1)%Z. rewrite <- Z_R_minus; simpl. + symmetry in Hk. field_simplify [Hk]. field. +Qed. + +Lemma cos_eq_0_1 (x:R) : + (exists k : Z, x = IZR k * PI + PI / 2) -> cos x = 0. +Proof. + rewrite cos_sin. intros (k,->). + replace (_ + _) with (IZR k * PI + PI) by field. + rewrite neg_sin, <- Ropp_0. apply Ropp_eq_compat. + apply sin_eq_0_1. now exists k. +Qed. + +Lemma sin_eq_O_2PI_0 (x:R) : + 0 <= x -> x <= 2 * PI -> sin x = 0 -> + x = 0 \/ x = PI \/ x = 2 * PI. +Proof. + intros Lo Hi Hx. destruct (sin_eq_0_0 x Hx) as (k,Hk). clear Hx. + destruct (Rtotal_order PI x) as [Hx|[Hx|Hx]]. + - right; right. + clear Lo. subst. + f_equal. change 2 with (IZR (- (-2))). f_equal. + apply Z.add_move_0_l. + apply one_IZR_lt1. + rewrite plus_IZR; simpl. + split. + + replace (-1) with (-2 + 1) by ring. + apply Rplus_lt_compat_l. + apply Rmult_lt_reg_r with PI; [apply PI_RGT_0|]. + now rewrite Rmult_1_l. + + apply Rle_lt_trans with 0; [|apply Rlt_0_1]. + replace 0 with (-2 + 2) by ring. + apply Rplus_le_compat_l. + apply Rmult_le_reg_r with PI; [apply PI_RGT_0|]. + trivial. + - right; left; auto. + - left. + clear Hi. subst. + replace 0 with (IZR 0 * PI) by (simpl; ring). f_equal. f_equal. + apply one_IZR_lt1. + split. + + apply Rlt_le_trans with 0; + [rewrite <- Ropp_0; apply Ropp_gt_lt_contravar, Rlt_0_1 | ]. + apply Rmult_le_reg_r with PI; [apply PI_RGT_0|]. + now rewrite Rmult_0_l. + + apply Rmult_lt_reg_r with PI; [apply PI_RGT_0|]. + now rewrite Rmult_1_l. +Qed. + +Lemma sin_eq_O_2PI_1 (x:R) : + 0 <= x -> x <= 2 * PI -> + x = 0 \/ x = PI \/ x = 2 * PI -> sin x = 0. +Proof. + intros _ _ [ -> |[ -> | -> ]]. + - now rewrite sin_0. + - now rewrite sin_PI. + - now rewrite sin_2PI. +Qed. + +Lemma cos_eq_0_2PI_0 (x:R) : + 0 <= x -> x <= 2 * PI -> cos x = 0 -> + x = PI / 2 \/ x = 3 * (PI / 2). +Proof. + intros Lo Hi Hx. + destruct (Rtotal_order x (3 * (PI / 2))) as [LT|[EQ|GT]]. + - rewrite cos_sin in Hx. + assert (Lo' : 0 <= PI / 2 + x). + { apply Rplus_le_le_0_compat. apply Rlt_le, PI2_RGT_0. trivial. } + assert (Hi' : PI / 2 + x <= 2 * PI). + { apply Rlt_le. + replace (2 * PI) with (PI / 2 + 3 * (PI / 2)) by field. + now apply Rplus_lt_compat_l. } + destruct (sin_eq_O_2PI_0 (PI / 2 + x) Lo' Hi' Hx) as [H|[H|H]]. + + exfalso. + apply (Rplus_le_compat_l (PI/2)) in Lo. + rewrite Rplus_0_r, H in Lo. + apply (Rlt_irrefl 0 (Rlt_le_trans 0 (PI / 2) 0 PI2_RGT_0 Lo)). + + left. + apply (Rplus_eq_compat_l (-(PI/2))) in H. + ring_simplify in H. rewrite H. field. + + right. + apply (Rplus_eq_compat_l (-(PI/2))) in H. + ring_simplify in H. rewrite H. field. + - now right. + - exfalso. + destruct (cos_eq_0_0 x Hx) as (k,Hk). clear Hx Lo. + subst. + assert (LT : (k < 2)%Z). + { apply lt_IZR. simpl. + apply (Rmult_lt_reg_r PI); [apply PI_RGT_0|]. + apply Rlt_le_trans with (IZR k * PI + PI/2); trivial. + rewrite <- (Rplus_0_r (IZR k * PI)) at 1. + apply Rplus_lt_compat_l. apply PI2_RGT_0. } + assert (GT' : (1 < k)%Z). + { apply lt_IZR. simpl. + apply (Rmult_lt_reg_r PI); [apply PI_RGT_0|rewrite Rmult_1_l]. + replace (3*(PI/2)) with (PI/2 + PI) in GT by field. + rewrite Rplus_comm in GT. + now apply Rplus_lt_reg_r in GT. } + omega. +Qed. + +Lemma cos_eq_0_2PI_1 (x:R) : + 0 <= x -> x <= 2 * PI -> + x = PI / 2 \/ x = 3 * (PI / 2) -> cos x = 0. +Proof. + intros Lo Hi [ -> | -> ]. + - now rewrite cos_PI2. + - now rewrite cos_3PI2. +Qed. diff --git a/theories/Reals/Rtrigo_alt.v b/theories/Reals/Rtrigo_alt.v index 3ab7d598..23b8e847 100644 --- a/theories/Reals/Rtrigo_alt.v +++ b/theories/Reals/Rtrigo_alt.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -10,7 +10,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. Require Import Rtrigo_def. -Open Local Scope R_scope. +Local Open Scope R_scope. (***************************************************************) (** Using series definitions of cos and sin *) @@ -27,7 +27,8 @@ Definition sin_approx (a:R) (n:nat) : R := sum_f_R0 (sin_term a) n. Definition cos_approx (a:R) (n:nat) : R := sum_f_R0 (cos_term a) n. (**********) -Lemma PI_4 : PI <= 4. +(* +Lemma Alt_PI_4 : Alt_PI <= 4. Proof. assert (H0 := PI_ineq 0). elim H0; clear H0; intros _ H0. @@ -37,20 +38,20 @@ Proof. apply Rinv_0_lt_compat; prove_sup0. rewrite <- Rinv_l_sym; [ rewrite Rmult_comm; assumption | discrR ]. Qed. - +*) (**********) -Theorem sin_bound : +Theorem pre_sin_bound : forall (a:R) (n:nat), 0 <= a -> - a <= PI -> sin_approx a (2 * n + 1) <= sin a <= sin_approx a (2 * (n + 1)). + a <= 4 -> sin_approx a (2 * n + 1) <= sin a <= sin_approx a (2 * (n + 1)). Proof. intros; case (Req_dec a 0); intro Hyp_a. - rewrite Hyp_a; rewrite sin_0; split; right; unfold sin_approx in |- *; - apply sum_eq_R0 || (symmetry in |- *; apply sum_eq_R0); - intros; unfold sin_term in |- *; rewrite pow_add; - simpl in |- *; unfold Rdiv in |- *; rewrite Rmult_0_l; + rewrite Hyp_a; rewrite sin_0; split; right; unfold sin_approx; + apply sum_eq_R0 || (symmetry ; apply sum_eq_R0); + intros; unfold sin_term; rewrite pow_add; + simpl; unfold Rdiv; rewrite Rmult_0_l; ring. - unfold sin_approx in |- *; cut (0 < a). + unfold sin_approx; cut (0 < a). intro Hyp_a_pos. rewrite (decomp_sum (sin_term a) (2 * n + 1)). rewrite (decomp_sum (sin_term a) (2 * (n + 1))). @@ -75,22 +76,22 @@ Proof. - sum_f_R0 (tg_alt Un) (S (2 * n))). intro; apply H2. apply alternated_series_ineq. - unfold Un_decreasing, Un in |- *; intro; + unfold Un_decreasing, Un; intro; cut ((2 * S (S n0) + 1)%nat = S (S (2 * S n0 + 1))). intro; rewrite H3. replace (a ^ S (S (2 * S n0 + 1))) with (a ^ (2 * S n0 + 1) * (a * a)). - unfold Rdiv in |- *; rewrite Rmult_assoc; apply Rmult_le_compat_l. + unfold Rdiv; rewrite Rmult_assoc; apply Rmult_le_compat_l. left; apply pow_lt; assumption. apply Rmult_le_reg_l with (INR (fact (S (S (2 * S n0 + 1))))). - rewrite <- H3; apply lt_INR_0; apply neq_O_lt; red in |- *; intro; - assert (H5 := sym_eq H4); elim (fact_neq_0 _ H5). + rewrite <- H3; apply lt_INR_0; apply neq_O_lt; red; intro; + assert (H5 := eq_sym H4); elim (fact_neq_0 _ H5). rewrite <- H3; rewrite (Rmult_comm (INR (fact (2 * S (S n0) + 1)))); rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r; rewrite H3; do 2 rewrite fact_simpl; do 2 rewrite mult_INR; repeat rewrite Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_r. do 2 rewrite S_INR; rewrite plus_INR; rewrite mult_INR; repeat rewrite S_INR; - simpl in |- *; + simpl; replace (((0 + 1 + 1) * (INR n0 + 1) + (0 + 1) + 1 + 1) * ((0 + 1 + 1) * (INR n0 + 1) + (0 + 1) + 1)) with @@ -100,12 +101,12 @@ Proof. replace 16 with (Rsqr 4); [ idtac | ring_Rsqr ]. replace (a * a) with (Rsqr a); [ idtac | reflexivity ]. apply Rsqr_incr_1. - apply Rle_trans with PI; [ assumption | apply PI_4 ]. + assumption. assumption. left; prove_sup0. rewrite <- (Rplus_0_r 16); replace 20 with (16 + 4); [ apply Rplus_le_compat_l; left; prove_sup0 | ring ]. - rewrite <- (Rplus_comm 20); pattern 20 at 1 in |- *; rewrite <- Rplus_0_r; + rewrite <- (Rplus_comm 20); pattern 20 at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l. apply Rplus_le_le_0_compat. repeat apply Rmult_le_pos. @@ -118,14 +119,14 @@ Proof. replace 0 with (INR 0); [ apply le_INR; apply le_O_n | reflexivity ]. apply INR_fact_neq_0. apply INR_fact_neq_0. - simpl in |- *; ring. + simpl; ring. ring. - assert (H3 := cv_speed_pow_fact a); unfold Un in |- *; unfold Un_cv in H3; - unfold R_dist in H3; unfold Un_cv in |- *; unfold R_dist in |- *; + assert (H3 := cv_speed_pow_fact a); unfold Un; unfold Un_cv in H3; + unfold R_dist in H3; unfold Un_cv; unfold R_dist; intros; elim (H3 eps H4); intros N H5. exists N; intros; apply H5. replace (2 * S n0 + 1)%nat with (S (2 * S n0)). - unfold ge in |- *; apply le_trans with (2 * S n0)%nat. + unfold ge; apply le_trans with (2 * S n0)%nat. apply le_trans with (2 * S N)%nat. apply le_trans with (2 * N)%nat. apply le_n_2n. @@ -136,49 +137,49 @@ Proof. assert (X := exist_sin (Rsqr a)); elim X; intros. cut (x = sin a / a). intro; rewrite H3 in p; unfold sin_in in p; unfold infinite_sum in p; - unfold R_dist in p; unfold Un_cv in |- *; unfold R_dist in |- *; + unfold R_dist in p; unfold Un_cv; unfold R_dist; intros. cut (0 < eps / Rabs a). intro; elim (p _ H5); intros N H6. exists N; intros. replace (sum_f_R0 (tg_alt Un) n0) with (a * (1 - sum_f_R0 (fun i:nat => sin_n i * Rsqr a ^ i) (S n0))). - unfold Rminus in |- *; rewrite Rmult_plus_distr_l; rewrite Rmult_1_r; + unfold Rminus; rewrite Rmult_plus_distr_l; rewrite Rmult_1_r; rewrite Ropp_plus_distr; rewrite Ropp_involutive; repeat rewrite Rplus_assoc; rewrite (Rplus_comm a); rewrite (Rplus_comm (- a)); repeat rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; apply Rmult_lt_reg_l with (/ Rabs a). apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption. - pattern (/ Rabs a) at 1 in |- *; rewrite <- (Rabs_Rinv a Hyp_a). + pattern (/ Rabs a) at 1; rewrite <- (Rabs_Rinv a Hyp_a). rewrite <- Rabs_mult; rewrite Rmult_plus_distr_l; rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym; [ rewrite Rmult_1_l | assumption ]; rewrite (Rmult_comm (/ a)); rewrite (Rmult_comm (/ Rabs a)); rewrite <- Rabs_Ropp; rewrite Ropp_plus_distr; rewrite Ropp_involutive; - unfold Rminus, Rdiv in H6; apply H6; unfold ge in |- *; + unfold Rminus, Rdiv in H6; apply H6; unfold ge; apply le_trans with n0; [ exact H7 | apply le_n_Sn ]. rewrite (decomp_sum (fun i:nat => sin_n i * Rsqr a ^ i) (S n0)). replace (sin_n 0) with 1. - simpl in |- *; rewrite Rmult_1_r; unfold Rminus in |- *; + simpl; rewrite Rmult_1_r; unfold Rminus; rewrite Ropp_plus_distr; rewrite <- Rplus_assoc; rewrite Rplus_opp_r; rewrite Rplus_0_l; rewrite Ropp_mult_distr_r_reverse; rewrite <- Ropp_mult_distr_l_reverse; rewrite scal_sum; apply sum_eq. - intros; unfold sin_n, Un, tg_alt in |- *; + intros; unfold sin_n, Un, tg_alt; replace ((-1) ^ S i) with (- (-1) ^ i). replace (a ^ (2 * S i + 1)) with (Rsqr a * Rsqr a ^ i * a). - unfold Rdiv in |- *; ring. - rewrite pow_add; rewrite pow_Rsqr; simpl in |- *; ring. - simpl in |- *; ring. - unfold sin_n in |- *; unfold Rdiv in |- *; simpl in |- *; rewrite Rinv_1; + unfold Rdiv; ring. + rewrite pow_add; rewrite pow_Rsqr; simpl; ring. + simpl; ring. + unfold sin_n; unfold Rdiv; simpl; rewrite Rinv_1; rewrite Rmult_1_r; reflexivity. apply lt_O_Sn. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. assumption. apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption. - unfold sin in |- *; case (exist_sin (Rsqr a)). + unfold sin; case (exist_sin (Rsqr a)). intros; cut (x = x0). - intro; rewrite H3; unfold Rdiv in |- *. - symmetry in |- *; apply Rinv_r_simpl_m; assumption. + intro; rewrite H3; unfold Rdiv. + symmetry ; apply Rinv_r_simpl_m; assumption. unfold sin_in in p; unfold sin_in in s; eapply uniqueness_sum. apply p. apply s. @@ -187,16 +188,16 @@ Proof. split; apply Ropp_le_contravar; assumption. replace (- sum_f_R0 (tg_alt Un) (S (2 * n))) with (-1 * sum_f_R0 (tg_alt Un) (S (2 * n))); [ rewrite scal_sum | ring ]. - apply sum_eq; intros; unfold sin_term, Un, tg_alt in |- *; + apply sum_eq; intros; unfold sin_term, Un, tg_alt; replace ((-1) ^ S i) with (-1 * (-1) ^ i). - unfold Rdiv in |- *; ring. + unfold Rdiv; ring. reflexivity. replace (- sum_f_R0 (tg_alt Un) (2 * n)) with (-1 * sum_f_R0 (tg_alt Un) (2 * n)); [ rewrite scal_sum | ring ]. apply sum_eq; intros. - unfold sin_term, Un, tg_alt in |- *; + unfold sin_term, Un, tg_alt; replace ((-1) ^ S i) with (-1 * (-1) ^ i). - unfold Rdiv in |- *; ring. + unfold Rdiv; ring. reflexivity. replace (2 * (n + 1))%nat with (S (S (2 * n))). reflexivity. @@ -212,7 +213,7 @@ Proof. apply Rplus_le_reg_l with (- a). rewrite <- Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_l; rewrite (Rplus_comm (- a)); apply H3. - unfold sin_term in |- *; simpl in |- *; unfold Rdiv in |- *; rewrite Rinv_1; + unfold sin_term; simpl; unfold Rdiv; rewrite Rinv_1; ring. replace (2 * (n + 1))%nat with (S (S (2 * n))). apply lt_O_Sn. @@ -220,27 +221,26 @@ Proof. replace (2 * n + 1)%nat with (S (2 * n)). apply lt_O_Sn. ring. - inversion H; [ assumption | elim Hyp_a; symmetry in |- *; assumption ]. + inversion H; [ assumption | elim Hyp_a; symmetry ; assumption ]. Qed. (**********) -Lemma cos_bound : +Lemma pre_cos_bound : forall (a:R) (n:nat), - - PI / 2 <= a -> - a <= PI / 2 -> + - 2 <= a -> a <= 2 -> cos_approx a (2 * n + 1) <= cos a <= cos_approx a (2 * (n + 1)). Proof. cut ((forall (a:R) (n:nat), 0 <= a -> - a <= PI / 2 -> + a <= 2 -> cos_approx a (2 * n + 1) <= cos a <= cos_approx a (2 * (n + 1))) -> forall (a:R) (n:nat), - - PI / 2 <= a -> - a <= PI / 2 -> + - 2 <= a -> + a <= 2 -> cos_approx a (2 * n + 1) <= cos a <= cos_approx a (2 * (n + 1))). intros H a n; apply H. - intros; unfold cos_approx in |- *. + intros; unfold cos_approx. rewrite (decomp_sum (cos_term a0) (2 * n0 + 1)). rewrite (decomp_sum (cos_term a0) (2 * (n0 + 1))). replace (cos_term a0 0) with 1. @@ -266,21 +266,21 @@ Proof. - sum_f_R0 (tg_alt Un) (S (2 * n0))). intro; apply H3. apply alternated_series_ineq. - unfold Un_decreasing in |- *; intro; unfold Un in |- *. + unfold Un_decreasing; intro; unfold Un. cut ((2 * S (S n1))%nat = S (S (2 * S n1))). intro; rewrite H4; replace (a0 ^ S (S (2 * S n1))) with (a0 ^ (2 * S n1) * (a0 * a0)). - unfold Rdiv in |- *; rewrite Rmult_assoc; apply Rmult_le_compat_l. + unfold Rdiv; rewrite Rmult_assoc; apply Rmult_le_compat_l. apply pow_le; assumption. apply Rmult_le_reg_l with (INR (fact (S (S (2 * S n1))))). - rewrite <- H4; apply lt_INR_0; apply neq_O_lt; red in |- *; intro; - assert (H6 := sym_eq H5); elim (fact_neq_0 _ H6). + rewrite <- H4; apply lt_INR_0; apply neq_O_lt; red; intro; + assert (H6 := eq_sym H5); elim (fact_neq_0 _ H6). rewrite <- H4; rewrite (Rmult_comm (INR (fact (2 * S (S n1))))); rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r; rewrite H4; do 2 rewrite fact_simpl; do 2 rewrite mult_INR; repeat rewrite Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_r; do 2 rewrite S_INR; rewrite mult_INR; repeat rewrite S_INR; - simpl in |- *; + simpl; replace (((0 + 1 + 1) * (INR n1 + 1) + 1 + 1) * ((0 + 1 + 1) * (INR n1 + 1) + 1)) with (4 * INR n1 * INR n1 + 14 * INR n1 + 12); [ idtac | ring ]. @@ -289,18 +289,13 @@ Proof. replace 4 with (Rsqr 2); [ idtac | ring_Rsqr ]. replace (a0 * a0) with (Rsqr a0); [ idtac | reflexivity ]. apply Rsqr_incr_1. - apply Rle_trans with (PI / 2). assumption. - unfold Rdiv in |- *; apply Rmult_le_reg_l with 2. - prove_sup0. - rewrite <- Rmult_assoc; rewrite Rinv_r_simpl_m. - replace 4 with 4; [ apply PI_4 | ring ]. discrR. assumption. left; prove_sup0. - pattern 4 at 1 in |- *; rewrite <- Rplus_0_r; replace 12 with (4 + 8); + pattern 4 at 1; rewrite <- Rplus_0_r; replace 12 with (4 + 8); [ apply Rplus_le_compat_l; left; prove_sup0 | ring ]. - rewrite <- (Rplus_comm 12); pattern 12 at 1 in |- *; rewrite <- Rplus_0_r; + rewrite <- (Rplus_comm 12); pattern 12 at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l. apply Rplus_le_le_0_compat. repeat apply Rmult_le_pos. @@ -313,12 +308,12 @@ Proof. replace 0 with (INR 0); [ apply le_INR; apply le_O_n | reflexivity ]. apply INR_fact_neq_0. apply INR_fact_neq_0. - simpl in |- *; ring. + simpl; ring. ring. - assert (H4 := cv_speed_pow_fact a0); unfold Un in |- *; unfold Un_cv in H4; - unfold R_dist in H4; unfold Un_cv in |- *; unfold R_dist in |- *; + assert (H4 := cv_speed_pow_fact a0); unfold Un; unfold Un_cv in H4; + unfold R_dist in H4; unfold Un_cv; unfold R_dist; intros; elim (H4 eps H5); intros N H6; exists N; intros. - apply H6; unfold ge in |- *; apply le_trans with (2 * S N)%nat. + apply H6; unfold ge; apply le_trans with (2 * S N)%nat. apply le_trans with (2 * N)%nat. apply le_n_2n. apply (fun m n p:nat => mult_le_compat_l p n m); apply le_n_Sn. @@ -326,40 +321,40 @@ Proof. assert (X := exist_cos (Rsqr a0)); elim X; intros. cut (x = cos a0). intro; rewrite H4 in p; unfold cos_in in p; unfold infinite_sum in p; - unfold R_dist in p; unfold Un_cv in |- *; unfold R_dist in |- *; + unfold R_dist in p; unfold Un_cv; unfold R_dist; intros. elim (p _ H5); intros N H6. exists N; intros. replace (sum_f_R0 (tg_alt Un) n1) with (1 - sum_f_R0 (fun i:nat => cos_n i * Rsqr a0 ^ i) (S n1)). - unfold Rminus in |- *; rewrite Ropp_plus_distr; rewrite Ropp_involutive; + unfold Rminus; rewrite Ropp_plus_distr; rewrite Ropp_involutive; repeat rewrite Rplus_assoc; rewrite (Rplus_comm 1); rewrite (Rplus_comm (-1)); repeat rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; rewrite <- Rabs_Ropp; rewrite Ropp_plus_distr; rewrite Ropp_involutive; unfold Rminus in H6; apply H6. - unfold ge in |- *; apply le_trans with n1. + unfold ge; apply le_trans with n1. exact H7. apply le_n_Sn. rewrite (decomp_sum (fun i:nat => cos_n i * Rsqr a0 ^ i) (S n1)). replace (cos_n 0) with 1. - simpl in |- *; rewrite Rmult_1_r; unfold Rminus in |- *; + simpl; rewrite Rmult_1_r; unfold Rminus; rewrite Ropp_plus_distr; rewrite <- Rplus_assoc; rewrite Rplus_opp_r; rewrite Rplus_0_l; replace (- sum_f_R0 (fun i:nat => cos_n (S i) * (Rsqr a0 * Rsqr a0 ^ i)) n1) with (-1 * sum_f_R0 (fun i:nat => cos_n (S i) * (Rsqr a0 * Rsqr a0 ^ i)) n1); [ idtac | ring ]; rewrite scal_sum; apply sum_eq; - intros; unfold cos_n, Un, tg_alt in |- *. + intros; unfold cos_n, Un, tg_alt. replace ((-1) ^ S i) with (- (-1) ^ i). replace (a0 ^ (2 * S i)) with (Rsqr a0 * Rsqr a0 ^ i). - unfold Rdiv in |- *; ring. + unfold Rdiv; ring. rewrite pow_Rsqr; reflexivity. - simpl in |- *; ring. - unfold cos_n in |- *; unfold Rdiv in |- *; simpl in |- *; rewrite Rinv_1; + simpl; ring. + unfold cos_n; unfold Rdiv; simpl; rewrite Rinv_1; rewrite Rmult_1_r; reflexivity. apply lt_O_Sn. - unfold cos in |- *; case (exist_cos (Rsqr a0)); intros; unfold cos_in in p; + unfold cos; case (exist_cos (Rsqr a0)); intros; unfold cos_in in p; unfold cos_in in c; eapply uniqueness_sum. apply p. apply c. @@ -368,15 +363,15 @@ Proof. split; apply Ropp_le_contravar; assumption. replace (- sum_f_R0 (tg_alt Un) (S (2 * n0))) with (-1 * sum_f_R0 (tg_alt Un) (S (2 * n0))); [ rewrite scal_sum | ring ]. - apply sum_eq; intros; unfold cos_term, Un, tg_alt in |- *; + apply sum_eq; intros; unfold cos_term, Un, tg_alt; replace ((-1) ^ S i) with (-1 * (-1) ^ i). - unfold Rdiv in |- *; ring. + unfold Rdiv; ring. reflexivity. replace (- sum_f_R0 (tg_alt Un) (2 * n0)) with (-1 * sum_f_R0 (tg_alt Un) (2 * n0)); [ rewrite scal_sum | ring ]; - apply sum_eq; intros; unfold cos_term, Un, tg_alt in |- *; + apply sum_eq; intros; unfold cos_term, Un, tg_alt; replace ((-1) ^ S i) with (-1 * (-1) ^ i). - unfold Rdiv in |- *; ring. + unfold Rdiv; ring. reflexivity. replace (2 * (n0 + 1))%nat with (S (S (2 * n0))). reflexivity. @@ -391,7 +386,7 @@ Proof. apply Rplus_le_reg_l with (-1). rewrite <- Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_l; rewrite (Rplus_comm (-1)); apply H4. - unfold cos_term in |- *; simpl in |- *; unfold Rdiv in |- *; rewrite Rinv_1; + unfold cos_term; simpl; unfold Rdiv; rewrite Rinv_1; ring. replace (2 * (n0 + 1))%nat with (S (S (2 * n0))). apply lt_O_Sn. @@ -407,11 +402,9 @@ Proof. intro; cut (forall (x:R) (n:nat), cos_approx x n = cos_approx (- x) n). intro; rewrite H3; rewrite (H3 a (2 * (n + 1))%nat); rewrite cos_sym; apply H. left; assumption. - rewrite <- (Ropp_involutive (PI / 2)); apply Ropp_le_contravar; - unfold Rdiv in |- *; unfold Rdiv in H0; rewrite <- Ropp_mult_distr_l_reverse; - exact H0. - intros; unfold cos_approx in |- *; apply sum_eq; intros; - unfold cos_term in |- *; do 2 rewrite pow_Rsqr; rewrite Rsqr_neg; - unfold Rdiv in |- *; reflexivity. + rewrite <- (Ropp_involutive 2); apply Ropp_le_contravar; exact H0. + intros; unfold cos_approx; apply sum_eq; intros; + unfold cos_term; do 2 rewrite pow_Rsqr; rewrite Rsqr_neg; + unfold Rdiv; reflexivity. apply Ropp_0_gt_lt_contravar; assumption. Qed. diff --git a/theories/Reals/Rtrigo_calc.v b/theories/Reals/Rtrigo_calc.v index 587c2424..a1a3b007 100644 --- a/theories/Reals/Rtrigo_calc.v +++ b/theories/Reals/Rtrigo_calc.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,13 +9,13 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. -Require Import Rtrigo. +Require Import Rtrigo1. Require Import R_sqrt. -Open Local Scope R_scope. +Local Open Scope R_scope. Lemma tan_PI : tan PI = 0. Proof. - unfold tan in |- *; rewrite sin_PI; rewrite cos_PI; unfold Rdiv in |- *; + unfold tan; rewrite sin_PI; rewrite cos_PI; unfold Rdiv; apply Rmult_0_l. Qed. @@ -23,12 +23,12 @@ Lemma sin_3PI2 : sin (3 * (PI / 2)) = -1. Proof. replace (3 * (PI / 2)) with (PI + PI / 2). rewrite sin_plus; rewrite sin_PI; rewrite cos_PI; rewrite sin_PI2; ring. - pattern PI at 1 in |- *; rewrite (double_var PI); ring. + pattern PI at 1; rewrite (double_var PI); ring. Qed. Lemma tan_2PI : tan (2 * PI) = 0. Proof. - unfold tan in |- *; rewrite sin_2PI; unfold Rdiv in |- *; apply Rmult_0_l. + unfold tan; rewrite sin_2PI; unfold Rdiv; apply Rmult_0_l. Qed. Lemma sin_cos_PI4 : sin (PI / 4) = cos (PI / 4). @@ -37,9 +37,9 @@ Proof with trivial. replace (PI / 2 + PI / 4) with (- (PI / 4) + PI)... rewrite neg_sin; rewrite sin_neg; ring... cut (PI = PI / 2 + PI / 2); [ intro | apply double_var ]... - pattern PI at 2 3 in |- *; rewrite H; pattern PI at 2 3 in |- *; rewrite H... + pattern PI at 2 3; rewrite H; pattern PI at 2 3; rewrite H... assert (H0 : 2 <> 0); - [ discrR | unfold Rdiv in |- *; rewrite Rinv_mult_distr; try ring ]... + [ discrR | unfold Rdiv; rewrite Rinv_mult_distr; try ring ]... Qed. Lemma sin_PI3_cos_PI6 : sin (PI / 3) = cos (PI / 6). @@ -51,7 +51,7 @@ Proof with trivial. assert (H2 : 2 <> 0); [ discrR | idtac ]... apply Rmult_eq_reg_l with 6... rewrite Rmult_minus_distr_l; repeat rewrite (Rmult_comm 6)... - unfold Rdiv in |- *; repeat rewrite Rmult_assoc... + unfold Rdiv; repeat rewrite Rmult_assoc... rewrite <- Rinv_l_sym... rewrite (Rmult_comm (/ 3)); repeat rewrite Rmult_assoc; rewrite <- Rinv_r_sym... rewrite (Rmult_comm PI); repeat rewrite Rmult_1_r; @@ -68,7 +68,7 @@ Proof with trivial. assert (H2 : 2 <> 0); [ discrR | idtac ]... apply Rmult_eq_reg_l with 6... rewrite Rmult_minus_distr_l; repeat rewrite (Rmult_comm 6)... - unfold Rdiv in |- *; repeat rewrite Rmult_assoc... + unfold Rdiv; repeat rewrite Rmult_assoc... rewrite <- Rinv_l_sym... rewrite (Rmult_comm (/ 3)); repeat rewrite Rmult_assoc; rewrite <- Rinv_r_sym... rewrite (Rmult_comm PI); repeat rewrite Rmult_1_r; @@ -78,13 +78,13 @@ Qed. Lemma PI6_RGT_0 : 0 < PI / 6. Proof. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply PI_RGT_0 | apply Rinv_0_lt_compat; prove_sup0 ]. Qed. Lemma PI6_RLT_PI2 : PI / 6 < PI / 2. Proof. - unfold Rdiv in |- *; apply Rmult_lt_compat_l. + unfold Rdiv; apply Rmult_lt_compat_l. apply PI_RGT_0. apply Rinv_lt_contravar; prove_sup. Qed. @@ -97,11 +97,11 @@ Proof with trivial. (2 * sin (PI / 6) * cos (PI / 6))... rewrite <- sin_2a; replace (2 * (PI / 6)) with (PI / 3)... rewrite sin_PI3_cos_PI6... - unfold Rdiv in |- *; rewrite Rmult_1_l; rewrite Rmult_assoc; - pattern 2 at 2 in |- *; rewrite (Rmult_comm 2); rewrite Rmult_assoc; + unfold Rdiv; rewrite Rmult_1_l; rewrite Rmult_assoc; + pattern 2 at 2; rewrite (Rmult_comm 2); rewrite Rmult_assoc; rewrite <- Rinv_l_sym... rewrite Rmult_1_r... - unfold Rdiv in |- *; rewrite Rinv_mult_distr... + unfold Rdiv; rewrite Rinv_mult_distr... rewrite (Rmult_comm (/ 2)); rewrite (Rmult_comm 2); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym... rewrite Rmult_1_r... @@ -119,7 +119,7 @@ Lemma sqrt2_neq_0 : sqrt 2 <> 0. Proof. assert (Hyp : 0 < 2); [ prove_sup0 - | generalize (Rlt_le 0 2 Hyp); intro H1; red in |- *; intro H2; + | generalize (Rlt_le 0 2 Hyp); intro H1; red; intro H2; generalize (sqrt_eq_0 2 H1 H2); intro H; absurd (2 = 0); [ discrR | assumption ] ]. Qed. @@ -137,7 +137,7 @@ Proof. [ discrR | assert (Hyp : 0 < 3); [ prove_sup0 - | generalize (Rlt_le 0 3 Hyp); intro H1; red in |- *; intro H2; + | generalize (Rlt_le 0 3 Hyp); intro H1; red; intro H2; generalize (sqrt_eq_0 3 H1 H2); intro H; absurd (3 = 0); [ discrR | assumption ] ] ]. Qed. @@ -150,7 +150,7 @@ Proof. intro H2; [ assumption | absurd (0 = sqrt 2); - [ apply (sym_not_eq (A:=R)); apply sqrt2_neq_0 | assumption ] ] ]. + [ apply (not_eq_sym (A:=R)); apply sqrt2_neq_0 | assumption ] ] ]. Qed. Lemma Rlt_sqrt3_0 : 0 < sqrt 3. @@ -162,7 +162,7 @@ Proof. [ prove_sup0 | generalize (Rlt_le 0 3 Hyp2); intro H2; generalize (lt_INR_0 1 (neq_O_lt 1 H0)); - unfold INR in |- *; intro H3; + unfold INR; intro H3; generalize (Rplus_lt_compat_l 2 0 1 H3); rewrite Rplus_comm; rewrite Rplus_0_l; replace (2 + 1) with 3; [ intro H4; generalize (sqrt_lt_1 2 3 H1 H2 H4); clear H3; intro H3; @@ -173,7 +173,7 @@ Qed. Lemma PI4_RGT_0 : 0 < PI / 4. Proof. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ apply PI_RGT_0 | apply Rinv_0_lt_compat; prove_sup0 ]. Qed. @@ -189,17 +189,17 @@ Proof with trivial. rewrite Rsqr_div... rewrite Rsqr_1; rewrite Rsqr_sqrt... assert (H : 2 <> 0); [ discrR | idtac ]... - unfold Rsqr in |- *; pattern (cos (PI / 4)) at 1 in |- *; + unfold Rsqr; pattern (cos (PI / 4)) at 1; rewrite <- sin_cos_PI4; replace (sin (PI / 4) * cos (PI / 4)) with (1 / 2 * (2 * sin (PI / 4) * cos (PI / 4)))... rewrite <- sin_2a; replace (2 * (PI / 4)) with (PI / 2)... rewrite sin_PI2... apply Rmult_1_r... - unfold Rdiv in |- *; rewrite (Rmult_comm 2); rewrite Rinv_mult_distr... + unfold Rdiv; rewrite (Rmult_comm 2); rewrite Rinv_mult_distr... repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym... rewrite Rmult_1_r... - unfold Rdiv in |- *; rewrite Rmult_1_l; repeat rewrite <- Rmult_assoc... + unfold Rdiv; rewrite Rmult_1_l; repeat rewrite <- Rmult_assoc... rewrite <- Rinv_l_sym... rewrite Rmult_1_l... left; prove_sup... @@ -213,18 +213,18 @@ Qed. Lemma tan_PI4 : tan (PI / 4) = 1. Proof. - unfold tan in |- *; rewrite sin_cos_PI4. - unfold Rdiv in |- *; apply Rinv_r. - change (cos (PI / 4) <> 0) in |- *; rewrite cos_PI4; apply R1_sqrt2_neq_0. + unfold tan; rewrite sin_cos_PI4. + unfold Rdiv; apply Rinv_r. + change (cos (PI / 4) <> 0); rewrite cos_PI4; apply R1_sqrt2_neq_0. Qed. Lemma cos3PI4 : cos (3 * (PI / 4)) = -1 / sqrt 2. Proof with trivial. replace (3 * (PI / 4)) with (PI / 2 - - (PI / 4))... rewrite cos_shift; rewrite sin_neg; rewrite sin_PI4... - unfold Rdiv in |- *; rewrite Ropp_mult_distr_l_reverse... - unfold Rminus in |- *; rewrite Ropp_involutive; pattern PI at 1 in |- *; - rewrite double_var; unfold Rdiv in |- *; rewrite Rmult_plus_distr_r; + unfold Rdiv; rewrite Ropp_mult_distr_l_reverse... + unfold Rminus; rewrite Ropp_involutive; pattern PI at 1; + rewrite double_var; unfold Rdiv; rewrite Rmult_plus_distr_r; repeat rewrite Rmult_assoc; rewrite <- Rinv_mult_distr; [ ring | discrR | discrR ]... Qed. @@ -233,8 +233,8 @@ Lemma sin3PI4 : sin (3 * (PI / 4)) = 1 / sqrt 2. Proof with trivial. replace (3 * (PI / 4)) with (PI / 2 - - (PI / 4))... rewrite sin_shift; rewrite cos_neg; rewrite cos_PI4... - unfold Rminus in |- *; rewrite Ropp_involutive; pattern PI at 1 in |- *; - rewrite double_var; unfold Rdiv in |- *; rewrite Rmult_plus_distr_r; + unfold Rminus; rewrite Ropp_involutive; pattern PI at 1; + rewrite double_var; unfold Rdiv; rewrite Rmult_plus_distr_r; repeat rewrite Rmult_assoc; rewrite <- Rinv_mult_distr; [ ring | discrR | discrR ]... Qed. @@ -251,8 +251,8 @@ Proof with trivial. assert (H : 2 <> 0); [ discrR | idtac ]... assert (H1 : 4 <> 0); [ apply prod_neq_R0 | idtac ]... rewrite Rsqr_div... - rewrite cos2; unfold Rsqr in |- *; rewrite sin_PI6; rewrite sqrt_def... - unfold Rdiv in |- *; rewrite Rmult_1_l; apply Rmult_eq_reg_l with 4... + rewrite cos2; unfold Rsqr; rewrite sin_PI6; rewrite sqrt_def... + unfold Rdiv; rewrite Rmult_1_l; apply Rmult_eq_reg_l with 4... rewrite Rmult_minus_distr_l; rewrite (Rmult_comm 3); repeat rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym... rewrite Rmult_1_l; rewrite Rmult_1_r... @@ -265,14 +265,14 @@ Qed. Lemma tan_PI6 : tan (PI / 6) = 1 / sqrt 3. Proof. - unfold tan in |- *; rewrite sin_PI6; rewrite cos_PI6; unfold Rdiv in |- *; + unfold tan; rewrite sin_PI6; rewrite cos_PI6; unfold Rdiv; repeat rewrite Rmult_1_l; rewrite Rinv_mult_distr. rewrite Rinv_involutive. rewrite (Rmult_comm (/ 2)); rewrite Rmult_assoc; rewrite <- Rinv_r_sym. apply Rmult_1_r. discrR. discrR. - red in |- *; intro; assert (H1 := Rlt_sqrt3_0); rewrite H in H1; + red; intro; assert (H1 := Rlt_sqrt3_0); rewrite H in H1; elim (Rlt_irrefl 0 H1). apply Rinv_neq_0_compat; discrR. Qed. @@ -289,7 +289,7 @@ Qed. Lemma tan_PI3 : tan (PI / 3) = sqrt 3. Proof. - unfold tan in |- *; rewrite sin_PI3; rewrite cos_PI3; unfold Rdiv in |- *; + unfold tan; rewrite sin_PI3; rewrite cos_PI3; unfold Rdiv; rewrite Rmult_1_l; rewrite Rinv_involutive. rewrite Rmult_assoc; rewrite <- Rinv_l_sym. apply Rmult_1_r. @@ -300,7 +300,7 @@ Qed. Lemma sin_2PI3 : sin (2 * (PI / 3)) = sqrt 3 / 2. Proof. rewrite double; rewrite sin_plus; rewrite sin_PI3; rewrite cos_PI3; - unfold Rdiv in |- *; repeat rewrite Rmult_1_l; rewrite (Rmult_comm (/ 2)); + unfold Rdiv; repeat rewrite Rmult_1_l; rewrite (Rmult_comm (/ 2)); repeat rewrite <- Rmult_assoc; rewrite double_var; reflexivity. Qed. @@ -310,12 +310,12 @@ Proof with trivial. assert (H : 2 <> 0); [ discrR | idtac ]... assert (H0 : 4 <> 0); [ apply prod_neq_R0 | idtac ]... rewrite double; rewrite cos_plus; rewrite sin_PI3; rewrite cos_PI3; - unfold Rdiv in |- *; rewrite Rmult_1_l; apply Rmult_eq_reg_l with 4... + unfold Rdiv; rewrite Rmult_1_l; apply Rmult_eq_reg_l with 4... rewrite Rmult_minus_distr_l; repeat rewrite Rmult_assoc; rewrite (Rmult_comm 2)... repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym... rewrite Rmult_1_r; rewrite <- Rinv_r_sym... - pattern 2 at 4 in |- *; rewrite (Rmult_comm 2); repeat rewrite Rmult_assoc; + pattern 2 at 4; rewrite (Rmult_comm 2); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym... rewrite Rmult_1_r; rewrite Ropp_mult_distr_r_reverse; rewrite Rmult_1_r... rewrite (Rmult_comm 2); repeat rewrite Rmult_assoc; rewrite <- Rinv_l_sym... @@ -329,7 +329,7 @@ Qed. Lemma tan_2PI3 : tan (2 * (PI / 3)) = - sqrt 3. Proof with trivial. assert (H : 2 <> 0); [ discrR | idtac ]... - unfold tan in |- *; rewrite sin_2PI3; rewrite cos_2PI3; unfold Rdiv in |- *; + unfold tan; rewrite sin_2PI3; rewrite cos_2PI3; unfold Rdiv; rewrite Ropp_mult_distr_l_reverse; rewrite Rmult_1_l; rewrite <- Ropp_inv_permute... rewrite Rinv_involutive... @@ -341,21 +341,21 @@ Qed. Lemma cos_5PI4 : cos (5 * (PI / 4)) = -1 / sqrt 2. Proof with trivial. replace (5 * (PI / 4)) with (PI / 4 + PI)... - rewrite neg_cos; rewrite cos_PI4; unfold Rdiv in |- *; + rewrite neg_cos; rewrite cos_PI4; unfold Rdiv; rewrite Ropp_mult_distr_l_reverse... - pattern PI at 2 in |- *; rewrite double_var; pattern PI at 2 3 in |- *; + pattern PI at 2; rewrite double_var; pattern PI at 2 3; rewrite double_var; assert (H : 2 <> 0); - [ discrR | unfold Rdiv in |- *; repeat rewrite Rinv_mult_distr; try ring ]... + [ discrR | unfold Rdiv; repeat rewrite Rinv_mult_distr; try ring ]... Qed. Lemma sin_5PI4 : sin (5 * (PI / 4)) = -1 / sqrt 2. Proof with trivial. replace (5 * (PI / 4)) with (PI / 4 + PI)... - rewrite neg_sin; rewrite sin_PI4; unfold Rdiv in |- *; + rewrite neg_sin; rewrite sin_PI4; unfold Rdiv; rewrite Ropp_mult_distr_l_reverse... - pattern PI at 2 in |- *; rewrite double_var; pattern PI at 2 3 in |- *; + pattern PI at 2; rewrite double_var; pattern PI at 2 3; rewrite double_var; assert (H : 2 <> 0); - [ discrR | unfold Rdiv in |- *; repeat rewrite Rinv_mult_distr; try ring ]... + [ discrR | unfold Rdiv; repeat rewrite Rinv_mult_distr; try ring ]... Qed. Lemma sin_cos5PI4 : cos (5 * (PI / 4)) = sin (5 * (PI / 4)). @@ -367,7 +367,7 @@ Lemma Rgt_3PI2_0 : 0 < 3 * (PI / 2). Proof. apply Rmult_lt_0_compat; [ prove_sup0 - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ apply PI_RGT_0 | apply Rinv_0_lt_compat; prove_sup0 ] ]. Qed. @@ -382,7 +382,7 @@ Proof. generalize (Rplus_lt_compat_l PI 0 (PI / 2) H1); replace (PI + PI / 2) with (3 * (PI / 2)). rewrite Rplus_0_r; intro H2; assumption. - pattern PI at 2 in |- *; rewrite double_var; ring. + pattern PI at 2; rewrite double_var; ring. Qed. Lemma Rlt_3PI2_2PI : 3 * (PI / 2) < 2 * PI. @@ -391,7 +391,7 @@ Proof. generalize (Rplus_lt_compat_l (3 * (PI / 2)) 0 (PI / 2) H1); replace (3 * (PI / 2) + PI / 2) with (2 * PI). rewrite Rplus_0_r; intro H2; assumption. - rewrite double; pattern PI at 1 2 in |- *; rewrite double_var; ring. + rewrite double; pattern PI at 1 2; rewrite double_var; ring. Qed. (***************************************************************) @@ -404,13 +404,13 @@ Definition toDeg (x:R) : R := x * plat * / PI. Lemma rad_deg : forall x:R, toRad (toDeg x) = x. Proof. - intro; unfold toRad, toDeg in |- *; + intro; unfold toRad, toDeg; replace (x * plat * / PI * PI * / plat) with (x * (plat * / plat) * (PI * / PI)); [ idtac | ring ]. repeat rewrite <- Rinv_r_sym. ring. apply PI_neq0. - unfold plat in |- *; discrR. + unfold plat; discrR. Qed. Lemma toRad_inj : forall x y:R, toRad x = toRad y -> x = y. @@ -420,7 +420,7 @@ Proof. apply Rmult_eq_reg_l with (/ plat). rewrite <- (Rmult_comm (x * PI)); rewrite <- (Rmult_comm (y * PI)); assumption. - apply Rinv_neq_0_compat; unfold plat in |- *; discrR. + apply Rinv_neq_0_compat; unfold plat; discrR. apply PI_neq0. Qed. @@ -435,7 +435,7 @@ Definition tand (x:R) : R := tan (toRad x). Lemma Rsqr_sin_cos_d_one : forall x:R, Rsqr (sind x) + Rsqr (cosd x) = 1. Proof. - intro x; unfold sind in |- *; unfold cosd in |- *; apply sin2_cos2. + intro x; unfold sind; unfold cosd; apply sin2_cos2. Qed. (***************************************************) @@ -447,10 +447,10 @@ Proof. intros; case (Rtotal_order 0 a); intro. left; apply sin_lb_gt_0; assumption. elim H1; intro. - rewrite <- H2; unfold sin_lb in |- *; unfold sin_approx in |- *; - unfold sum_f_R0 in |- *; unfold sin_term in |- *; + rewrite <- H2; unfold sin_lb; unfold sin_approx; + unfold sum_f_R0; unfold sin_term; repeat rewrite pow_ne_zero. - unfold Rdiv in |- *; repeat rewrite Rmult_0_l; repeat rewrite Rmult_0_r; + unfold Rdiv; repeat rewrite Rmult_0_l; repeat rewrite Rmult_0_r; repeat rewrite Rplus_0_r; right; reflexivity. discriminate. discriminate. diff --git a/theories/Reals/Rtrigo_def.v b/theories/Reals/Rtrigo_def.v index c6493135..f3e69037 100644 --- a/theories/Reals/Rtrigo_def.v +++ b/theories/Reals/Rtrigo_def.v @@ -1,13 +1,13 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (************************************************************************) Require Import Rbase Rfunctions SeqSeries Rtrigo_fun Max. -Open Local Scope R_scope. +Local Open Scope R_scope. (********************************) (** * Definition of exponential *) @@ -27,7 +27,7 @@ Proof. intro; generalize (Alembert_C3 (fun n:nat => / INR (fact n)) x exp_cof_no_R0 Alembert_exp). - unfold Pser, exp_in in |- *. + unfold Pser, exp_in. trivial. Defined. @@ -36,24 +36,24 @@ Definition exp (x:R) : R := proj1_sig (exist_exp x). Lemma pow_i : forall i:nat, (0 < i)%nat -> 0 ^ i = 0. Proof. intros; apply pow_ne_zero. - red in |- *; intro; rewrite H0 in H; elim (lt_irrefl _ H). + red; intro; rewrite H0 in H; elim (lt_irrefl _ H). Qed. Lemma exist_exp0 : { l:R | exp_in 0 l }. Proof. exists 1. - unfold exp_in in |- *; unfold infinite_sum in |- *; intros. + unfold exp_in; unfold infinite_sum; intros. exists 0%nat. intros; replace (sum_f_R0 (fun i:nat => / INR (fact i) * 0 ^ i) n) with 1. - unfold R_dist in |- *; replace (1 - 1) with 0; + unfold R_dist; replace (1 - 1) with 0; [ rewrite Rabs_R0; assumption | ring ]. induction n as [| n Hrecn]. - simpl in |- *; rewrite Rinv_1; ring. + simpl; rewrite Rinv_1; ring. rewrite tech5. rewrite <- Hrecn. - simpl in |- *. + simpl. ring. - unfold ge in |- *; apply le_O_n. + unfold ge; apply le_O_n. Defined. (* Value of [exp 0] *) @@ -61,7 +61,7 @@ Lemma exp_0 : exp 0 = 1. Proof. cut (exp_in 0 (exp 0)). cut (exp_in 0 1). - unfold exp_in in |- *; intros; eapply uniqueness_sum. + unfold exp_in; intros; eapply uniqueness_sum. apply H0. apply H. exact (proj2_sig exist_exp0). @@ -77,14 +77,14 @@ Definition tanh (x:R) : R := sinh x / cosh x. Lemma cosh_0 : cosh 0 = 1. Proof. - unfold cosh in |- *; rewrite Ropp_0; rewrite exp_0. - unfold Rdiv in |- *; rewrite <- Rinv_r_sym; [ reflexivity | discrR ]. + unfold cosh; rewrite Ropp_0; rewrite exp_0. + unfold Rdiv; rewrite <- Rinv_r_sym; [ reflexivity | discrR ]. Qed. Lemma sinh_0 : sinh 0 = 0. Proof. - unfold sinh in |- *; rewrite Ropp_0; rewrite exp_0. - unfold Rminus, Rdiv in |- *; rewrite Rplus_opp_r; apply Rmult_0_l. + unfold sinh; rewrite Ropp_0; rewrite exp_0. + unfold Rminus, Rdiv; rewrite Rplus_opp_r; apply Rmult_0_l. Qed. Definition cos_n (n:nat) : R := (-1) ^ n / INR (fact (2 * n)). @@ -92,8 +92,8 @@ Definition cos_n (n:nat) : R := (-1) ^ n / INR (fact (2 * n)). Lemma simpl_cos_n : forall n:nat, cos_n (S n) / cos_n n = - / INR (2 * S n * (2 * n + 1)). Proof. - intro; unfold cos_n in |- *; replace (S n) with (n + 1)%nat; [ idtac | ring ]. - rewrite pow_add; unfold Rdiv in |- *; rewrite Rinv_mult_distr. + intro; unfold cos_n; replace (S n) with (n + 1)%nat; [ idtac | ring ]. + rewrite pow_add; unfold Rdiv; rewrite Rinv_mult_distr. rewrite Rinv_involutive. replace ((-1) ^ n * (-1) ^ 1 * / INR (fact (2 * (n + 1))) * @@ -101,7 +101,7 @@ Proof. ((-1) ^ n * / (-1) ^ n * / INR (fact (2 * (n + 1))) * INR (fact (2 * n)) * (-1) ^ 1); [ idtac | ring ]. rewrite <- Rinv_r_sym. - rewrite Rmult_1_l; unfold pow in |- *; rewrite Rmult_1_r. + rewrite Rmult_1_l; unfold pow; rewrite Rmult_1_r. replace (2 * (n + 1))%nat with (S (S (2 * n))); [ idtac | ring ]. do 2 rewrite fact_simpl; do 2 rewrite mult_INR; repeat rewrite Rinv_mult_distr; try (apply not_O_INR; discriminate). @@ -130,29 +130,29 @@ Proof. intro; cut (0 <= up (/ eps))%Z. intro; assert (H2 := IZN _ H1); elim H2; intros; exists (max x 1). split. - cut (0 < IZR (Z_of_nat x)). - intro; rewrite INR_IZR_INZ; apply Rle_lt_trans with (/ IZR (Z_of_nat x)). - apply Rmult_le_reg_l with (IZR (Z_of_nat x)). + cut (0 < IZR (Z.of_nat x)). + intro; rewrite INR_IZR_INZ; apply Rle_lt_trans with (/ IZR (Z.of_nat x)). + apply Rmult_le_reg_l with (IZR (Z.of_nat x)). assumption. rewrite <- Rinv_r_sym; - [ idtac | red in |- *; intro; rewrite H5 in H4; elim (Rlt_irrefl _ H4) ]. - apply Rmult_le_reg_l with (IZR (Z_of_nat (max x 1))). - apply Rlt_le_trans with (IZR (Z_of_nat x)). + [ idtac | red; intro; rewrite H5 in H4; elim (Rlt_irrefl _ H4) ]. + apply Rmult_le_reg_l with (IZR (Z.of_nat (max x 1))). + apply Rlt_le_trans with (IZR (Z.of_nat x)). assumption. repeat rewrite <- INR_IZR_INZ; apply le_INR; apply le_max_l. - rewrite Rmult_1_r; rewrite (Rmult_comm (IZR (Z_of_nat (max x 1)))); + rewrite Rmult_1_r; rewrite (Rmult_comm (IZR (Z.of_nat (max x 1)))); rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r; repeat rewrite <- INR_IZR_INZ; apply le_INR; apply le_max_l. rewrite <- INR_IZR_INZ; apply not_O_INR. - red in |- *; intro; assert (H6 := le_max_r x 1); cut (0 < 1)%nat; + red; intro; assert (H6 := le_max_r x 1); cut (0 < 1)%nat; [ intro | apply lt_O_Sn ]; assert (H8 := lt_le_trans _ _ _ H7 H6); rewrite H5 in H8; elim (lt_irrefl _ H8). - pattern eps at 1 in |- *; rewrite <- Rinv_involutive. + pattern eps at 1; rewrite <- Rinv_involutive. apply Rinv_lt_contravar. apply Rmult_lt_0_compat; [ apply Rinv_0_lt_compat; assumption | assumption ]. rewrite H3 in H0; assumption. - red in |- *; intro; rewrite H5 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H5 in H; elim (Rlt_irrefl _ H). apply Rlt_trans with (/ eps). apply Rinv_0_lt_compat; assumption. rewrite H3 in H0; assumption. @@ -166,10 +166,10 @@ Qed. Lemma Alembert_cos : Un_cv (fun n:nat => Rabs (cos_n (S n) / cos_n n)) 0. Proof. - unfold Un_cv in |- *; intros. + unfold Un_cv; intros. assert (H0 := archimed_cor1 eps H). elim H0; intros; exists x. - intros; rewrite simpl_cos_n; unfold R_dist in |- *; unfold Rminus in |- *; + intros; rewrite simpl_cos_n; unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite Rabs_Rabsolu; rewrite Rabs_Ropp; rewrite Rabs_right. rewrite mult_INR; rewrite Rinv_mult_distr. @@ -177,7 +177,7 @@ Proof. intro; cut (/ INR (2 * n + 1) < eps). intro; rewrite <- (Rmult_1_l eps). apply Rmult_gt_0_lt_compat; try assumption. - change (0 < / INR (2 * n + 1)) in |- *; apply Rinv_0_lt_compat; + change (0 < / INR (2 * n + 1)); apply Rinv_0_lt_compat; apply lt_INR_0. replace (2 * n + 1)%nat with (S (2 * n)); [ apply lt_O_Sn | ring ]. apply Rlt_0_1. @@ -221,7 +221,7 @@ Proof. Qed. Lemma cosn_no_R0 : forall n:nat, cos_n n <> 0. - intro; unfold cos_n in |- *; unfold Rdiv in |- *; apply prod_neq_R0. + intro; unfold cos_n; unfold Rdiv; apply prod_neq_R0. apply pow_nonzero; discrR. apply Rinv_neq_0_compat. apply INR_fact_neq_0. @@ -234,7 +234,7 @@ Definition cos_in (x l:R) : Prop := (**********) Lemma exist_cos : forall x:R, { l:R | cos_in x l }. intro; generalize (Alembert_C3 cos_n x cosn_no_R0 Alembert_cos). - unfold Pser, cos_in in |- *; trivial. + unfold Pser, cos_in; trivial. Qed. @@ -246,8 +246,8 @@ Definition sin_n (n:nat) : R := (-1) ^ n / INR (fact (2 * n + 1)). Lemma simpl_sin_n : forall n:nat, sin_n (S n) / sin_n n = - / INR ((2 * S n + 1) * (2 * S n)). Proof. - intro; unfold sin_n in |- *; replace (S n) with (n + 1)%nat; [ idtac | ring ]. - rewrite pow_add; unfold Rdiv in |- *; rewrite Rinv_mult_distr. + intro; unfold sin_n; replace (S n) with (n + 1)%nat; [ idtac | ring ]. + rewrite pow_add; unfold Rdiv; rewrite Rinv_mult_distr. rewrite Rinv_involutive. replace ((-1) ^ n * (-1) ^ 1 * / INR (fact (2 * (n + 1) + 1)) * @@ -255,7 +255,7 @@ Proof. ((-1) ^ n * / (-1) ^ n * / INR (fact (2 * (n + 1) + 1)) * INR (fact (2 * n + 1)) * (-1) ^ 1); [ idtac | ring ]. rewrite <- Rinv_r_sym. - rewrite Rmult_1_l; unfold pow in |- *; rewrite Rmult_1_r; + rewrite Rmult_1_l; unfold pow; rewrite Rmult_1_r; replace (2 * (n + 1) + 1)%nat with (S (S (2 * n + 1))). do 2 rewrite fact_simpl; do 2 rewrite mult_INR; repeat rewrite Rinv_mult_distr. @@ -291,9 +291,9 @@ Qed. Lemma Alembert_sin : Un_cv (fun n:nat => Rabs (sin_n (S n) / sin_n n)) 0. Proof. - unfold Un_cv in |- *; intros; assert (H0 := archimed_cor1 eps H). + unfold Un_cv; intros; assert (H0 := archimed_cor1 eps H). elim H0; intros; exists x. - intros; rewrite simpl_sin_n; unfold R_dist in |- *; unfold Rminus in |- *; + intros; rewrite simpl_sin_n; unfold R_dist; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite Rabs_Rabsolu; rewrite Rabs_Ropp; rewrite Rabs_right. rewrite mult_INR; rewrite Rinv_mult_distr. @@ -301,7 +301,7 @@ Proof. intro; cut (/ INR (2 * S n + 1) < eps). intro; rewrite <- (Rmult_1_l eps); rewrite (Rmult_comm (/ INR (2 * S n + 1))); apply Rmult_gt_0_lt_compat; try assumption. - change (0 < / INR (2 * S n + 1)) in |- *; apply Rinv_0_lt_compat; + change (0 < / INR (2 * S n + 1)); apply Rinv_0_lt_compat; apply lt_INR_0; replace (2 * S n + 1)%nat with (S (2 * S n)); [ apply lt_O_Sn | ring ]. apply Rlt_0_1. @@ -329,7 +329,7 @@ Proof. apply not_O_INR; discriminate. apply not_O_INR; discriminate. apply not_O_INR; discriminate. - left; change (0 < / INR ((2 * S n + 1) * (2 * S n))) in |- *; + left; change (0 < / INR ((2 * S n + 1) * (2 * S n))); apply Rinv_0_lt_compat. apply lt_INR_0. replace ((2 * S n + 1) * (2 * S n))%nat with @@ -342,7 +342,7 @@ Defined. Lemma sin_no_R0 : forall n:nat, sin_n n <> 0. Proof. - intro; unfold sin_n in |- *; unfold Rdiv in |- *; apply prod_neq_R0. + intro; unfold sin_n; unfold Rdiv; apply prod_neq_R0. apply pow_nonzero; discrR. apply Rinv_neq_0_compat; apply INR_fact_neq_0. Qed. @@ -355,7 +355,7 @@ Definition sin_in (x l:R) : Prop := Lemma exist_sin : forall x:R, { l:R | sin_in x l }. Proof. intro; generalize (Alembert_C3 sin_n x sin_no_R0 Alembert_sin). - unfold Pser, sin_n in |- *; trivial. + unfold Pser, sin_n; trivial. Defined. (***********************) @@ -368,40 +368,40 @@ Definition sin (x:R) : R := let (a,_) := exist_sin (Rsqr x) in x * a. Lemma cos_sym : forall x:R, cos x = cos (- x). Proof. - intros; unfold cos in |- *; replace (Rsqr (- x)) with (Rsqr x). + intros; unfold cos; replace (Rsqr (- x)) with (Rsqr x). reflexivity. apply Rsqr_neg. Qed. Lemma sin_antisym : forall x:R, sin (- x) = - sin x. Proof. - intro; unfold sin in |- *; replace (Rsqr (- x)) with (Rsqr x); + intro; unfold sin; replace (Rsqr (- x)) with (Rsqr x); [ idtac | apply Rsqr_neg ]. case (exist_sin (Rsqr x)); intros; ring. Qed. Lemma sin_0 : sin 0 = 0. Proof. - unfold sin in |- *; case (exist_sin (Rsqr 0)). + unfold sin; case (exist_sin (Rsqr 0)). intros; ring. Qed. Lemma exist_cos0 : { l:R | cos_in 0 l }. Proof. exists 1. - unfold cos_in in |- *; unfold infinite_sum in |- *; intros; exists 0%nat. + unfold cos_in; unfold infinite_sum; intros; exists 0%nat. intros. - unfold R_dist in |- *. + unfold R_dist. induction n as [| n Hrecn]. - unfold cos_n in |- *; simpl in |- *. - unfold Rdiv in |- *; rewrite Rinv_1. + unfold cos_n; simpl. + unfold Rdiv; rewrite Rinv_1. do 2 rewrite Rmult_1_r. - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. rewrite tech5. replace (cos_n (S n) * 0 ^ S n) with 0. rewrite Rplus_0_r. - apply Hrecn; unfold ge in |- *; apply le_O_n. - simpl in |- *; ring. + apply Hrecn; unfold ge; apply le_O_n. + simpl; ring. Defined. (* Value of [cos 0] *) @@ -409,10 +409,10 @@ Lemma cos_0 : cos 0 = 1. Proof. cut (cos_in 0 (cos 0)). cut (cos_in 0 1). - unfold cos_in in |- *; intros; eapply uniqueness_sum. + unfold cos_in; intros; eapply uniqueness_sum. apply H0. apply H. exact (proj2_sig exist_cos0). - assert (H := proj2_sig (exist_cos (Rsqr 0))); unfold cos in |- *; - pattern 0 at 1 in |- *; replace 0 with (Rsqr 0); [ exact H | apply Rsqr_0 ]. + assert (H := proj2_sig (exist_cos (Rsqr 0))); unfold cos; + pattern 0 at 1; replace 0 with (Rsqr 0); [ exact H | apply Rsqr_0 ]. Qed. diff --git a/theories/Reals/Rtrigo_fun.v b/theories/Reals/Rtrigo_fun.v index b7720141..b131b510 100644 --- a/theories/Reals/Rtrigo_fun.v +++ b/theories/Reals/Rtrigo_fun.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,7 +9,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. -Open Local Scope R_scope. +Local Open Scope R_scope. (*****************************************************************) (** To define transcendental functions *) @@ -20,8 +20,8 @@ Open Local Scope R_scope. Lemma Alembert_exp : Un_cv (fun n:nat => Rabs (/ INR (fact (S n)) * / / INR (fact n))) 0. Proof. - unfold Un_cv in |- *; intros; elim (Rgt_dec eps 1); intro. - split with 0%nat; intros; rewrite (simpl_fact n); unfold R_dist in |- *; + unfold Un_cv; intros; elim (Rgt_dec eps 1); intro. + split with 0%nat; intros; rewrite (simpl_fact n); unfold R_dist; rewrite (Rminus_0_r (Rabs (/ INR (S n)))); rewrite (Rabs_Rabsolu (/ INR (S n))); cut (/ INR (S n) > 0). intro; rewrite (Rabs_pos_eq (/ INR (S n))). @@ -39,7 +39,7 @@ Proof. in H4; rewrite (let (H1, H2) := Rmult_ne (/ INR (S n)) in H1) in H4; rewrite (Rmult_comm (/ INR (S n))) in H4; rewrite (Rmult_assoc eps (/ INR (S n)) (INR (S n))) in H4; - rewrite (Rinv_l (INR (S n)) (not_O_INR (S n) (sym_not_equal (O_S n)))) in H4; + rewrite (Rinv_l (INR (S n)) (not_O_INR (S n) (not_eq_sym (O_S n)))) in H4; rewrite (let (H1, H2) := Rmult_ne eps in H1) in H4; assumption. apply Rlt_minus; unfold Rgt in a; rewrite <- Rinv_1; @@ -47,11 +47,11 @@ Proof. rewrite (let (H1, H2) := Rmult_ne eps in H2); unfold Rgt in H; assumption. unfold Rgt in H1; apply Rlt_le; assumption. - unfold Rgt in |- *; apply Rinv_0_lt_compat; apply lt_INR_0; apply lt_O_Sn. + unfold Rgt; apply Rinv_0_lt_compat; apply lt_INR_0; apply lt_O_Sn. (**) cut (0 <= up (/ eps - 1))%Z. intro; elim (IZN (up (/ eps - 1)) H0); intros; split with x; intros; - rewrite (simpl_fact n); unfold R_dist in |- *; + rewrite (simpl_fact n); unfold R_dist; rewrite (Rminus_0_r (Rabs (/ INR (S n)))); rewrite (Rabs_Rabsolu (/ INR (S n))); cut (/ INR (S n) > 0). intro; rewrite (Rabs_pos_eq (/ INR (S n))). @@ -72,28 +72,28 @@ Proof. in H6; rewrite (let (H1, H2) := Rmult_ne (/ INR (S n)) in H1) in H6; rewrite (Rmult_comm (/ INR (S n))) in H6; rewrite (Rmult_assoc eps (/ INR (S n)) (INR (S n))) in H6; - rewrite (Rinv_l (INR (S n)) (not_O_INR (S n) (sym_not_equal (O_S n)))) in H6; + rewrite (Rinv_l (INR (S n)) (not_O_INR (S n) (not_eq_sym (O_S n)))) in H6; rewrite (let (H1, H2) := Rmult_ne eps in H1) in H6; assumption. - cut (IZR (up (/ eps - 1)) = IZR (Z_of_nat x)); + cut (IZR (up (/ eps - 1)) = IZR (Z.of_nat x)); [ intro | rewrite H1; trivial ]. elim (archimed (/ eps - 1)); intros; clear H6; unfold Rgt in H5; rewrite H4 in H5; rewrite INR_IZR_INZ; assumption. unfold Rgt in H1; apply Rlt_le; assumption. - unfold Rgt in |- *; apply Rinv_0_lt_compat; apply lt_INR_0; apply lt_O_Sn. + unfold Rgt; apply Rinv_0_lt_compat; apply lt_INR_0; apply lt_O_Sn. apply (le_O_IZR (up (/ eps - 1))); apply (Rle_trans 0 (/ eps - 1) (IZR (up (/ eps - 1)))). - generalize (Rnot_gt_le eps 1 b); clear b; unfold Rle in |- *; intro; elim H0; + generalize (Rnot_gt_le eps 1 b); clear b; unfold Rle; intro; elim H0; clear H0; intro. left; unfold Rgt in H; generalize (Rmult_lt_compat_l (/ eps) eps 1 (Rinv_0_lt_compat eps H) H0); rewrite (Rinv_l eps - (sym_not_eq (Rlt_dichotomy_converse 0 eps (or_introl (0 > eps) H)))) + (not_eq_sym (Rlt_dichotomy_converse 0 eps (or_introl (0 > eps) H)))) ; rewrite (let (H1, H2) := Rmult_ne (/ eps) in H1); - intro; fold (/ eps - 1 > 0) in |- *; apply Rgt_minus; - unfold Rgt in |- *; assumption. - right; rewrite H0; rewrite Rinv_1; apply sym_eq; apply Rminus_diag_eq; auto. + intro; fold (/ eps - 1 > 0); apply Rgt_minus; + unfold Rgt; assumption. + right; rewrite H0; rewrite Rinv_1; symmetry; apply Rminus_diag_eq; auto. elim (archimed (/ eps - 1)); intros; clear H1; unfold Rgt in H0; apply Rlt_le; assumption. Qed. diff --git a/theories/Reals/Rtrigo_reg.v b/theories/Reals/Rtrigo_reg.v index 100e0818..fff4fec9 100644 --- a/theories/Reals/Rtrigo_reg.v +++ b/theories/Reals/Rtrigo_reg.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -9,169 +9,23 @@ Require Import Rbase. Require Import Rfunctions. Require Import SeqSeries. -Require Import Rtrigo. +Require Import Rtrigo1. Require Import Ranalysis1. Require Import PSeries_reg. -Open Local Scope nat_scope. -Open Local Scope R_scope. +Local Open Scope nat_scope. +Local Open Scope R_scope. -Lemma CVN_R_cos : - forall fn:nat -> R -> R, - fn = (fun (N:nat) (x:R) => (-1) ^ N / INR (fact (2 * N)) * x ^ (2 * N)) -> - CVN_R fn. -Proof. - unfold CVN_R in |- *; intros. - cut ((r:R) <> 0). - intro hyp_r; unfold CVN_r in |- *. - exists (fun n:nat => / INR (fact (2 * n)) * r ^ (2 * n)). - cut - { l:R | - Un_cv - (fun n:nat => - sum_f_R0 (fun k:nat => Rabs (/ INR (fact (2 * k)) * r ^ (2 * k))) - n) l }. - intro X; elim X; intros. - exists x. - split. - apply p. - intros; rewrite H; unfold Rdiv in |- *; do 2 rewrite Rabs_mult. - rewrite pow_1_abs; rewrite Rmult_1_l. - cut (0 < / INR (fact (2 * n))). - intro; rewrite (Rabs_right _ (Rle_ge _ _ (Rlt_le _ _ H1))). - apply Rmult_le_compat_l. - left; apply H1. - rewrite <- RPow_abs; apply pow_maj_Rabs. - rewrite Rabs_Rabsolu. - unfold Boule in H0; rewrite Rminus_0_r in H0. - left; apply H0. - apply Rinv_0_lt_compat; apply INR_fact_lt_0. - apply Alembert_C2. - intro; apply Rabs_no_R0. - apply prod_neq_R0. - apply Rinv_neq_0_compat. - apply INR_fact_neq_0. - apply pow_nonzero; assumption. - assert (H0 := Alembert_cos). - unfold cos_n in H0; unfold Un_cv in H0; unfold Un_cv in |- *; intros. - cut (0 < eps / Rsqr r). - intro; elim (H0 _ H2); intros N0 H3. - exists N0; intros. - unfold R_dist in |- *; assert (H5 := H3 _ H4). - unfold R_dist in H5; - replace - (Rabs - (Rabs (/ INR (fact (2 * S n)) * r ^ (2 * S n)) / - Rabs (/ INR (fact (2 * n)) * r ^ (2 * n)))) with - (Rsqr r * - Rabs ((-1) ^ S n / INR (fact (2 * S n)) / ((-1) ^ n / INR (fact (2 * n))))). - apply Rmult_lt_reg_l with (/ Rsqr r). - apply Rinv_0_lt_compat; apply Rsqr_pos_lt; assumption. - pattern (/ Rsqr r) at 1 in |- *; replace (/ Rsqr r) with (Rabs (/ Rsqr r)). - rewrite <- Rabs_mult; rewrite Rmult_minus_distr_l; rewrite Rmult_0_r; - rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. - rewrite Rmult_1_l; rewrite <- (Rmult_comm eps); apply H5. - unfold Rsqr in |- *; apply prod_neq_R0; assumption. - rewrite Rabs_Rinv. - rewrite Rabs_right. - reflexivity. - apply Rle_ge; apply Rle_0_sqr. - unfold Rsqr in |- *; apply prod_neq_R0; assumption. - rewrite (Rmult_comm (Rsqr r)); unfold Rdiv in |- *; repeat rewrite Rabs_mult; - rewrite Rabs_Rabsolu; rewrite pow_1_abs; rewrite Rmult_1_l; - repeat rewrite Rmult_assoc; apply Rmult_eq_compat_l. - rewrite Rabs_Rinv. - rewrite Rabs_mult; rewrite (pow_1_abs n); rewrite Rmult_1_l; - rewrite <- Rabs_Rinv. - rewrite Rinv_involutive. - rewrite Rinv_mult_distr. - rewrite Rabs_Rinv. - rewrite Rinv_involutive. - rewrite (Rmult_comm (Rabs (Rabs (r ^ (2 * S n))))); rewrite Rabs_mult; - rewrite Rabs_Rabsolu; rewrite Rmult_assoc; apply Rmult_eq_compat_l. - rewrite Rabs_Rinv. - do 2 rewrite Rabs_Rabsolu; repeat rewrite Rabs_right. - replace (r ^ (2 * S n)) with (r ^ (2 * n) * r * r). - repeat rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. - unfold Rsqr in |- *; ring. - apply pow_nonzero; assumption. - replace (2 * S n)%nat with (S (S (2 * n))). - simpl in |- *; ring. - ring. - apply Rle_ge; apply pow_le; left; apply (cond_pos r). - apply Rle_ge; apply pow_le; left; apply (cond_pos r). - apply Rabs_no_R0; apply pow_nonzero; assumption. - apply Rabs_no_R0; apply INR_fact_neq_0. - apply INR_fact_neq_0. - apply Rabs_no_R0; apply Rinv_neq_0_compat; apply INR_fact_neq_0. - apply Rabs_no_R0; apply pow_nonzero; assumption. - apply INR_fact_neq_0. - apply Rinv_neq_0_compat; apply INR_fact_neq_0. - apply prod_neq_R0. - apply pow_nonzero; discrR. - apply Rinv_neq_0_compat; apply INR_fact_neq_0. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. - apply H1. - apply Rinv_0_lt_compat; apply Rsqr_pos_lt; assumption. - assert (H0 := cond_pos r); red in |- *; intro; rewrite H1 in H0; - elim (Rlt_irrefl _ H0). -Qed. - -(**********) -Lemma continuity_cos : continuity cos. -Proof. - set (fn := fun (N:nat) (x:R) => (-1) ^ N / INR (fact (2 * N)) * x ^ (2 * N)). - cut (CVN_R fn). - intro; cut (forall x:R, { l:R | Un_cv (fun N:nat => SP fn N x) l }). - intro cv; cut (forall n:nat, continuity (fn n)). - intro; cut (forall x:R, cos x = SFL fn cv x). - intro; cut (continuity (SFL fn cv) -> continuity cos). - intro; apply H1. - apply SFL_continuity; assumption. - unfold continuity in |- *; unfold continuity_pt in |- *; - unfold continue_in in |- *; unfold limit1_in in |- *; - unfold limit_in in |- *; simpl in |- *; unfold R_dist in |- *; - intros. - elim (H1 x _ H2); intros. - exists x0; intros. - elim H3; intros. - split. - apply H4. - intros; rewrite (H0 x); rewrite (H0 x1); apply H5; apply H6. - intro; unfold cos, SFL in |- *. - case (cv x); case (exist_cos (Rsqr x)); intros. - symmetry in |- *; eapply UL_sequence. - apply u. - unfold cos_in in c; unfold infinite_sum in c; unfold Un_cv in |- *; intros. - elim (c _ H0); intros N0 H1. - exists N0; intros. - unfold R_dist in H1; unfold R_dist, SP in |- *. - replace (sum_f_R0 (fun k:nat => fn k x) n) with - (sum_f_R0 (fun i:nat => cos_n i * Rsqr x ^ i) n). - apply H1; assumption. - apply sum_eq; intros. - unfold cos_n, fn in |- *; apply Rmult_eq_compat_l. - unfold Rsqr in |- *; rewrite pow_sqr; reflexivity. - intro; unfold fn in |- *; - replace (fun x:R => (-1) ^ n / INR (fact (2 * n)) * x ^ (2 * n)) with - (fct_cte ((-1) ^ n / INR (fact (2 * n))) * pow_fct (2 * n))%F; - [ idtac | reflexivity ]. - apply continuity_mult. - apply derivable_continuous; apply derivable_const. - apply derivable_continuous; apply (derivable_pow (2 * n)). - apply CVN_R_CVS; apply X. - apply CVN_R_cos; unfold fn in |- *; reflexivity. -Qed. (**********) Lemma continuity_sin : continuity sin. Proof. - unfold continuity in |- *; intro. + unfold continuity; intro. assert (H0 := continuity_cos (PI / 2 - x)). unfold continuity_pt in H0; unfold continue_in in H0; unfold limit1_in in H0; unfold limit_in in H0; simpl in H0; unfold R_dist in H0; - unfold continuity_pt in |- *; unfold continue_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold R_dist in |- *; intros. + unfold continuity_pt; unfold continue_in; + unfold limit1_in; unfold limit_in; + simpl; unfold R_dist; intros. elim (H0 _ H); intros. exists x0; intros. elim H1; intros. @@ -180,9 +34,9 @@ Proof. intros; rewrite <- (cos_shift x); rewrite <- (cos_shift x1); apply H3. elim H4; intros. split. - unfold D_x, no_cond in |- *; split. + unfold D_x, no_cond; split. trivial. - red in |- *; intro; unfold D_x, no_cond in H5; elim H5; intros _ H8; elim H8; + red; intro; unfold D_x, no_cond in H5; elim H5; intros _ H8; elim H8; rewrite <- (Ropp_involutive x); rewrite <- (Ropp_involutive x1); apply Ropp_eq_compat; apply Rplus_eq_reg_l with (PI / 2); apply H7. @@ -196,7 +50,7 @@ Lemma CVN_R_sin : (fun (N:nat) (x:R) => (-1) ^ N / INR (fact (2 * N + 1)) * x ^ (2 * N)) -> CVN_R fn. Proof. - unfold CVN_R in |- *; unfold CVN_r in |- *; intros fn H r. + unfold CVN_R; unfold CVN_r; intros fn H r. exists (fun n:nat => / INR (fact (2 * n + 1)) * r ^ (2 * n)). cut { l:R | @@ -209,7 +63,7 @@ Proof. exists x. split. apply p. - intros; rewrite H; unfold Rdiv in |- *; do 2 rewrite Rabs_mult; + intros; rewrite H; unfold Rdiv; do 2 rewrite Rabs_mult; rewrite pow_1_abs; rewrite Rmult_1_l. cut (0 < / INR (fact (2 * n + 1))). intro; rewrite (Rabs_right _ (Rle_ge _ _ (Rlt_le _ _ H1))). @@ -226,11 +80,11 @@ Proof. apply Rinv_neq_0_compat; apply INR_fact_neq_0. apply pow_nonzero; assumption. assert (H1 := Alembert_sin). - unfold sin_n in H1; unfold Un_cv in H1; unfold Un_cv in |- *; intros. + unfold sin_n in H1; unfold Un_cv in H1; unfold Un_cv; intros. cut (0 < eps / Rsqr r). intro; elim (H1 _ H3); intros N0 H4. exists N0; intros. - unfold R_dist in |- *; assert (H6 := H4 _ H5). + unfold R_dist; assert (H6 := H4 _ H5). unfold R_dist in H5; replace (Rabs @@ -242,15 +96,15 @@ Proof. ((-1) ^ n / INR (fact (2 * n + 1))))). apply Rmult_lt_reg_l with (/ Rsqr r). apply Rinv_0_lt_compat; apply Rsqr_pos_lt; assumption. - pattern (/ Rsqr r) at 1 in |- *; rewrite <- (Rabs_right (/ Rsqr r)). + pattern (/ Rsqr r) at 1; rewrite <- (Rabs_right (/ Rsqr r)). rewrite <- Rabs_mult. rewrite Rmult_minus_distr_l. rewrite Rmult_0_r; rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_l; rewrite <- (Rmult_comm eps). apply H6. - unfold Rsqr in |- *; apply prod_neq_R0; assumption. + unfold Rsqr; apply prod_neq_R0; assumption. apply Rle_ge; left; apply Rinv_0_lt_compat; apply Rsqr_pos_lt; assumption. - unfold Rdiv in |- *; rewrite (Rmult_comm (Rsqr r)); repeat rewrite Rabs_mult; + unfold Rdiv; rewrite (Rmult_comm (Rsqr r)); repeat rewrite Rabs_mult; rewrite Rabs_Rabsolu; rewrite pow_1_abs. rewrite Rmult_1_l. repeat rewrite Rmult_assoc; apply Rmult_eq_compat_l. @@ -272,10 +126,10 @@ Proof. replace (r ^ (2 * S n)) with (r ^ (2 * n) * r * r). do 2 rewrite <- Rmult_assoc. rewrite <- Rinv_l_sym. - unfold Rsqr in |- *; ring. + unfold Rsqr; ring. apply pow_nonzero; assumption. replace (2 * S n)%nat with (S (S (2 * n))). - simpl in |- *; ring. + simpl; ring. ring. apply Rle_ge; apply pow_le; left; apply (cond_pos r). apply Rle_ge; apply pow_le; left; apply (cond_pos r). @@ -288,16 +142,16 @@ Proof. apply INR_fact_neq_0. apply pow_nonzero; discrR. apply Rinv_neq_0_compat; apply INR_fact_neq_0. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; apply Rsqr_pos_lt; assumption ]. - assert (H0 := cond_pos r); red in |- *; intro; rewrite H1 in H0; + assert (H0 := cond_pos r); red; intro; rewrite H1 in H0; elim (Rlt_irrefl _ H0). Qed. (** (sin h)/h -> 1 when h -> 0 *) Lemma derivable_pt_lim_sin_0 : derivable_pt_lim sin 0 1. Proof. - unfold derivable_pt_lim in |- *; intros. + unfold derivable_pt_lim; intros. set (fn := fun (N:nat) (x:R) => (-1) ^ N / INR (fact (2 * N + 1)) * x ^ (2 * N)). cut (CVN_R fn). @@ -313,58 +167,58 @@ Proof. elim (H2 _ H); intros alp H3. elim H3; intros. exists (mkposreal _ H4). - simpl in |- *; intros. - rewrite sin_0; rewrite Rplus_0_l; unfold Rminus in |- *; rewrite Ropp_0; + simpl; intros. + rewrite sin_0; rewrite Rplus_0_l; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r. cut (Rabs (SFL fn cv h - SFL fn cv 0) < eps). intro; cut (SFL fn cv 0 = 1). intro; cut (SFL fn cv h = sin h / h). intro; rewrite H9 in H8; rewrite H10 in H8. apply H8. - unfold SFL, sin in |- *. + unfold SFL, sin. case (cv h); intros. case (exist_sin (Rsqr h)); intros. - unfold Rdiv in |- *; rewrite (Rinv_r_simpl_m h x0 H6). + unfold Rdiv; rewrite (Rinv_r_simpl_m h x0 H6). eapply UL_sequence. apply u. unfold sin_in in s; unfold sin_n, infinite_sum in s; - unfold SP, fn, Un_cv in |- *; intros. + unfold SP, fn, Un_cv; intros. elim (s _ H10); intros N0 H11. exists N0; intros. - unfold R_dist in |- *; unfold R_dist in H11. + unfold R_dist; unfold R_dist in H11. replace (sum_f_R0 (fun k:nat => (-1) ^ k / INR (fact (2 * k + 1)) * h ^ (2 * k)) n) with (sum_f_R0 (fun i:nat => (-1) ^ i / INR (fact (2 * i + 1)) * Rsqr h ^ i) n). apply H11; assumption. - apply sum_eq; intros; apply Rmult_eq_compat_l; unfold Rsqr in |- *; + apply sum_eq; intros; apply Rmult_eq_compat_l; unfold Rsqr; rewrite pow_sqr; reflexivity. - unfold SFL, sin in |- *. + unfold SFL, sin. case (cv 0); intros. eapply UL_sequence. apply u. - unfold SP, fn in |- *; unfold Un_cv in |- *; intros; exists 1%nat; intros. - unfold R_dist in |- *; + unfold SP, fn; unfold Un_cv; intros; exists 1%nat; intros. + unfold R_dist; replace (sum_f_R0 (fun k:nat => (-1) ^ k / INR (fact (2 * k + 1)) * 0 ^ (2 * k)) n) with 1. - unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. + unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; assumption. rewrite decomp_sum. - simpl in |- *; rewrite Rmult_1_r; unfold Rdiv in |- *; rewrite Rinv_1; - rewrite Rmult_1_r; pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; + simpl; rewrite Rmult_1_r; unfold Rdiv; rewrite Rinv_1; + rewrite Rmult_1_r; pattern 1 at 1; rewrite <- Rplus_0_r; apply Rplus_eq_compat_l. - symmetry in |- *; apply sum_eq_R0; intros. + symmetry ; apply sum_eq_R0; intros. rewrite Rmult_0_l; rewrite Rmult_0_r; reflexivity. unfold ge in H10; apply lt_le_trans with 1%nat; [ apply lt_n_Sn | apply H10 ]. apply H5. split. - unfold D_x, no_cond in |- *; split. + unfold D_x, no_cond; split. trivial. - apply (sym_not_eq (A:=R)); apply H6. - unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; apply H7. - unfold Boule in |- *; unfold Rminus in |- *; rewrite Ropp_0; + apply (not_eq_sym (A:=R)); apply H6. + unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply H7. + unfold Boule; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite Rabs_R0; apply (cond_pos r). - intros; unfold fn in |- *; + intros; unfold fn; replace (fun x:R => (-1) ^ n / INR (fact (2 * n + 1)) * x ^ (2 * n)) with (fct_cte ((-1) ^ n / INR (fact (2 * n + 1))) * pow_fct (2 * n))%F; [ idtac | reflexivity ]. @@ -375,13 +229,13 @@ Proof. apply (derivable_pt_pow (2 * n) y). apply (X r). apply (CVN_R_CVS _ X). - apply CVN_R_sin; unfold fn in |- *; reflexivity. + apply CVN_R_sin; unfold fn; reflexivity. Qed. (** ((cos h)-1)/h -> 0 when h -> 0 *) Lemma derivable_pt_lim_cos_0 : derivable_pt_lim cos 0 0. Proof. - unfold derivable_pt_lim in |- *; intros. + unfold derivable_pt_lim; intros. assert (H0 := derivable_pt_lim_sin_0). unfold derivable_pt_lim in H0. cut (0 < eps / 2). @@ -396,8 +250,8 @@ Proof. intro; set (delta := mkposreal _ H6). exists delta; intros. rewrite Rplus_0_l; replace (cos h - cos 0) with (-2 * Rsqr (sin (h / 2))). - unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r. - unfold Rdiv in |- *; do 2 rewrite Ropp_mult_distr_l_reverse. + unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r. + unfold Rdiv; do 2 rewrite Ropp_mult_distr_l_reverse. rewrite Rabs_Ropp. replace (2 * Rsqr (sin (h * / 2)) * / h) with (sin (h / 2) * (sin (h / 2) / (h / 2) - 1) + sin (h / 2)). @@ -407,12 +261,12 @@ Proof. rewrite (double_var eps); apply Rplus_lt_compat. apply Rle_lt_trans with (Rabs (sin (h / 2) / (h / 2) - 1)). rewrite Rabs_mult; rewrite Rmult_comm; - pattern (Rabs (sin (h / 2) / (h / 2) - 1)) at 2 in |- *; + pattern (Rabs (sin (h / 2) / (h / 2) - 1)) at 2; rewrite <- Rmult_1_r; apply Rmult_le_compat_l. apply Rabs_pos. assert (H9 := SIN_bound (h / 2)). - unfold Rabs in |- *; case (Rcase_abs (sin (h / 2))); intro. - pattern 1 at 3 in |- *; rewrite <- (Ropp_involutive 1). + unfold Rabs; case (Rcase_abs (sin (h / 2))); intro. + pattern 1 at 3; rewrite <- (Ropp_involutive 1). apply Ropp_le_contravar. elim H9; intros; assumption. elim H9; intros; assumption. @@ -421,50 +275,50 @@ Proof. intro; assert (H11 := H2 _ H10 H9). rewrite Rplus_0_l in H11; rewrite sin_0 in H11. rewrite Rminus_0_r in H11; apply H11. - unfold Rdiv in |- *; apply prod_neq_R0. + unfold Rdiv; apply prod_neq_R0. apply H7. apply Rinv_neq_0_compat; discrR. apply Rlt_trans with (del / 2). - unfold Rdiv in |- *; rewrite Rabs_mult. + unfold Rdiv; rewrite Rabs_mult. rewrite (Rabs_right (/ 2)). do 2 rewrite <- (Rmult_comm (/ 2)); apply Rmult_lt_compat_l. apply Rinv_0_lt_compat; prove_sup0. apply Rlt_le_trans with (pos delta). apply H8. - unfold delta in |- *; simpl in |- *; apply Rmin_l. + unfold delta; simpl; apply Rmin_l. apply Rle_ge; left; apply Rinv_0_lt_compat; prove_sup0. - rewrite <- (Rplus_0_r (del / 2)); pattern del at 1 in |- *; + rewrite <- (Rplus_0_r (del / 2)); pattern del at 1; rewrite (double_var del); apply Rplus_lt_compat_l; - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. apply (cond_pos del). apply Rinv_0_lt_compat; prove_sup0. elim H5; intros; assert (H11 := H10 (h / 2)). rewrite sin_0 in H11; do 2 rewrite Rminus_0_r in H11. apply H11. split. - unfold D_x, no_cond in |- *; split. + unfold D_x, no_cond; split. trivial. - apply (sym_not_eq (A:=R)); unfold Rdiv in |- *; apply prod_neq_R0. + apply (not_eq_sym (A:=R)); unfold Rdiv; apply prod_neq_R0. apply H7. apply Rinv_neq_0_compat; discrR. apply Rlt_trans with (del_c / 2). - unfold Rdiv in |- *; rewrite Rabs_mult. + unfold Rdiv; rewrite Rabs_mult. rewrite (Rabs_right (/ 2)). do 2 rewrite <- (Rmult_comm (/ 2)). apply Rmult_lt_compat_l. apply Rinv_0_lt_compat; prove_sup0. apply Rlt_le_trans with (pos delta). apply H8. - unfold delta in |- *; simpl in |- *; apply Rmin_r. + unfold delta; simpl; apply Rmin_r. apply Rle_ge; left; apply Rinv_0_lt_compat; prove_sup0. - rewrite <- (Rplus_0_r (del_c / 2)); pattern del_c at 2 in |- *; + rewrite <- (Rplus_0_r (del_c / 2)); pattern del_c at 2; rewrite (double_var del_c); apply Rplus_lt_compat_l. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. apply H9. apply Rinv_0_lt_compat; prove_sup0. - rewrite Rmult_minus_distr_l; rewrite Rmult_1_r; unfold Rminus in |- *; + rewrite Rmult_minus_distr_l; rewrite Rmult_1_r; unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r; - rewrite (Rmult_comm 2); unfold Rdiv, Rsqr in |- *. + rewrite (Rmult_comm 2); unfold Rdiv, Rsqr. repeat rewrite Rmult_assoc. repeat apply Rmult_eq_compat_l. rewrite Rinv_mult_distr. @@ -473,16 +327,16 @@ Proof. discrR. apply H7. apply Rinv_neq_0_compat; discrR. - pattern h at 2 in |- *; replace h with (2 * (h / 2)). + pattern h at 2; replace h with (2 * (h / 2)). rewrite (cos_2a_sin (h / 2)). - rewrite cos_0; unfold Rsqr in |- *; ring. - unfold Rdiv in |- *; rewrite <- Rmult_assoc; apply Rinv_r_simpl_m. + rewrite cos_0; unfold Rsqr; ring. + unfold Rdiv; rewrite <- Rmult_assoc; apply Rinv_r_simpl_m. discrR. - unfold Rmin in |- *; case (Rle_dec del del_c); intro. + unfold Rmin; case (Rle_dec del del_c); intro. apply (cond_pos del). elim H5; intros; assumption. apply continuity_sin. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ]. Qed. @@ -492,10 +346,10 @@ Proof. intro; assert (H0 := derivable_pt_lim_sin_0). assert (H := derivable_pt_lim_cos_0). unfold derivable_pt_lim in H0, H. - unfold derivable_pt_lim in |- *; intros. + unfold derivable_pt_lim; intros. cut (0 < eps / 2); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ apply H1 | apply Rinv_0_lt_compat; prove_sup0 ] ]. elim (H0 _ H2); intros alp1 H3. elim (H _ H2); intros alp2 H4. @@ -510,11 +364,11 @@ Proof. rewrite (double_var eps); apply Rplus_lt_compat. apply Rle_lt_trans with (Rabs ((cos h - 1) / h)). rewrite Rabs_mult; rewrite Rmult_comm; - pattern (Rabs ((cos h - 1) / h)) at 2 in |- *; rewrite <- Rmult_1_r; + pattern (Rabs ((cos h - 1) / h)) at 2; rewrite <- Rmult_1_r; apply Rmult_le_compat_l. apply Rabs_pos. assert (H8 := SIN_bound x); elim H8; intros. - unfold Rabs in |- *; case (Rcase_abs (sin x)); intro. + unfold Rabs; case (Rcase_abs (sin x)); intro. rewrite <- (Ropp_involutive 1). apply Ropp_le_contravar; assumption. assumption. @@ -524,14 +378,14 @@ Proof. apply H9. apply Rlt_le_trans with alp. apply H7. - unfold alp in |- *; apply Rmin_r. + unfold alp; apply Rmin_r. apply Rle_lt_trans with (Rabs (sin h / h - 1)). rewrite Rabs_mult; rewrite Rmult_comm; - pattern (Rabs (sin h / h - 1)) at 2 in |- *; rewrite <- Rmult_1_r; + pattern (Rabs (sin h / h - 1)) at 2; rewrite <- Rmult_1_r; apply Rmult_le_compat_l. apply Rabs_pos. assert (H8 := COS_bound x); elim H8; intros. - unfold Rabs in |- *; case (Rcase_abs (cos x)); intro. + unfold Rabs; case (Rcase_abs (cos x)); intro. rewrite <- (Ropp_involutive 1); apply Ropp_le_contravar; assumption. assumption. cut (Rabs h < alp1). @@ -540,8 +394,8 @@ Proof. apply H9. apply Rlt_le_trans with alp. apply H7. - unfold alp in |- *; apply Rmin_l. - rewrite sin_plus; unfold Rminus, Rdiv in |- *; + unfold alp; apply Rmin_l. + rewrite sin_plus; unfold Rminus, Rdiv; repeat rewrite Rmult_plus_distr_r; repeat rewrite Rmult_plus_distr_l; repeat rewrite Rmult_assoc; repeat rewrite Rplus_assoc; apply Rplus_eq_compat_l. @@ -550,7 +404,7 @@ Proof. rewrite Ropp_mult_distr_r_reverse; rewrite Ropp_mult_distr_l_reverse; rewrite Rmult_1_r; rewrite Rmult_1_l; rewrite Ropp_mult_distr_r_reverse; rewrite <- Ropp_mult_distr_l_reverse; apply Rplus_comm. - unfold alp in |- *; unfold Rmin in |- *; case (Rle_dec alp1 alp2); intro. + unfold alp; unfold Rmin; case (Rle_dec alp1 alp2); intro. apply (cond_pos alp1). apply (cond_pos alp2). Qed. @@ -565,7 +419,7 @@ Proof. intros; generalize (H0 _ _ _ H2 H1); replace (comp sin (id + fct_cte (PI / 2))%F) with (fun x:R => sin (x + PI / 2)); [ idtac | reflexivity ]. - unfold derivable_pt_lim in |- *; intros. + unfold derivable_pt_lim; intros. elim (H3 eps H4); intros. exists x0. intros; rewrite <- (H (x + h)); rewrite <- (H x); apply H5; assumption. @@ -579,26 +433,26 @@ Qed. Lemma derivable_pt_sin : forall x:R, derivable_pt sin x. Proof. - unfold derivable_pt in |- *; intro. + unfold derivable_pt; intro. exists (cos x). apply derivable_pt_lim_sin. Qed. Lemma derivable_pt_cos : forall x:R, derivable_pt cos x. Proof. - unfold derivable_pt in |- *; intro. + unfold derivable_pt; intro. exists (- sin x). apply derivable_pt_lim_cos. Qed. Lemma derivable_sin : derivable sin. Proof. - unfold derivable in |- *; intro; apply derivable_pt_sin. + unfold derivable; intro; apply derivable_pt_sin. Qed. Lemma derivable_cos : derivable cos. Proof. - unfold derivable in |- *; intro; apply derivable_pt_cos. + unfold derivable; intro; apply derivable_pt_cos. Qed. Lemma derive_pt_sin : diff --git a/theories/Reals/SeqProp.v b/theories/Reals/SeqProp.v index 75c57401..41e853cc 100644 --- a/theories/Reals/SeqProp.v +++ b/theories/Reals/SeqProp.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -10,7 +10,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import Rseries. Require Import Max. -Open Local Scope R_scope. +Local Open Scope R_scope. (*****************************************************************) (** Convergence properties of sequences *) @@ -36,7 +36,7 @@ Lemma decreasing_growing : forall Un:nat -> R, Un_decreasing Un -> Un_growing (opp_seq Un). Proof. intro. - unfold Un_growing, opp_seq, Un_decreasing in |- *. + unfold Un_growing, opp_seq, Un_decreasing. intros. apply Ropp_le_contravar. apply H. @@ -58,8 +58,8 @@ Proof. unfold Un_cv in p. unfold R_dist in p. unfold opp_seq in p. - unfold Un_cv in |- *. - unfold R_dist in |- *. + unfold Un_cv. + unfold R_dist. intros. elim (p eps H1); intros. exists x0; intros. @@ -77,7 +77,7 @@ Proof. apply completeness. assumption. exists (Un 0%nat). - unfold EUn in |- *. + unfold EUn. exists 0%nat; reflexivity. Qed. @@ -114,9 +114,9 @@ Proof. unfold bound in H. elim H; intros. unfold is_upper_bound in H0. - unfold has_ub in |- *. + unfold has_ub. exists x. - unfold is_upper_bound in |- *. + unfold is_upper_bound. intros. apply H0. elim H1; intros. @@ -132,9 +132,9 @@ Proof. unfold bound in H. elim H; intros. unfold is_upper_bound in H0. - unfold has_lb in |- *. + unfold has_lb. exists x. - unfold is_upper_bound in |- *. + unfold is_upper_bound. intros. apply H0. elim H1; intros. @@ -155,9 +155,9 @@ Lemma Wn_decreasing : forall (Un:nat -> R) (pr:has_ub Un), Un_decreasing (sequence_ub Un pr). Proof. intros. - unfold Un_decreasing in |- *. + unfold Un_decreasing. intro. - unfold sequence_ub in |- *. + unfold sequence_ub. assert (H := ub_to_lub (fun k:nat => Un (S n + k)%nat) (maj_ss Un (S n) pr)). assert (H0 := ub_to_lub (fun k:nat => Un (n + k)%nat) (maj_ss Un n pr)). elim H; intros. @@ -171,7 +171,7 @@ Proof. elim p; intros. apply H2. elim p0; intros. - unfold is_upper_bound in |- *. + unfold is_upper_bound. intros. unfold is_upper_bound in H3. apply H3. @@ -190,7 +190,7 @@ Proof. assert (H7 := H3 (lub (fun k:nat => Un (n + k)%nat) (maj_ss Un n pr)) H4). apply Rle_antisym; assumption. - unfold lub in |- *. + unfold lub. case (ub_to_lub (fun k:nat => Un (n + k)%nat) (maj_ss Un n pr)). trivial. cut @@ -204,7 +204,7 @@ Proof. (H7 := H3 (lub (fun k:nat => Un (S n + k)%nat) (maj_ss Un (S n) pr)) H4). apply Rle_antisym; assumption. - unfold lub in |- *. + unfold lub. case (ub_to_lub (fun k:nat => Un (S n + k)%nat) (maj_ss Un (S n) pr)). trivial. Qed. @@ -213,9 +213,9 @@ Lemma Vn_growing : forall (Un:nat -> R) (pr:has_lb Un), Un_growing (sequence_lb Un pr). Proof. intros. - unfold Un_growing in |- *. + unfold Un_growing. intro. - unfold sequence_lb in |- *. + unfold sequence_lb. assert (H := lb_to_glb (fun k:nat => Un (S n + k)%nat) (min_ss Un (S n) pr)). assert (H0 := lb_to_glb (fun k:nat => Un (n + k)%nat) (min_ss Un n pr)). elim H; intros. @@ -230,14 +230,14 @@ Proof. apply Ropp_le_contravar. apply H2. elim p0; intros. - unfold is_upper_bound in |- *. + unfold is_upper_bound. intros. unfold is_upper_bound in H3. apply H3. elim H5; intros. exists (1 + x2)%nat. unfold opp_seq in H6. - unfold opp_seq in |- *. + unfold opp_seq. replace (n + (1 + x2))%nat with (S n + x2)%nat. assumption. replace (S n) with (1 + n)%nat; [ ring | ring ]. @@ -254,7 +254,7 @@ Proof. (Ropp_involutive (glb (fun k:nat => Un (n + k)%nat) (min_ss Un n pr))) . apply Ropp_eq_compat; apply Rle_antisym; assumption. - unfold glb in |- *. + unfold glb. case (lb_to_glb (fun k:nat => Un (n + k)%nat) (min_ss Un n pr)); simpl. intro; rewrite Ropp_involutive. trivial. @@ -273,7 +273,7 @@ Proof. (glb (fun k:nat => Un (S n + k)%nat) (min_ss Un (S n) pr))) . apply Ropp_eq_compat; apply Rle_antisym; assumption. - unfold glb in |- *. + unfold glb. case (lb_to_glb (fun k:nat => Un (S n + k)%nat) (min_ss Un (S n) pr)); simpl. intro; rewrite Ropp_involutive. trivial. @@ -286,7 +286,7 @@ Lemma Vn_Un_Wn_order : Proof. intros. split. - unfold sequence_lb in |- *. + unfold sequence_lb. cut { l:R | is_lub (EUn (opp_seq (fun i:nat => Un (n + i)%nat))) l }. intro X. elim X; intros. @@ -298,7 +298,7 @@ Proof. apply Ropp_le_contravar. apply H. exists 0%nat. - unfold opp_seq in |- *. + unfold opp_seq. replace (n + 0)%nat with n; [ reflexivity | ring ]. cut (is_lub (EUn (opp_seq (fun k:nat => Un (n + k)%nat))) @@ -313,13 +313,13 @@ Proof. (Ropp_involutive (glb (fun k:nat => Un (n + k)%nat) (min_ss Un n pr2))) . apply Ropp_eq_compat; apply Rle_antisym; assumption. - unfold glb in |- *. + unfold glb. case (lb_to_glb (fun k:nat => Un (n + k)%nat) (min_ss Un n pr2)); simpl. intro; rewrite Ropp_involutive. trivial. apply lb_to_glb. apply min_ss; assumption. - unfold sequence_ub in |- *. + unfold sequence_ub. cut { l:R | is_lub (EUn (fun i:nat => Un (n + i)%nat)) l }. intro X. elim X; intros. @@ -340,7 +340,7 @@ Proof. assert (H5 := H1 (lub (fun k:nat => Un (n + k)%nat) (maj_ss Un n pr1)) H2). apply Rle_antisym; assumption. - unfold lub in |- *. + unfold lub. case (ub_to_lub (fun k:nat => Un (n + k)%nat) (maj_ss Un n pr1)). intro; trivial. apply ub_to_lub. @@ -353,13 +353,13 @@ Lemma min_maj : Proof. intros. assert (H := Vn_Un_Wn_order Un pr1 pr2). - unfold has_ub in |- *. - unfold bound in |- *. + unfold has_ub. + unfold bound. unfold has_ub in pr1. unfold bound in pr1. elim pr1; intros. exists x. - unfold is_upper_bound in |- *. + unfold is_upper_bound. intros. unfold is_upper_bound in H0. elim H1; intros. @@ -376,20 +376,20 @@ Lemma maj_min : Proof. intros. assert (H := Vn_Un_Wn_order Un pr1 pr2). - unfold has_lb in |- *. - unfold bound in |- *. + unfold has_lb. + unfold bound. unfold has_lb in pr2. unfold bound in pr2. elim pr2; intros. exists x. - unfold is_upper_bound in |- *. + unfold is_upper_bound. intros. unfold is_upper_bound in H0. elim H1; intros. rewrite H2. apply Rle_trans with (opp_seq Un x1). assert (H3 := H x1); elim H3; intros. - unfold opp_seq in |- *; apply Ropp_le_contravar. + unfold opp_seq; apply Ropp_le_contravar. assumption. apply H0. exists x1; reflexivity. @@ -399,7 +399,7 @@ Qed. Lemma cauchy_maj : forall Un:nat -> R, Cauchy_crit Un -> has_ub Un. Proof. intros. - unfold has_ub in |- *. + unfold has_ub. apply cauchy_bound. assumption. Qed. @@ -409,12 +409,12 @@ Lemma cauchy_opp : forall Un:nat -> R, Cauchy_crit Un -> Cauchy_crit (opp_seq Un). Proof. intro. - unfold Cauchy_crit in |- *. - unfold R_dist in |- *. + unfold Cauchy_crit. + unfold R_dist. intros. elim (H eps H0); intros. exists x; intros. - unfold opp_seq in |- *. + unfold opp_seq. rewrite <- Rabs_Ropp. replace (- (- Un n - - Un m)) with (Un n - Un m); [ apply H1; assumption | ring ]. @@ -424,7 +424,7 @@ Qed. Lemma cauchy_min : forall Un:nat -> R, Cauchy_crit Un -> has_lb Un. Proof. intros. - unfold has_lb in |- *. + unfold has_lb. assert (H0 := cauchy_opp _ H). apply cauchy_bound. assumption. @@ -485,7 +485,7 @@ Qed. Lemma not_Rlt : forall r1 r2:R, ~ r1 < r2 -> r1 >= r2. Proof. - intros r1 r2; generalize (Rtotal_order r1 r2); unfold Rge in |- *. + intros r1 r2; generalize (Rtotal_order r1 r2); unfold Rge. tauto. Qed. @@ -595,11 +595,11 @@ Qed. Lemma UL_sequence : forall (Un:nat -> R) (l1 l2:R), Un_cv Un l1 -> Un_cv Un l2 -> l1 = l2. Proof. - intros Un l1 l2; unfold Un_cv in |- *; unfold R_dist in |- *; intros. + intros Un l1 l2; unfold Un_cv; unfold R_dist; intros. apply cond_eq. intros; cut (0 < eps / 2); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ] ]. elim (H (eps / 2) H2); intros. elim (H0 (eps / 2) H2); intros. @@ -609,8 +609,8 @@ Proof. [ apply Rabs_triang | ring ]. rewrite (double_var eps); apply Rplus_lt_compat. rewrite <- Rabs_Ropp; rewrite Ropp_minus_distr; apply H3; - unfold ge, N in |- *; apply le_max_l. - apply H4; unfold ge, N in |- *; apply le_max_r. + unfold ge, N; apply le_max_l. + apply H4; unfold ge, N; apply le_max_r. Qed. (**********) @@ -618,10 +618,10 @@ Lemma CV_plus : forall (An Bn:nat -> R) (l1 l2:R), Un_cv An l1 -> Un_cv Bn l2 -> Un_cv (fun i:nat => An i + Bn i) (l1 + l2). Proof. - unfold Un_cv in |- *; unfold R_dist in |- *; intros. + unfold Un_cv; unfold R_dist; intros. cut (0 < eps / 2); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ] ]. elim (H (eps / 2) H2); intros. elim (H0 (eps / 2) H2); intros. @@ -632,10 +632,10 @@ Proof. apply Rle_lt_trans with (Rabs (An n - l1) + Rabs (Bn n - l2)). apply Rabs_triang. rewrite (double_var eps); apply Rplus_lt_compat. - apply H3; unfold ge in |- *; apply le_trans with N; - [ unfold N in |- *; apply le_max_l | assumption ]. - apply H4; unfold ge in |- *; apply le_trans with N; - [ unfold N in |- *; apply le_max_r | assumption ]. + apply H3; unfold ge; apply le_trans with N; + [ unfold N; apply le_max_l | assumption ]. + apply H4; unfold ge; apply le_trans with N; + [ unfold N; apply le_max_r | assumption ]. Qed. (**********) @@ -643,7 +643,7 @@ Lemma cv_cvabs : forall (Un:nat -> R) (l:R), Un_cv Un l -> Un_cv (fun i:nat => Rabs (Un i)) (Rabs l). Proof. - unfold Un_cv in |- *; unfold R_dist in |- *; intros. + unfold Un_cv; unfold R_dist; intros. elim (H eps H0); intros. exists x; intros. apply Rle_lt_trans with (Rabs (Un n - l)). @@ -656,15 +656,15 @@ Lemma CV_Cauchy : forall Un:nat -> R, { l:R | Un_cv Un l } -> Cauchy_crit Un. Proof. intros Un X; elim X; intros. - unfold Cauchy_crit in |- *; intros. + unfold Cauchy_crit; intros. unfold Un_cv in p; unfold R_dist in p. cut (0 < eps / 2); [ intro - | unfold Rdiv in |- *; apply Rmult_lt_0_compat; + | unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; prove_sup0 ] ]. elim (p (eps / 2) H0); intros. exists x0; intros. - unfold R_dist in |- *; + unfold R_dist; apply Rle_lt_trans with (Rabs (Un n - x) + Rabs (x - Un m)). replace (Un n - Un m) with (Un n - x + (x - Un m)); [ apply Rabs_triang | ring ]. @@ -695,7 +695,7 @@ Proof. unfold is_upper_bound in H1. apply H1. exists n; reflexivity. - pattern x0 at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; + pattern x0 at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; apply Rlt_0_1. apply Rle_trans with (Rabs (Un 0%nat)). apply Rabs_pos. @@ -717,7 +717,7 @@ Proof. assert (H1 := maj_by_pos An X). elim H1; intros M H2. elim H2; intros. - unfold Un_cv in |- *; unfold R_dist in |- *; intros. + unfold Un_cv; unfold R_dist; intros. cut (0 < eps / (2 * M)). intro. case (Req_dec l2 0); intro. @@ -744,24 +744,24 @@ Proof. rewrite Rmult_1_l; rewrite (Rmult_comm (/ M)). apply Rlt_trans with (eps / (2 * M)). apply H8; assumption. - unfold Rdiv in |- *; rewrite Rinv_mult_distr. + unfold Rdiv; rewrite Rinv_mult_distr. apply Rmult_lt_reg_l with 2. prove_sup0. replace (2 * (eps * (/ 2 * / M))) with (2 * / 2 * (eps * / M)); [ idtac | ring ]. rewrite <- Rinv_r_sym. rewrite Rmult_1_l; rewrite double. - pattern (eps * / M) at 1 in |- *; rewrite <- Rplus_0_r. + pattern (eps * / M) at 1; rewrite <- Rplus_0_r. apply Rplus_lt_compat_l; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; assumption ]. discrR. discrR. - red in |- *; intro; rewrite H10 in H3; elim (Rlt_irrefl _ H3). - red in |- *; intro; rewrite H10 in H3; elim (Rlt_irrefl _ H3). - rewrite H7; do 2 rewrite Rmult_0_r; unfold Rminus in |- *; + red; intro; rewrite H10 in H3; elim (Rlt_irrefl _ H3). + red; intro; rewrite H10 in H3; elim (Rlt_irrefl _ H3). + rewrite H7; do 2 rewrite Rmult_0_r; unfold Rminus; rewrite Rplus_opp_r; rewrite Rabs_R0; reflexivity. replace (An n * Bn n - An n * l2) with (An n * (Bn n - l2)); [ idtac | ring ]. - symmetry in |- *; apply Rabs_mult. + symmetry ; apply Rabs_mult. cut (0 < eps / (2 * Rabs l2)). intro. unfold Un_cv in H; unfold R_dist in H; unfold Un_cv in H0; @@ -790,36 +790,36 @@ Proof. rewrite Rmult_1_l; rewrite (Rmult_comm (/ M)). apply Rlt_le_trans with (eps / (2 * M)). apply H10. - unfold ge in |- *; apply le_trans with N. - unfold N in |- *; apply le_max_r. + unfold ge; apply le_trans with N. + unfold N; apply le_max_r. assumption. - unfold Rdiv in |- *; rewrite Rinv_mult_distr. + unfold Rdiv; rewrite Rinv_mult_distr. right; ring. discrR. - red in |- *; intro; rewrite H12 in H3; elim (Rlt_irrefl _ H3). - red in |- *; intro; rewrite H12 in H3; elim (Rlt_irrefl _ H3). + red; intro; rewrite H12 in H3; elim (Rlt_irrefl _ H3). + red; intro; rewrite H12 in H3; elim (Rlt_irrefl _ H3). apply Rmult_lt_reg_l with (/ Rabs l2). apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption. rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_l; apply Rlt_le_trans with (eps / (2 * Rabs l2)). apply H9. - unfold ge in |- *; apply le_trans with N. - unfold N in |- *; apply le_max_l. + unfold ge; apply le_trans with N. + unfold N; apply le_max_l. assumption. - unfold Rdiv in |- *; right; rewrite Rinv_mult_distr. + unfold Rdiv; right; rewrite Rinv_mult_distr. ring. discrR. apply Rabs_no_R0; assumption. apply Rabs_no_R0; assumption. replace (An n * l2 - l1 * l2) with (l2 * (An n - l1)); - [ symmetry in |- *; apply Rabs_mult | ring ]. + [ symmetry ; apply Rabs_mult | ring ]. replace (An n * Bn n - An n * l2) with (An n * (Bn n - l2)); - [ symmetry in |- *; apply Rabs_mult | ring ]. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + [ symmetry ; apply Rabs_mult | ring ]. + unfold Rdiv; apply Rmult_lt_0_compat. assumption. apply Rinv_0_lt_compat; apply Rmult_lt_0_compat; [ prove_sup0 | apply Rabs_pos_lt; assumption ]. - unfold Rdiv in |- *; apply Rmult_lt_0_compat; + unfold Rdiv; apply Rmult_lt_0_compat; [ assumption | apply Rinv_0_lt_compat; apply Rmult_lt_0_compat; [ prove_sup0 | assumption ] ]. @@ -858,15 +858,15 @@ Proof. intros; exists (k + (1 - k) / 2). split. split. - pattern k at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + pattern k at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l. + unfold Rdiv; apply Rmult_lt_0_compat. apply Rplus_lt_reg_r with k; rewrite Rplus_0_r; replace (k + (1 - k)) with 1; [ elim H; intros; assumption | ring ]. apply Rinv_0_lt_compat; prove_sup0. apply Rmult_lt_reg_l with 2. prove_sup0. - unfold Rdiv in |- *; rewrite Rmult_1_r; rewrite Rmult_plus_distr_l; - pattern 2 at 1 in |- *; rewrite Rmult_comm; rewrite Rmult_assoc; + unfold Rdiv; rewrite Rmult_1_r; rewrite Rmult_plus_distr_l; + pattern 2 at 1; rewrite Rmult_comm; rewrite Rmult_assoc; rewrite <- Rinv_l_sym; [ idtac | discrR ]; rewrite Rmult_1_r; replace (2 * k + (1 - k)) with (1 + k); [ idtac | ring ]. elim H; intros. @@ -885,7 +885,7 @@ Proof. repeat rewrite <- Rplus_assoc; rewrite Rplus_opp_l; repeat rewrite Rplus_0_l; apply H4. apply Rle_ge; elim H; intros; assumption. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. apply Rplus_lt_reg_r with k; rewrite Rplus_0_r; elim H; intros; replace (k + (1 - k)) with 1; [ assumption | ring ]. apply Rinv_0_lt_compat; prove_sup0. @@ -910,12 +910,12 @@ Proof. apply Rle_lt_trans with (Rabs (Un N - l)). apply RRle_abs. apply H2. - unfold ge, N in |- *; apply le_max_r. - unfold Rminus in |- *; do 2 rewrite <- (Rplus_comm (- l)); + unfold ge, N; apply le_max_r. + unfold Rminus; do 2 rewrite <- (Rplus_comm (- l)); apply Rplus_le_compat_l. apply tech9. assumption. - unfold N in |- *; apply le_max_l. + unfold N; apply le_max_l. apply Rplus_lt_reg_r with l. rewrite Rplus_0_r. replace (l + (Un n - l)) with (Un n); [ assumption | ring ]. @@ -926,10 +926,10 @@ Lemma CV_opp : forall (An:nat -> R) (l:R), Un_cv An l -> Un_cv (opp_seq An) (- l). Proof. intros An l. - unfold Un_cv in |- *; unfold R_dist in |- *; intros. + unfold Un_cv; unfold R_dist; intros. elim (H eps H0); intros. exists x; intros. - unfold opp_seq in |- *; replace (- An n - - l) with (- (An n - l)); + unfold opp_seq; replace (- An n - - l) with (- (An n - l)); [ rewrite Rabs_Ropp | ring ]. apply H1; assumption. Qed. @@ -954,10 +954,10 @@ Lemma CV_minus : Proof. intros. replace (fun i:nat => An i - Bn i) with (fun i:nat => An i + opp_seq Bn i). - unfold Rminus in |- *; apply CV_plus. + unfold Rminus; apply CV_plus. assumption. apply CV_opp; assumption. - unfold Rminus, opp_seq in |- *; reflexivity. + unfold Rminus, opp_seq; reflexivity. Qed. (** Un -> +oo *) @@ -969,10 +969,10 @@ Lemma cv_infty_cv_R0 : forall Un:nat -> R, (forall n:nat, Un n <> 0) -> cv_infty Un -> Un_cv (fun n:nat => / Un n) 0. Proof. - unfold cv_infty, Un_cv in |- *; unfold R_dist in |- *; intros. + unfold cv_infty, Un_cv; unfold R_dist; intros. elim (H0 (/ eps)); intros N0 H2. exists N0; intros. - unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; + unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite (Rabs_Rinv _ (H n)). apply Rmult_lt_reg_l with (Rabs (Un n)). apply Rabs_pos_lt; apply H. @@ -984,7 +984,7 @@ Proof. rewrite Rmult_1_r; apply Rlt_le_trans with (Un n). apply H2; assumption. apply RRle_abs. - red in |- *; intro; rewrite H4 in H1; elim (Rlt_irrefl _ H1). + red; intro; rewrite H4 in H1; elim (Rlt_irrefl _ H1). apply Rabs_no_R0; apply H. Qed. @@ -993,7 +993,7 @@ Lemma decreasing_prop : forall (Un:nat -> R) (m n:nat), Un_decreasing Un -> (m <= n)%nat -> Un n <= Un m. Proof. - unfold Un_decreasing in |- *; intros. + unfold Un_decreasing; intros. induction n as [| n Hrecn]. induction m as [| m Hrecm]. right; reflexivity. @@ -1016,17 +1016,17 @@ Proof. (Un_cv (fun n:nat => Rabs x ^ n / INR (fact n)) 0 -> Un_cv (fun n:nat => x ^ n / INR (fact n)) 0). intro; apply H. - unfold Un_cv in |- *; unfold R_dist in |- *; intros; case (Req_dec x 0); + unfold Un_cv; unfold R_dist; intros; case (Req_dec x 0); intro. exists 1%nat; intros. - rewrite H1; unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; + rewrite H1; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite Rabs_R0; rewrite pow_ne_zero; - [ unfold Rdiv in |- *; rewrite Rmult_0_l; rewrite Rabs_R0; assumption - | red in |- *; intro; rewrite H3 in H2; elim (le_Sn_n _ H2) ]. + [ unfold Rdiv; rewrite Rmult_0_l; rewrite Rabs_R0; assumption + | red; intro; rewrite H3 in H2; elim (le_Sn_n _ H2) ]. assert (H2 := Rabs_pos_lt x H1); set (M := up (Rabs x)); cut (0 <= M)%Z. intro; elim (IZN M H3); intros M_nat H4. set (Un := fun n:nat => Rabs x ^ (M_nat + n) / INR (fact (M_nat + n))). - cut (Un_cv Un 0); unfold Un_cv in |- *; unfold R_dist in |- *; intros. + cut (Un_cv Un 0); unfold Un_cv; unfold R_dist; intros. elim (H5 eps H0); intros N H6. exists (M_nat + N)%nat; intros; cut (exists p : nat, (p >= N)%nat /\ n = (M_nat + p)%nat). @@ -1034,7 +1034,7 @@ Proof. elim H9; intros; rewrite H11; unfold Un in H6; apply H6; assumption. exists (n - M_nat)%nat. split. - unfold ge in |- *; apply (fun p n m:nat => plus_le_reg_l n m p) with M_nat; + unfold ge; apply (fun p n m:nat => plus_le_reg_l n m p) with M_nat; rewrite <- le_plus_minus. assumption. apply le_trans with (M_nat + N)%nat. @@ -1048,43 +1048,43 @@ Proof. intro; cut (Un_decreasing Un). intro; cut (forall n:nat, Un (S n) <= Vn n). intro; cut (Un_cv Vn 0). - unfold Un_cv in |- *; unfold R_dist in |- *; intros. + unfold Un_cv; unfold R_dist; intros. elim (H10 eps0 H5); intros N1 H11. exists (S N1); intros. cut (forall n:nat, 0 < Vn n). intro; apply Rle_lt_trans with (Rabs (Vn (pred n) - 0)). repeat rewrite Rabs_right. - unfold Rminus in |- *; rewrite Ropp_0; do 2 rewrite Rplus_0_r; + unfold Rminus; rewrite Ropp_0; do 2 rewrite Rplus_0_r; replace n with (S (pred n)). apply H9. - inversion H12; simpl in |- *; reflexivity. - apply Rle_ge; unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; left; + inversion H12; simpl; reflexivity. + apply Rle_ge; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; left; apply H13. - apply Rle_ge; unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; left; + apply Rle_ge; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; left; apply H7. - apply H11; unfold ge in |- *; apply le_S_n; replace (S (pred n)) with n; - [ unfold ge in H12; exact H12 | inversion H12; simpl in |- *; reflexivity ]. + apply H11; unfold ge; apply le_S_n; replace (S (pred n)) with n; + [ unfold ge in H12; exact H12 | inversion H12; simpl; reflexivity ]. intro; apply Rlt_le_trans with (Un (S n0)); [ apply H7 | apply H9 ]. cut (cv_infty (fun n:nat => INR (S n))). intro; cut (Un_cv (fun n:nat => / INR (S n)) 0). - unfold Un_cv, R_dist in |- *; intros; unfold Vn in |- *. + unfold Un_cv, R_dist; intros; unfold Vn. cut (0 < eps1 / (Rabs x * Un 0%nat)). intro; elim (H11 _ H13); intros N H14. exists N; intros; replace (Rabs x * (Un 0%nat / INR (S n)) - 0) with (Rabs x * Un 0%nat * (/ INR (S n) - 0)); - [ idtac | unfold Rdiv in |- *; ring ]. + [ idtac | unfold Rdiv; ring ]. rewrite Rabs_mult; apply Rmult_lt_reg_l with (/ Rabs (Rabs x * Un 0%nat)). apply Rinv_0_lt_compat; apply Rabs_pos_lt. apply prod_neq_R0. apply Rabs_no_R0; assumption. - assert (H16 := H7 0%nat); red in |- *; intro; rewrite H17 in H16; + assert (H16 := H7 0%nat); red; intro; rewrite H17 in H16; elim (Rlt_irrefl _ H16). rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_l. replace (/ Rabs (Rabs x * Un 0%nat) * eps1) with (eps1 / (Rabs x * Un 0%nat)). apply H14; assumption. - unfold Rdiv in |- *; rewrite (Rabs_right (Rabs x * Un 0%nat)). + unfold Rdiv; rewrite (Rabs_right (Rabs x * Un 0%nat)). apply Rmult_comm. apply Rle_ge; apply Rmult_le_pos. apply Rabs_pos. @@ -1092,9 +1092,9 @@ Proof. apply Rabs_no_R0. apply prod_neq_R0; [ apply Rabs_no_R0; assumption - | assert (H16 := H7 0%nat); red in |- *; intro; rewrite H17 in H16; + | assert (H16 := H7 0%nat); red; intro; rewrite H17 in H16; elim (Rlt_irrefl _ H16) ]. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. assumption. apply Rinv_0_lt_compat; apply Rmult_lt_0_compat. apply Rabs_pos_lt; assumption. @@ -1102,7 +1102,7 @@ Proof. apply (cv_infty_cv_R0 (fun n:nat => INR (S n))). intro; apply not_O_INR; discriminate. assumption. - unfold cv_infty in |- *; intro; case (total_order_T M0 0); intro. + unfold cv_infty; intro; case (total_order_T M0 0); intro. elim s; intro. exists 0%nat; intros. apply Rlt_trans with 0; [ assumption | apply lt_INR_0; apply lt_O_Sn ]. @@ -1116,13 +1116,13 @@ Proof. elim H10; intros; assumption. rewrite H12; rewrite <- INR_IZR_INZ; apply le_INR. apply le_trans with n; [ assumption | apply le_n_Sn ]. - apply le_IZR; left; simpl in |- *; unfold M0_z in |- *; + apply le_IZR; left; simpl; unfold M0_z; apply Rlt_trans with M0; [ assumption | elim H10; intros; assumption ]. intro; apply Rle_trans with (Rabs x * Un n * / INR (S n)). - unfold Un in |- *; replace (M_nat + S n)%nat with (M_nat + n + 1)%nat. + unfold Un; replace (M_nat + S n)%nat with (M_nat + n + 1)%nat. rewrite pow_add; replace (Rabs x ^ 1) with (Rabs x); - [ idtac | simpl in |- *; ring ]. - unfold Rdiv in |- *; rewrite <- (Rmult_comm (Rabs x)); + [ idtac | simpl; ring ]. + unfold Rdiv; rewrite <- (Rmult_comm (Rabs x)); repeat rewrite Rmult_assoc; repeat apply Rmult_le_compat_l. apply Rabs_pos. left; apply pow_lt; assumption. @@ -1130,33 +1130,33 @@ Proof. rewrite fact_simpl; rewrite mult_comm; rewrite mult_INR; rewrite Rinv_mult_distr. apply Rmult_le_compat_l. - left; apply Rinv_0_lt_compat; apply lt_INR_0; apply neq_O_lt; red in |- *; - intro; assert (H10 := sym_eq H9); elim (fact_neq_0 _ H10). + left; apply Rinv_0_lt_compat; apply lt_INR_0; apply neq_O_lt; red; + intro; assert (H10 := eq_sym H9); elim (fact_neq_0 _ H10). left; apply Rinv_lt_contravar. apply Rmult_lt_0_compat; apply lt_INR_0; apply lt_O_Sn. apply lt_INR; apply lt_n_S. - pattern n at 1 in |- *; replace n with (0 + n)%nat; [ idtac | reflexivity ]. + pattern n at 1; replace n with (0 + n)%nat; [ idtac | reflexivity ]. apply plus_lt_compat_r. apply lt_le_trans with 1%nat; [ apply lt_O_Sn | assumption ]. apply INR_fact_neq_0. apply not_O_INR; discriminate. ring. ring. - unfold Vn in |- *; rewrite Rmult_assoc; unfold Rdiv in |- *; + unfold Vn; rewrite Rmult_assoc; unfold Rdiv; rewrite (Rmult_comm (Un 0%nat)); rewrite (Rmult_comm (Un n)). repeat apply Rmult_le_compat_l. apply Rabs_pos. left; apply Rinv_0_lt_compat; apply lt_INR_0; apply lt_O_Sn. apply decreasing_prop; [ assumption | apply le_O_n ]. - unfold Un_decreasing in |- *; intro; unfold Un in |- *. + unfold Un_decreasing; intro; unfold Un. replace (M_nat + S n)%nat with (M_nat + n + 1)%nat. - rewrite pow_add; unfold Rdiv in |- *; rewrite Rmult_assoc; + rewrite pow_add; unfold Rdiv; rewrite Rmult_assoc; apply Rmult_le_compat_l. left; apply pow_lt; assumption. - replace (Rabs x ^ 1) with (Rabs x); [ idtac | simpl in |- *; ring ]. + replace (Rabs x ^ 1) with (Rabs x); [ idtac | simpl; ring ]. replace (M_nat + n + 1)%nat with (S (M_nat + n)). apply Rmult_le_reg_l with (INR (fact (S (M_nat + n)))). - apply lt_INR_0; apply neq_O_lt; red in |- *; intro; assert (H9 := sym_eq H8); + apply lt_INR_0; apply neq_O_lt; red; intro; assert (H9 := eq_sym H8); elim (fact_neq_0 _ H9). rewrite (Rmult_comm (Rabs x)); rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. rewrite Rmult_1_l. @@ -1170,37 +1170,37 @@ Proof. apply INR_fact_neq_0. ring. ring. - intro; unfold Un in |- *; unfold Rdiv in |- *; apply Rmult_lt_0_compat. + intro; unfold Un; unfold Rdiv; apply Rmult_lt_0_compat. apply pow_lt; assumption. - apply Rinv_0_lt_compat; apply lt_INR_0; apply neq_O_lt; red in |- *; intro; - assert (H8 := sym_eq H7); elim (fact_neq_0 _ H8). - clear Un Vn; apply INR_le; simpl in |- *. + apply Rinv_0_lt_compat; apply lt_INR_0; apply neq_O_lt; red; intro; + assert (H8 := eq_sym H7); elim (fact_neq_0 _ H8). + clear Un Vn; apply INR_le; simpl. induction M_nat as [| M_nat HrecM_nat]. assert (H6 := archimed (Rabs x)); fold M in H6; elim H6; intros. rewrite H4 in H7; rewrite <- INR_IZR_INZ in H7. simpl in H7; elim (Rlt_irrefl _ (Rlt_trans _ _ _ H2 H7)). replace 1 with (INR 1); [ apply le_INR | reflexivity ]; apply le_n_S; apply le_O_n. - apply le_IZR; simpl in |- *; left; apply Rlt_trans with (Rabs x). + apply le_IZR; simpl; left; apply Rlt_trans with (Rabs x). assumption. elim (archimed (Rabs x)); intros; assumption. - unfold Un_cv in |- *; unfold R_dist in |- *; intros; elim (H eps H0); intros. + unfold Un_cv; unfold R_dist; intros; elim (H eps H0); intros. exists x0; intros; apply Rle_lt_trans with (Rabs (Rabs x ^ n / INR (fact n) - 0)). - unfold Rminus in |- *; rewrite Ropp_0; do 2 rewrite Rplus_0_r; + unfold Rminus; rewrite Ropp_0; do 2 rewrite Rplus_0_r; rewrite (Rabs_right (Rabs x ^ n / INR (fact n))). - unfold Rdiv in |- *; rewrite Rabs_mult; rewrite (Rabs_right (/ INR (fact n))). + unfold Rdiv; rewrite Rabs_mult; rewrite (Rabs_right (/ INR (fact n))). rewrite RPow_abs; right; reflexivity. apply Rle_ge; left; apply Rinv_0_lt_compat; apply lt_INR_0; apply neq_O_lt; - red in |- *; intro; assert (H4 := sym_eq H3); elim (fact_neq_0 _ H4). - apply Rle_ge; unfold Rdiv in |- *; apply Rmult_le_pos. + red; intro; assert (H4 := eq_sym H3); elim (fact_neq_0 _ H4). + apply Rle_ge; unfold Rdiv; apply Rmult_le_pos. case (Req_dec x 0); intro. rewrite H3; rewrite Rabs_R0. induction n as [| n Hrecn]; - [ simpl in |- *; left; apply Rlt_0_1 - | simpl in |- *; rewrite Rmult_0_l; right; reflexivity ]. + [ simpl; left; apply Rlt_0_1 + | simpl; rewrite Rmult_0_l; right; reflexivity ]. left; apply pow_lt; apply Rabs_pos_lt; assumption. - left; apply Rinv_0_lt_compat; apply lt_INR_0; apply neq_O_lt; red in |- *; - intro; assert (H4 := sym_eq H3); elim (fact_neq_0 _ H4). + left; apply Rinv_0_lt_compat; apply lt_INR_0; apply neq_O_lt; red; + intro; assert (H4 := eq_sym H3); elim (fact_neq_0 _ H4). apply H1; assumption. Qed. diff --git a/theories/Reals/SeqSeries.v b/theories/Reals/SeqSeries.v index 0d876be5..5140c29c 100644 --- a/theories/Reals/SeqSeries.v +++ b/theories/Reals/SeqSeries.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -19,7 +19,7 @@ Require Export Rsigma. Require Export Rprod. Require Export Cauchy_prod. Require Export Alembert. -Open Local Scope R_scope. +Local Open Scope R_scope. (**********) Lemma sum_maj1 : @@ -41,21 +41,21 @@ Proof. intro; rewrite H4; rewrite H5. apply sum_cv_maj with (fun l:nat => An (S N + l)%nat) (fun (l:nat) (x:R) => fn (S N + l)%nat x) x. - unfold SP in |- *; apply H2. + unfold SP; apply H2. apply H3. intros; apply H1. - symmetry in |- *; eapply UL_sequence. + symmetry ; eapply UL_sequence. apply H3. - unfold Un_cv in H0; unfold Un_cv in |- *; intros; elim (H0 eps H5); + unfold Un_cv in H0; unfold Un_cv; intros; elim (H0 eps H5); intros N0 H6. unfold R_dist in H6; exists N0; intros. - unfold R_dist in |- *; + unfold R_dist; replace (sum_f_R0 (fun l:nat => An (S N + l)%nat) n - (l2 - sum_f_R0 An N)) with (sum_f_R0 An N + sum_f_R0 (fun l:nat => An (S N + l)%nat) n - l2); [ idtac | ring ]. replace (sum_f_R0 An N + sum_f_R0 (fun l:nat => An (S N + l)%nat) n) with (sum_f_R0 An (S (N + n))). - apply H6; unfold ge in |- *; apply le_trans with n. + apply H6; unfold ge; apply le_trans with n. apply H7. apply le_trans with (N + n)%nat. apply le_plus_r. @@ -80,12 +80,12 @@ Proof. reflexivity. apply le_lt_n_Sm; apply le_plus_l. apply le_O_n. - symmetry in |- *; eapply UL_sequence. + symmetry ; eapply UL_sequence. apply H2. - unfold Un_cv in H; unfold Un_cv in |- *; intros. + unfold Un_cv in H; unfold Un_cv; intros. elim (H eps H4); intros N0 H5. unfold R_dist in H5; exists N0; intros. - unfold R_dist, SP in |- *; + unfold R_dist, SP; replace (sum_f_R0 (fun l:nat => fn (S N + l)%nat x) n - (l1 - sum_f_R0 (fun k:nat => fn k x) N)) with @@ -96,7 +96,7 @@ Proof. (sum_f_R0 (fun k:nat => fn k x) N + sum_f_R0 (fun l:nat => fn (S N + l)%nat x) n) with (sum_f_R0 (fun k:nat => fn k x) (S (N + n))). - unfold SP in H5; apply H5; unfold ge in |- *; apply le_trans with n. + unfold SP in H5; apply H5; unfold ge; apply le_trans with n. apply H6. apply le_trans with (N + n)%nat. apply le_plus_r. @@ -124,16 +124,16 @@ Proof. apply le_plus_l. apply le_O_n. exists (l2 - sum_f_R0 An N). - unfold Un_cv in H0; unfold Un_cv in |- *; intros. + unfold Un_cv in H0; unfold Un_cv; intros. elim (H0 eps H2); intros N0 H3. unfold R_dist in H3; exists N0; intros. - unfold R_dist in |- *; + unfold R_dist; replace (sum_f_R0 (fun l:nat => An (S N + l)%nat) n - (l2 - sum_f_R0 An N)) with (sum_f_R0 An N + sum_f_R0 (fun l:nat => An (S N + l)%nat) n - l2); [ idtac | ring ]. replace (sum_f_R0 An N + sum_f_R0 (fun l:nat => An (S N + l)%nat) n) with (sum_f_R0 An (S (N + n))). - apply H3; unfold ge in |- *; apply le_trans with n. + apply H3; unfold ge; apply le_trans with n. apply H4. apply le_trans with (N + n)%nat. apply le_plus_r. @@ -160,10 +160,10 @@ Proof. apply le_plus_l. apply le_O_n. exists (l1 - SP fn N x). - unfold Un_cv in H; unfold Un_cv in |- *; intros. + unfold Un_cv in H; unfold Un_cv; intros. elim (H eps H2); intros N0 H3. unfold R_dist in H3; exists N0; intros. - unfold R_dist, SP in |- *. + unfold R_dist, SP. replace (sum_f_R0 (fun l:nat => fn (S N + l)%nat x) n - (l1 - sum_f_R0 (fun k:nat => fn k x) N)) with @@ -175,7 +175,7 @@ Proof. sum_f_R0 (fun l:nat => fn (S N + l)%nat x) n) with (sum_f_R0 (fun k:nat => fn k x) (S (N + n))). unfold SP in H3; apply H3. - unfold ge in |- *; apply le_trans with n. + unfold ge; apply le_trans with n. apply H4. apply le_trans with (N + n)%nat. apply le_plus_r. @@ -213,7 +213,7 @@ Lemma Rseries_CV_comp : Proof. intros An Bn H X; apply cv_cauchy_2. assert (H0 := cv_cauchy_1 _ X). - unfold Cauchy_crit_series in |- *; unfold Cauchy_crit in |- *. + unfold Cauchy_crit_series; unfold Cauchy_crit. intros; elim (H0 eps H1); intros. exists x; intros. cut @@ -227,7 +227,7 @@ Proof. elim a; intro. rewrite (tech2 An n m); [ idtac | assumption ]. rewrite (tech2 Bn n m); [ idtac | assumption ]. - unfold R_dist in |- *; unfold Rminus in |- *; do 2 rewrite Ropp_plus_distr; + unfold R_dist; unfold Rminus; do 2 rewrite Ropp_plus_distr; do 2 rewrite <- Rplus_assoc; do 2 rewrite Rplus_opp_r; do 2 rewrite Rplus_0_l; do 2 rewrite Rabs_Ropp; repeat rewrite Rabs_right. apply sum_Rle; intros. @@ -238,12 +238,12 @@ Proof. apply Rle_trans with (An (S n + n0)%nat); assumption. apply Rle_ge; apply cond_pos_sum; intro. elim (H (S n + n0)%nat); intros; assumption. - rewrite b; unfold R_dist in |- *; unfold Rminus in |- *; + rewrite b; unfold R_dist; unfold Rminus; do 2 rewrite Rplus_opp_r; rewrite Rabs_R0; right; reflexivity. rewrite (tech2 An m n); [ idtac | assumption ]. rewrite (tech2 Bn m n); [ idtac | assumption ]. - unfold R_dist in |- *; unfold Rminus in |- *; do 2 rewrite Rplus_assoc; + unfold R_dist; unfold Rminus; do 2 rewrite Rplus_assoc; rewrite (Rplus_comm (sum_f_R0 An m)); rewrite (Rplus_comm (sum_f_R0 Bn m)); do 2 rewrite Rplus_assoc; do 2 rewrite Rplus_opp_l; do 2 rewrite Rplus_0_r; repeat rewrite Rabs_right. @@ -266,13 +266,13 @@ Lemma Cesaro : Un_cv (fun n:nat => sum_f_R0 (fun k:nat => An k * Bn k) n / sum_f_R0 An n) l. Proof with trivial. - unfold Un_cv in |- *; intros; assert (H3 : forall n:nat, 0 < sum_f_R0 An n)... + unfold Un_cv; intros; assert (H3 : forall n:nat, 0 < sum_f_R0 An n)... intro; apply tech1... assert (H4 : forall n:nat, sum_f_R0 An n <> 0)... - intro; red in |- *; intro; assert (H5 := H3 n); rewrite H4 in H5; + intro; red; intro; assert (H5 := H3 n); rewrite H4 in H5; elim (Rlt_irrefl _ H5)... assert (H5 := cv_infty_cv_R0 _ H4 H1); assert (H6 : 0 < eps / 2)... - unfold Rdiv in |- *; apply Rmult_lt_0_compat... + unfold Rdiv; apply Rmult_lt_0_compat... apply Rinv_0_lt_compat; prove_sup... elim (H _ H6); clear H; intros N1 H; set (C := Rabs (sum_f_R0 (fun k:nat => An k * (Bn k - l)) N1)); @@ -282,10 +282,10 @@ Proof with trivial. (forall n:nat, (N <= n)%nat -> C / sum_f_R0 An n < eps / 2))... case (Req_dec C 0); intro... exists 0%nat; intros... - rewrite H7; unfold Rdiv in |- *; rewrite Rmult_0_l; apply Rmult_lt_0_compat... + rewrite H7; unfold Rdiv; rewrite Rmult_0_l; apply Rmult_lt_0_compat... apply Rinv_0_lt_compat; prove_sup... assert (H8 : 0 < eps / (2 * Rabs C))... - unfold Rdiv in |- *; apply Rmult_lt_0_compat... + unfold Rdiv; apply Rmult_lt_0_compat... apply Rinv_0_lt_compat; apply Rmult_lt_0_compat... prove_sup... apply Rabs_pos_lt... @@ -294,23 +294,23 @@ Proof with trivial. rewrite Rplus_0_r in H11... apply Rle_lt_trans with (Rabs (C / sum_f_R0 An n))... apply RRle_abs... - unfold Rdiv in |- *; rewrite Rabs_mult; apply Rmult_lt_reg_l with (/ Rabs C)... + unfold Rdiv; rewrite Rabs_mult; apply Rmult_lt_reg_l with (/ Rabs C)... apply Rinv_0_lt_compat; apply Rabs_pos_lt... rewrite <- Rmult_assoc; rewrite <- Rinv_l_sym... rewrite Rmult_1_l; replace (/ Rabs C * (eps * / 2)) with (eps / (2 * Rabs C))... - unfold Rdiv in |- *; rewrite Rinv_mult_distr... + unfold Rdiv; rewrite Rinv_mult_distr... ring... discrR... apply Rabs_no_R0... apply Rabs_no_R0... elim H7; clear H7; intros N2 H7; set (N := max N1 N2); exists (S N); intros; - unfold R_dist in |- *; + unfold R_dist; replace (sum_f_R0 (fun k:nat => An k * Bn k) n / sum_f_R0 An n - l) with (sum_f_R0 (fun k:nat => An k * (Bn k - l)) n / sum_f_R0 An n)... assert (H9 : (N1 < n)%nat)... apply lt_le_trans with (S N)... - apply le_lt_n_Sm; unfold N in |- *; apply le_max_l... - rewrite (tech2 (fun k:nat => An k * (Bn k - l)) _ _ H9); unfold Rdiv in |- *; + apply le_lt_n_Sm; unfold N; apply le_max_l... + rewrite (tech2 (fun k:nat => An k * (Bn k - l)) _ _ H9); unfold Rdiv; rewrite Rmult_plus_distr_r; apply Rle_lt_trans with (Rabs (sum_f_R0 (fun k:nat => An k * (Bn k - l)) N1 / sum_f_R0 An n) + @@ -319,12 +319,12 @@ Proof with trivial. (n - S N1) / sum_f_R0 An n))... apply Rabs_triang... rewrite (double_var eps); apply Rplus_lt_compat... - unfold Rdiv in |- *; rewrite Rabs_mult; fold C in |- *; rewrite Rabs_right... + unfold Rdiv; rewrite Rabs_mult; fold C; rewrite Rabs_right... apply (H7 n); apply le_trans with (S N)... - apply le_trans with N; [ unfold N in |- *; apply le_max_r | apply le_n_Sn ]... + apply le_trans with N; [ unfold N; apply le_max_r | apply le_n_Sn ]... apply Rle_ge; left; apply Rinv_0_lt_compat... - unfold R_dist in H; unfold Rdiv in |- *; rewrite Rabs_mult; + unfold R_dist in H; unfold Rdiv; rewrite Rabs_mult; rewrite (Rabs_right (/ sum_f_R0 An n))... apply Rle_lt_trans with (sum_f_R0 (fun i:nat => Rabs (An (S N1 + i)%nat * (Bn (S N1 + i)%nat - l))) @@ -340,22 +340,22 @@ Proof with trivial. do 2 rewrite <- (Rmult_comm (/ sum_f_R0 An n)); apply Rmult_le_compat_l... left; apply Rinv_0_lt_compat... apply sum_Rle; intros; rewrite Rabs_mult; - pattern (An (S N1 + n0)%nat) at 2 in |- *; + pattern (An (S N1 + n0)%nat) at 2; rewrite <- (Rabs_right (An (S N1 + n0)%nat))... apply Rmult_le_compat_l... apply Rabs_pos... - left; apply H; unfold ge in |- *; apply le_trans with (S N1); + left; apply H; unfold ge; apply le_trans with (S N1); [ apply le_n_Sn | apply le_plus_l ]... apply Rle_ge; left... rewrite <- (scal_sum (fun i:nat => An (S N1 + i)%nat) (n - S N1) (eps / 2)); - unfold Rdiv in |- *; repeat rewrite Rmult_assoc; apply Rmult_lt_compat_l... - pattern (/ 2) at 2 in |- *; rewrite <- Rmult_1_r; apply Rmult_lt_compat_l... + unfold Rdiv; repeat rewrite Rmult_assoc; apply Rmult_lt_compat_l... + pattern (/ 2) at 2; rewrite <- Rmult_1_r; apply Rmult_lt_compat_l... apply Rinv_0_lt_compat; prove_sup... rewrite Rmult_comm; apply Rmult_lt_reg_l with (sum_f_R0 An n)... rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym... rewrite Rmult_1_l; rewrite Rmult_1_r; rewrite (tech2 An N1 n)... rewrite Rplus_comm; - pattern (sum_f_R0 (fun i:nat => An (S N1 + i)%nat) (n - S N1)) at 1 in |- *; + pattern (sum_f_R0 (fun i:nat => An (S N1 + i)%nat) (n - S N1)) at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l... apply Rle_ge; left; apply Rinv_0_lt_compat... replace (sum_f_R0 (fun k:nat => An k * (Bn k - l)) n) with @@ -371,41 +371,41 @@ Lemma Cesaro_1 : Proof with trivial. intros Bn l H; set (An := fun _:nat => 1)... assert (H0 : forall n:nat, 0 < An n)... - intro; unfold An in |- *; apply Rlt_0_1... + intro; unfold An; apply Rlt_0_1... assert (H1 : forall n:nat, 0 < sum_f_R0 An n)... intro; apply tech1... assert (H2 : cv_infty (fun n:nat => sum_f_R0 An n))... - unfold cv_infty in |- *; intro; case (Rle_dec M 0); intro... + unfold cv_infty; intro; case (Rle_dec M 0); intro... exists 0%nat; intros; apply Rle_lt_trans with 0... assert (H2 : 0 < M)... auto with real... clear n; set (m := up M); elim (archimed M); intros; assert (H5 : (0 <= m)%Z)... - apply le_IZR; unfold m in |- *; simpl in |- *; left; apply Rlt_trans with M... - elim (IZN _ H5); intros; exists x; intros; unfold An in |- *; rewrite sum_cte; + apply le_IZR; unfold m; simpl; left; apply Rlt_trans with M... + elim (IZN _ H5); intros; exists x; intros; unfold An; rewrite sum_cte; rewrite Rmult_1_l; apply Rlt_trans with (IZR (up M))... apply Rle_lt_trans with (INR x)... - rewrite INR_IZR_INZ; fold m in |- *; rewrite <- H6; right... + rewrite INR_IZR_INZ; fold m; rewrite <- H6; right... apply lt_INR; apply le_lt_n_Sm... assert (H3 := Cesaro _ _ _ H H0 H2)... - unfold Un_cv in |- *; unfold Un_cv in H3; intros; elim (H3 _ H4); intros; - exists (S x); intros; unfold R_dist in |- *; unfold R_dist in H5; + unfold Un_cv; unfold Un_cv in H3; intros; elim (H3 _ H4); intros; + exists (S x); intros; unfold R_dist; unfold R_dist in H5; apply Rle_lt_trans with (Rabs (sum_f_R0 (fun k:nat => An k * Bn k) (pred n) / sum_f_R0 An (pred n) - l))... right; replace (sum_f_R0 Bn (pred n) / INR n - l) with (sum_f_R0 (fun k:nat => An k * Bn k) (pred n) / sum_f_R0 An (pred n) - l)... - unfold Rminus in |- *; do 2 rewrite <- (Rplus_comm (- l)); + unfold Rminus; do 2 rewrite <- (Rplus_comm (- l)); apply Rplus_eq_compat_l... - unfold An in |- *; + unfold An; replace (sum_f_R0 (fun k:nat => 1 * Bn k) (pred n)) with (sum_f_R0 Bn (pred n))... rewrite sum_cte; rewrite Rmult_1_l; replace (S (pred n)) with n... apply S_pred with 0%nat; apply lt_le_trans with (S x)... apply lt_O_Sn... apply sum_eq; intros; ring... - apply H5; unfold ge in |- *; apply le_S_n; replace (S (pred n)) with n... + apply H5; unfold ge; apply le_S_n; replace (S (pred n)) with n... apply S_pred with 0%nat; apply lt_le_trans with (S x)... apply lt_O_Sn... Qed. diff --git a/theories/Reals/SplitAbsolu.v b/theories/Reals/SplitAbsolu.v index 819606c4..d0de58b0 100644 --- a/theories/Reals/SplitAbsolu.v +++ b/theories/Reals/SplitAbsolu.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -19,5 +19,5 @@ Ltac split_Rabs := match goal with | id:context [(Rabs _)] |- _ => generalize id; clear id; try split_Rabs | |- context [(Rabs ?X1)] => - unfold Rabs in |- *; try split_case_Rabs; intros + unfold Rabs; try split_case_Rabs; intros end. diff --git a/theories/Reals/SplitRmult.v b/theories/Reals/SplitRmult.v index e554913c..09031fd6 100644 --- a/theories/Reals/SplitRmult.v +++ b/theories/Reals/SplitRmult.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) diff --git a/theories/Reals/Sqrt_reg.v b/theories/Reals/Sqrt_reg.v index d00ed178..89c17821 100644 --- a/theories/Reals/Sqrt_reg.v +++ b/theories/Reals/Sqrt_reg.v @@ -1,6 +1,6 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -10,7 +10,7 @@ Require Import Rbase. Require Import Rfunctions. Require Import Ranalysis1. Require Import R_sqrt. -Open Local Scope R_scope. +Local Open Scope R_scope. (**********) Lemma sqrt_var_maj : @@ -21,67 +21,67 @@ Proof. case (total_order_T h 0); intro. elim s; intro. repeat rewrite Rabs_left. - unfold Rminus in |- *; do 2 rewrite <- (Rplus_comm (-1)). + unfold Rminus; do 2 rewrite <- (Rplus_comm (-1)). do 2 rewrite Ropp_plus_distr; rewrite Ropp_involutive; apply Rplus_le_compat_l. apply Ropp_le_contravar; apply sqrt_le_1. apply Rle_0_sqr. apply H0. - pattern (1 + h) at 2 in |- *; rewrite <- Rmult_1_r; unfold Rsqr in |- *; + pattern (1 + h) at 2; rewrite <- Rmult_1_r; unfold Rsqr; apply Rmult_le_compat_l. apply H0. - pattern 1 at 2 in |- *; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; + pattern 1 at 2; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; assumption. apply Rplus_lt_reg_r with 1; rewrite Rplus_0_r; rewrite Rplus_comm; - unfold Rminus in |- *; rewrite Rplus_assoc; rewrite Rplus_opp_l; + unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r. - pattern 1 at 2 in |- *; rewrite <- sqrt_1; apply sqrt_lt_1. + pattern 1 at 2; rewrite <- sqrt_1; apply sqrt_lt_1. apply Rle_0_sqr. left; apply Rlt_0_1. - pattern 1 at 2 in |- *; rewrite <- Rsqr_1; apply Rsqr_incrst_1. - pattern 1 at 2 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; + pattern 1 at 2; rewrite <- Rsqr_1; apply Rsqr_incrst_1. + pattern 1 at 2; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; assumption. apply H0. left; apply Rlt_0_1. apply Rplus_lt_reg_r with 1; rewrite Rplus_0_r; rewrite Rplus_comm; - unfold Rminus in |- *; rewrite Rplus_assoc; rewrite Rplus_opp_l; + unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r. - pattern 1 at 2 in |- *; rewrite <- sqrt_1; apply sqrt_lt_1. + pattern 1 at 2; rewrite <- sqrt_1; apply sqrt_lt_1. apply H0. left; apply Rlt_0_1. - pattern 1 at 2 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; + pattern 1 at 2; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; assumption. rewrite b; rewrite Rplus_0_r; rewrite Rsqr_1; rewrite sqrt_1; right; reflexivity. repeat rewrite Rabs_right. - unfold Rminus in |- *; do 2 rewrite <- (Rplus_comm (-1)); + unfold Rminus; do 2 rewrite <- (Rplus_comm (-1)); apply Rplus_le_compat_l. apply sqrt_le_1. apply H0. apply Rle_0_sqr. - pattern (1 + h) at 1 in |- *; rewrite <- Rmult_1_r; unfold Rsqr in |- *; + pattern (1 + h) at 1; rewrite <- Rmult_1_r; unfold Rsqr; apply Rmult_le_compat_l. apply H0. - pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; + pattern 1 at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; assumption. apply Rle_ge; apply Rplus_le_reg_l with 1. - rewrite Rplus_0_r; rewrite Rplus_comm; unfold Rminus in |- *; + rewrite Rplus_0_r; rewrite Rplus_comm; unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r. - pattern 1 at 1 in |- *; rewrite <- sqrt_1; apply sqrt_le_1. + pattern 1 at 1; rewrite <- sqrt_1; apply sqrt_le_1. left; apply Rlt_0_1. apply Rle_0_sqr. - pattern 1 at 1 in |- *; rewrite <- Rsqr_1; apply Rsqr_incr_1. - pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; + pattern 1 at 1; rewrite <- Rsqr_1; apply Rsqr_incr_1. + pattern 1 at 1; rewrite <- Rplus_0_r; apply Rplus_le_compat_l; left; assumption. left; apply Rlt_0_1. apply H0. apply Rle_ge; left; apply Rplus_lt_reg_r with 1. - rewrite Rplus_0_r; rewrite Rplus_comm; unfold Rminus in |- *; + rewrite Rplus_0_r; rewrite Rplus_comm; unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_r. - pattern 1 at 1 in |- *; rewrite <- sqrt_1; apply sqrt_lt_1. + pattern 1 at 1; rewrite <- sqrt_1; apply sqrt_lt_1. left; apply Rlt_0_1. apply H0. - pattern 1 at 1 in |- *; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; + pattern 1 at 1; rewrite <- Rplus_0_r; apply Rplus_lt_compat_l; assumption. rewrite sqrt_Rsqr. replace (1 + h - 1) with h; [ right; reflexivity | ring ]. @@ -101,14 +101,14 @@ Qed. (** sqrt is continuous in 1 *) Lemma sqrt_continuity_pt_R1 : continuity_pt sqrt 1. Proof. - unfold continuity_pt in |- *; unfold continue_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; - unfold dist in |- *; simpl in |- *; unfold R_dist in |- *; + unfold continuity_pt; unfold continue_in; + unfold limit1_in; unfold limit_in; + unfold dist; simpl; unfold R_dist; intros. set (alpha := Rmin eps 1). exists alpha; intros. split. - unfold alpha in |- *; unfold Rmin in |- *; case (Rle_dec eps 1); intro. + unfold alpha; unfold Rmin; case (Rle_dec eps 1); intro. assumption. apply Rlt_0_1. intros; elim H0; intros. @@ -117,18 +117,18 @@ Proof. apply sqrt_var_maj. apply Rle_trans with alpha. left; apply H2. - unfold alpha in |- *; apply Rmin_r. + unfold alpha; apply Rmin_r. apply Rlt_le_trans with alpha; - [ apply H2 | unfold alpha in |- *; apply Rmin_l ]. + [ apply H2 | unfold alpha; apply Rmin_l ]. Qed. (** sqrt is continuous forall x>0 *) Lemma sqrt_continuity_pt : forall x:R, 0 < x -> continuity_pt sqrt x. Proof. intros; generalize sqrt_continuity_pt_R1. - unfold continuity_pt in |- *; unfold continue_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; - unfold dist in |- *; simpl in |- *; unfold R_dist in |- *; + unfold continuity_pt; unfold continue_in; + unfold limit1_in; unfold limit_in; + unfold dist; simpl; unfold R_dist; intros. cut (0 < eps / sqrt x). intro; elim (H0 _ H2); intros alp_1 H3. @@ -136,9 +136,9 @@ Proof. set (alpha := alp_1 * x). exists (Rmin alpha x); intros. split. - change (0 < Rmin alpha x) in |- *; unfold Rmin in |- *; + change (0 < Rmin alpha x); unfold Rmin; case (Rle_dec alpha x); intro. - unfold alpha in |- *; apply Rmult_lt_0_compat; assumption. + unfold alpha; apply Rmult_lt_0_compat; assumption. apply H. intros; replace x0 with (x + (x0 - x)); [ idtac | ring ]; replace (sqrt (x + (x0 - x)) - sqrt x) with @@ -150,7 +150,7 @@ Proof. rewrite Rmult_1_l; rewrite Rmult_comm. unfold Rdiv in H5. case (Req_dec x x0); intro. - rewrite H7; unfold Rminus, Rdiv in |- *; rewrite Rplus_opp_r; + rewrite H7; unfold Rminus, Rdiv; rewrite Rplus_opp_r; rewrite Rmult_0_l; rewrite Rplus_0_r; rewrite Rplus_opp_r; rewrite Rabs_R0. apply Rmult_lt_0_compat. @@ -158,10 +158,10 @@ Proof. apply Rinv_0_lt_compat; rewrite <- H7; apply sqrt_lt_R0; assumption. apply H5. split. - unfold D_x, no_cond in |- *. + unfold D_x, no_cond. split. trivial. - red in |- *; intro. + red; intro. cut ((x0 - x) * / x = 0). intro. elim (Rmult_integral _ _ H9); intro. @@ -170,35 +170,35 @@ Proof. assert (H11 := Rmult_eq_0_compat_r _ x H10). rewrite <- Rinv_l_sym in H11. elim R1_neq_R0; exact H11. - red in |- *; intro; rewrite H12 in H; elim (Rlt_irrefl _ H). - symmetry in |- *; apply Rplus_eq_reg_l with 1; rewrite Rplus_0_r; + red; intro; rewrite H12 in H; elim (Rlt_irrefl _ H). + symmetry ; apply Rplus_eq_reg_l with 1; rewrite Rplus_0_r; unfold Rdiv in H8; exact H8. - unfold Rminus in |- *; rewrite Rplus_comm; rewrite <- Rplus_assoc; + unfold Rminus; rewrite Rplus_comm; rewrite <- Rplus_assoc; rewrite Rplus_opp_l; rewrite Rplus_0_l; elim H6; intros. - unfold Rdiv in |- *; rewrite Rabs_mult. + unfold Rdiv; rewrite Rabs_mult. rewrite Rabs_Rinv. rewrite (Rabs_right x). rewrite Rmult_comm; apply Rmult_lt_reg_l with x. apply H. rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym. - rewrite Rmult_1_l; rewrite Rmult_comm; fold alpha in |- *. + rewrite Rmult_1_l; rewrite Rmult_comm; fold alpha. apply Rlt_le_trans with (Rmin alpha x). apply H9. apply Rmin_l. - red in |- *; intro; rewrite H10 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H10 in H; elim (Rlt_irrefl _ H). apply Rle_ge; left; apply H. - red in |- *; intro; rewrite H10 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H10 in H; elim (Rlt_irrefl _ H). assert (H7 := sqrt_lt_R0 x H). - red in |- *; intro; rewrite H8 in H7; elim (Rlt_irrefl _ H7). + red; intro; rewrite H8 in H7; elim (Rlt_irrefl _ H7). apply Rle_ge; apply sqrt_positivity. left; apply H. - unfold Rminus in |- *; rewrite Rmult_plus_distr_l; + unfold Rminus; rewrite Rmult_plus_distr_l; rewrite Ropp_mult_distr_r_reverse; repeat rewrite <- sqrt_mult. rewrite Rmult_1_r; rewrite Rmult_plus_distr_l; rewrite Rmult_1_r; - unfold Rdiv in |- *; rewrite Rmult_comm; rewrite Rmult_assoc; + unfold Rdiv; rewrite Rmult_comm; rewrite Rmult_assoc; rewrite <- Rinv_l_sym. rewrite Rmult_1_r; reflexivity. - red in |- *; intro; rewrite H7 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H7 in H; elim (Rlt_irrefl _ H). left; apply H. left; apply Rlt_0_1. left; apply H. @@ -208,7 +208,7 @@ Proof. rewrite Rplus_comm. apply Rplus_le_reg_l with (- ((x0 - x) / x)). rewrite Rplus_0_r; rewrite <- Rplus_assoc; rewrite Rplus_opp_l; - rewrite Rplus_0_l; unfold Rdiv in |- *; rewrite <- Ropp_mult_distr_l_reverse. + rewrite Rplus_0_l; unfold Rdiv; rewrite <- Ropp_mult_distr_l_reverse. apply Rmult_le_reg_l with x. apply H. rewrite Rmult_1_r; rewrite Rmult_comm; rewrite Rmult_assoc; @@ -216,13 +216,13 @@ Proof. rewrite Rmult_1_r; left; apply Rlt_le_trans with (Rmin alpha x). apply H8. apply Rmin_r. - red in |- *; intro; rewrite H9 in H; elim (Rlt_irrefl _ H). + red; intro; rewrite H9 in H; elim (Rlt_irrefl _ H). apply Rplus_le_le_0_compat. left; apply Rlt_0_1. - unfold Rdiv in |- *; apply Rmult_le_pos. + unfold Rdiv; apply Rmult_le_pos. apply Rge_le; exact r. left; apply Rinv_0_lt_compat; apply H. - unfold Rdiv in |- *; apply Rmult_lt_0_compat. + unfold Rdiv; apply Rmult_lt_0_compat. apply H1. apply Rinv_0_lt_compat; apply sqrt_lt_R0; apply H. Qed. @@ -235,7 +235,7 @@ Proof. cut (continuity_pt g 0). intro; cut (g 0 <> 0). intro; assert (H2 := continuity_pt_inv g 0 H0 H1). - unfold derivable_pt_lim in |- *; intros; unfold continuity_pt in H2; + unfold derivable_pt_lim; intros; unfold continuity_pt in H2; unfold continue_in in H2; unfold limit1_in in H2; unfold limit_in in H2; simpl in H2; unfold R_dist in H2. elim (H2 eps H3); intros alpha H4. @@ -247,29 +247,29 @@ Proof. unfold inv_fct, g in H6; replace (2 * sqrt x) with (sqrt x + sqrt (x + 0)). apply H6. split. - unfold D_x, no_cond in |- *. + unfold D_x, no_cond. split. trivial. - apply (sym_not_eq (A:=R)); exact H8. - unfold Rminus in |- *; rewrite Ropp_0; rewrite Rplus_0_r; + apply (not_eq_sym (A:=R)); exact H8. + unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; apply Rlt_le_trans with alpha1. exact H9. - unfold alpha1 in |- *; apply Rmin_l. + unfold alpha1; apply Rmin_l. rewrite Rplus_0_r; ring. cut (0 <= x + h). intro; cut (0 < sqrt x + sqrt (x + h)). intro; apply Rmult_eq_reg_l with (sqrt x + sqrt (x + h)). rewrite <- Rinv_r_sym. - rewrite Rplus_comm; unfold Rdiv in |- *; rewrite <- Rmult_assoc; + rewrite Rplus_comm; unfold Rdiv; rewrite <- Rmult_assoc; rewrite Rsqr_plus_minus; repeat rewrite Rsqr_sqrt. - rewrite Rplus_comm; unfold Rminus in |- *; rewrite Rplus_assoc; + rewrite Rplus_comm; unfold Rminus; rewrite Rplus_assoc; rewrite Rplus_opp_r; rewrite Rplus_0_r; rewrite <- Rinv_r_sym. reflexivity. apply H8. left; apply H. assumption. - red in |- *; intro; rewrite H12 in H11; elim (Rlt_irrefl _ H11). - red in |- *; intro; rewrite H12 in H11; elim (Rlt_irrefl _ H11). + red; intro; rewrite H12 in H11; elim (Rlt_irrefl _ H11). + red; intro; rewrite H12 in H11; elim (Rlt_irrefl _ H11). apply Rplus_lt_le_0_compat. apply sqrt_lt_R0; apply H. apply sqrt_positivity; apply H10. @@ -279,35 +279,35 @@ Proof. rewrite Rplus_0_r; rewrite Rplus_comm; rewrite Rplus_assoc; rewrite Rplus_opp_r; rewrite Rplus_0_r; left; apply Rlt_le_trans with alpha1. apply H9. - unfold alpha1 in |- *; apply Rmin_r. + unfold alpha1; apply Rmin_r. apply Rplus_le_le_0_compat. left; assumption. apply Rge_le; apply r. - unfold alpha1 in |- *; unfold Rmin in |- *; case (Rle_dec alpha x); intro. + unfold alpha1; unfold Rmin; case (Rle_dec alpha x); intro. apply H5. apply H. - unfold g in |- *; rewrite Rplus_0_r. + unfold g; rewrite Rplus_0_r. cut (0 < sqrt x + sqrt x). - intro; red in |- *; intro; rewrite H2 in H1; elim (Rlt_irrefl _ H1). + intro; red; intro; rewrite H2 in H1; elim (Rlt_irrefl _ H1). apply Rplus_lt_0_compat; apply sqrt_lt_R0; apply H. replace g with (fct_cte (sqrt x) + comp sqrt (fct_cte x + id))%F; [ idtac | reflexivity ]. apply continuity_pt_plus. - apply continuity_pt_const; unfold constant, fct_cte in |- *; intro; + apply continuity_pt_const; unfold constant, fct_cte; intro; reflexivity. apply continuity_pt_comp. apply continuity_pt_plus. - apply continuity_pt_const; unfold constant, fct_cte in |- *; intro; + apply continuity_pt_const; unfold constant, fct_cte; intro; reflexivity. apply derivable_continuous_pt; apply derivable_pt_id. apply sqrt_continuity_pt. - unfold plus_fct, fct_cte, id in |- *; rewrite Rplus_0_r; apply H. + unfold plus_fct, fct_cte, id; rewrite Rplus_0_r; apply H. Qed. (**********) Lemma derivable_pt_sqrt : forall x:R, 0 < x -> derivable_pt sqrt x. Proof. - unfold derivable_pt in |- *; intros. + unfold derivable_pt; intros. exists (/ (2 * sqrt x)). apply derivable_pt_lim_sqrt; assumption. Qed. @@ -330,19 +330,19 @@ Proof. intros; case (Rtotal_order 0 x); intro. apply (sqrt_continuity_pt x H0). elim H0; intro. - unfold continuity_pt in |- *; unfold continue_in in |- *; - unfold limit1_in in |- *; unfold limit_in in |- *; - simpl in |- *; unfold R_dist in |- *; intros. + unfold continuity_pt; unfold continue_in; + unfold limit1_in; unfold limit_in; + simpl; unfold R_dist; intros. exists (Rsqr eps); intros. split. - change (0 < Rsqr eps) in |- *; apply Rsqr_pos_lt. - red in |- *; intro; rewrite H3 in H2; elim (Rlt_irrefl _ H2). + change (0 < Rsqr eps); apply Rsqr_pos_lt. + red; intro; rewrite H3 in H2; elim (Rlt_irrefl _ H2). intros; elim H3; intros. - rewrite <- H1; rewrite sqrt_0; unfold Rminus in |- *; rewrite Ropp_0; + rewrite <- H1; rewrite sqrt_0; unfold Rminus; rewrite Ropp_0; rewrite Rplus_0_r; rewrite <- H1 in H5; unfold Rminus in H5; rewrite Ropp_0 in H5; rewrite Rplus_0_r in H5. case (Rcase_abs x0); intro. - unfold sqrt in |- *; case (Rcase_abs x0); intro. + unfold sqrt; case (Rcase_abs x0); intro. rewrite Rabs_R0; apply H2. assert (H6 := Rge_le _ _ r0); elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H6 r)). rewrite Rabs_right. diff --git a/theories/Reals/vo.itarget b/theories/Reals/vo.itarget index bcd47a0b..36dd0f56 100644 --- a/theories/Reals/vo.itarget +++ b/theories/Reals/vo.itarget @@ -9,6 +9,7 @@ DiscrR.vo Exp_prop.vo Integration.vo LegacyRfield.vo +Machin.vo MVT.vo NewtonInt.vo PartSum.vo @@ -17,7 +18,10 @@ Ranalysis1.vo Ranalysis2.vo Ranalysis3.vo Ranalysis4.vo +Ranalysis5.vo Ranalysis.vo +Ranalysis_reg.vo +Ratan.vo Raxioms.vo Rbase.vo Rbasic_fun.vo @@ -48,6 +52,7 @@ Rtrigo_calc.vo Rtrigo_def.vo Rtrigo_fun.vo Rtrigo_reg.vo +Rtrigo1.vo Rtrigo.vo SeqProp.vo SeqSeries.vo |