1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
9
(*i $Id: Rcomplete.v 10710 2008-03-23 09:24:09Z herbelin $ i*)
12
Require Import Rfunctions.
13
Require Import Rseries.
14
Require Import SeqProp.
16
Open Local Scope R_scope.
18
(****************************************************)
20
(* Each sequence which satisfies *)
21
(* the Cauchy's criterion converges *)
23
(* Proof with adjacent sequences (Vn and Wn) *)
24
(****************************************************)
27
forall Un:nat -> R, Cauchy_crit Un -> { l:R | Un_cv Un l } .
30
set (Vn := sequence_minorant Un (cauchy_min Un H)).
31
set (Wn := sequence_majorant Un (cauchy_maj Un H)).
32
assert (H0 := maj_cv Un H).
34
assert (H1 := min_cv Un H).
44
unfold Un_cv in p; unfold Un_cv in p0.
47
elim (p (eps / 3) H4); intros.
48
elim (p0 (eps / 3) H4); intros.
51
unfold R_dist in |- *.
52
apply Rle_lt_trans with (Rabs (Un n - Vn n) + Rabs (Vn n - x)).
53
replace (Un n - x) with (Un n - Vn n + (Vn n - x));
54
[ apply Rabs_triang | ring ].
55
apply Rle_lt_trans with (Rabs (Wn n - Vn n) + Rabs (Vn n - x)).
56
do 2 rewrite <- (Rplus_comm (Rabs (Vn n - x))).
57
apply Rplus_le_compat_l.
58
repeat rewrite Rabs_right.
59
unfold Rminus in |- *; do 2 rewrite <- (Rplus_comm (- Vn n));
60
apply Rplus_le_compat_l.
61
assert (H8 := Vn_Un_Wn_order Un (cauchy_maj Un H) (cauchy_min Un H)).
66
unfold Rminus in |- *; apply Rplus_le_reg_l with (Vn n).
68
replace (Vn n + (Wn n + - Vn n)) with (Wn n); [ idtac | ring ].
69
assert (H8 := Vn_Un_Wn_order Un (cauchy_maj Un H) (cauchy_min Un H)).
72
apply Rle_trans with (Un n); assumption.
74
unfold Rminus in |- *; apply Rplus_le_reg_l with (Vn n).
76
replace (Vn n + (Un n + - Vn n)) with (Un n); [ idtac | ring ].
77
assert (H8 := Vn_Un_Wn_order Un (cauchy_maj Un H) (cauchy_min Un H)).
81
apply Rle_lt_trans with (Rabs (Wn n - x) + Rabs (x - Vn n) + Rabs (Vn n - x)).
82
do 2 rewrite <- (Rplus_comm (Rabs (Vn n - x))).
83
apply Rplus_le_compat_l.
84
replace (Wn n - Vn n) with (Wn n - x + (x - Vn n));
85
[ apply Rabs_triang | ring ].
86
apply Rlt_le_trans with (eps / 3 + eps / 3 + eps / 3).
87
repeat apply Rplus_lt_compat.
90
unfold ge in |- *; apply le_trans with (max x1 x2).
94
replace (- (x - Vn n)) with (Vn n - x); [ idtac | ring ].
97
unfold ge in |- *; apply le_trans with (max x1 x2).
102
unfold ge in |- *; apply le_trans with (max x1 x2).
106
pattern eps at 4 in |- *; replace eps with (3 * (eps / 3)).
108
unfold Rdiv in |- *; rewrite <- Rmult_assoc; apply Rinv_r_simpl_m; discrR.
109
unfold Rdiv in |- *; apply Rmult_lt_0_compat;
110
[ assumption | apply Rinv_0_lt_compat; prove_sup0 ].
115
unfold Un_cv in p; unfold Un_cv in p0.
116
unfold R_dist in p; unfold R_dist in p0.
117
elim (p (eps / 5) H3); intros N1 H4.
118
elim (p0 (eps / 5) H3); intros N2 H5.
119
unfold Cauchy_crit in H.
121
elim (H (eps / 5) H3); intros N3 H6.
122
set (N := max (max N1 N2) N3).
123
apply Rle_lt_trans with (Rabs (x - Wn N) + Rabs (Wn N - x0)).
124
replace (x - x0) with (x - Wn N + (Wn N - x0)); [ apply Rabs_triang | ring ].
125
apply Rle_lt_trans with
126
(Rabs (x - Wn N) + Rabs (Wn N - Vn N) + Rabs (Vn N - x0)).
128
apply Rplus_le_compat_l.
129
replace (Wn N - x0) with (Wn N - Vn N + (Vn N - x0));
130
[ apply Rabs_triang | ring ].
131
replace eps with (eps / 5 + 3 * (eps / 5) + eps / 5).
132
repeat apply Rplus_lt_compat.
133
rewrite <- Rabs_Ropp.
134
replace (- (x - Wn N)) with (Wn N - x); [ apply H4 | ring ].
135
unfold ge, N in |- *.
136
apply le_trans with (max N1 N2); apply le_max_l.
137
unfold Wn, Vn in |- *.
138
unfold sequence_majorant, sequence_minorant in |- *.
141
approx_maj (fun k:nat => Un (N + k)%nat) (maj_ss Un N (cauchy_maj Un H))).
144
approx_min (fun k:nat => Un (N + k)%nat) (min_ss Un N (cauchy_min Un H))).
147
majorant (fun k:nat => Un (N + k)%nat) (maj_ss Un N (cauchy_maj Un H))).
150
minorant (fun k:nat => Un (N + k)%nat) (min_ss Un N (cauchy_min Un H))).
152
rewrite <- H9; rewrite <- H10.
154
rewrite <- H10 in H7.
155
elim (H7 (eps / 5) H3); intros k2 H11.
156
elim (H8 (eps / 5) H3); intros k1 H12.
157
apply Rle_lt_trans with
158
(Rabs (Wn N - Un (N + k2)%nat) + Rabs (Un (N + k2)%nat - Vn N)).
159
replace (Wn N - Vn N) with
160
(Wn N - Un (N + k2)%nat + (Un (N + k2)%nat - Vn N));
161
[ apply Rabs_triang | ring ].
162
apply Rle_lt_trans with
163
(Rabs (Wn N - Un (N + k2)%nat) + Rabs (Un (N + k2)%nat - Un (N + k1)%nat) +
164
Rabs (Un (N + k1)%nat - Vn N)).
166
apply Rplus_le_compat_l.
167
replace (Un (N + k2)%nat - Vn N) with
168
(Un (N + k2)%nat - Un (N + k1)%nat + (Un (N + k1)%nat - Vn N));
169
[ apply Rabs_triang | ring ].
170
replace (3 * (eps / 5)) with (eps / 5 + eps / 5 + eps / 5);
171
[ repeat apply Rplus_lt_compat | ring ].
175
apply le_trans with N.
176
unfold N in |- *; apply le_max_r.
179
apply le_trans with N.
180
unfold N in |- *; apply le_max_r.
182
rewrite <- Rabs_Ropp.
183
replace (- (Un (N + k1)%nat - Vn N)) with (Vn N - Un (N + k1)%nat);
184
[ assumption | ring ].
188
unfold ge in |- *; apply le_trans with (max N1 N2).
190
unfold N in |- *; apply le_max_l.
191
pattern eps at 4 in |- *; replace eps with (5 * (eps / 5)).
193
unfold Rdiv in |- *; rewrite <- Rmult_assoc; apply Rinv_r_simpl_m.
195
unfold Rdiv in |- *; apply Rmult_lt_0_compat.
197
apply Rinv_0_lt_compat.
198
prove_sup0; try apply lt_O_Sn.