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: Ranalysis2.v 10710 2008-03-23 09:24:09Z herbelin $ i*)
12
Require Import Rfunctions.
13
Require Import Ranalysis1.
14
Open Local Scope R_scope.
18
forall (x h l1 l2:R) (f1 f2:R -> R),
22
(f1 (x + h) / f2 (x + h) - f1 x / f2 x) / h -
23
(l1 * f2 x - l2 * f1 x) / Rsqr (f2 x) =
24
/ f2 (x + h) * ((f1 (x + h) - f1 x) / h - l1) +
25
l1 / (f2 x * f2 (x + h)) * (f2 x - f2 (x + h)) -
26
f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) - f2 x) / h - l2) +
27
l2 * f1 x / (Rsqr (f2 x) * f2 (x + h)) * (f2 (x + h) - f2 x).
29
intros; unfold Rdiv, Rminus, Rsqr in |- *.
30
repeat rewrite Rmult_plus_distr_r; repeat rewrite Rmult_plus_distr_l;
31
repeat rewrite Rinv_mult_distr; try assumption.
32
replace (l1 * f2 x * (/ f2 x * / f2 x)) with (l1 * / f2 x * (f2 x * / f2 x));
34
replace (l1 * (/ f2 x * / f2 (x + h)) * f2 x) with
35
(l1 * / f2 (x + h) * (f2 x * / f2 x)); [ idtac | ring ].
36
replace (l1 * (/ f2 x * / f2 (x + h)) * - f2 (x + h)) with
37
(- (l1 * / f2 x * (f2 (x + h) * / f2 (x + h)))); [ idtac | ring ].
38
replace (f1 x * (/ f2 x * / f2 (x + h)) * (f2 (x + h) * / h)) with
39
(f1 x * / f2 x * / h * (f2 (x + h) * / f2 (x + h)));
41
replace (f1 x * (/ f2 x * / f2 (x + h)) * (- f2 x * / h)) with
42
(- (f1 x * / f2 (x + h) * / h * (f2 x * / f2 x)));
44
replace (l2 * f1 x * (/ f2 x * / f2 x * / f2 (x + h)) * f2 (x + h)) with
45
(l2 * f1 x * / f2 x * / f2 x * (f2 (x + h) * / f2 (x + h)));
47
replace (l2 * f1 x * (/ f2 x * / f2 x * / f2 (x + h)) * - f2 x) with
48
(- (l2 * f1 x * / f2 x * / f2 (x + h) * (f2 x * / f2 x)));
50
repeat rewrite <- Rinv_r_sym; try assumption || ring.
51
apply prod_neq_R0; assumption.
54
Lemma Rmin_pos : forall x y:R, 0 < x -> 0 < y -> 0 < Rmin x y.
56
intros; unfold Rmin in |- *.
57
case (Rle_dec x y); intro; assumption.
61
forall (x h eps l1 alp_f2:R) (eps_f2 alp_f1d:posreal)
69
Rabs ((f1 (x + h) - f1 x) / h - l1) < Rabs (eps * f2 x / 8)) ->
71
Rabs a < Rmin eps_f2 alp_f2 -> / Rabs (f2 (x + a)) < 2 / Rabs (f2 x)) ->
74
Rabs h < Rmin eps_f2 alp_f2 ->
75
Rabs (/ f2 (x + h) * ((f1 (x + h) - f1 x) / h - l1)) < eps / 4.
78
assert (H7 := H3 h H6).
79
assert (H8 := H2 h H4 H5).
80
apply Rle_lt_trans with
81
(2 / Rabs (f2 x) * Rabs ((f1 (x + h) - f1 x) / h - l1)).
83
apply Rmult_le_compat_r.
85
rewrite Rabs_Rinv; [ left; exact H7 | assumption ].
86
apply Rlt_le_trans with (2 / Rabs (f2 x) * Rabs (eps * f2 x / 8)).
87
apply Rmult_lt_compat_l.
88
unfold Rdiv in |- *; apply Rmult_lt_0_compat;
89
[ prove_sup0 | apply Rinv_0_lt_compat; apply Rabs_pos_lt; assumption ].
91
right; unfold Rdiv in |- *.
92
repeat rewrite Rabs_mult.
93
rewrite Rabs_Rinv; discrR.
94
replace (Rabs 8) with 8.
95
replace 8 with 8; [ idtac | ring ].
96
rewrite Rinv_mult_distr; [ idtac | discrR | discrR ].
97
replace (2 * / Rabs (f2 x) * (Rabs eps * Rabs (f2 x) * (/ 2 * / 4))) with
98
(Rabs eps * / 4 * (2 * / 2) * (Rabs (f2 x) * / Rabs (f2 x)));
100
replace (Rabs eps) with eps.
101
repeat rewrite <- Rinv_r_sym; try discrR || (apply Rabs_no_R0; assumption).
103
symmetry in |- *; apply Rabs_right; left; assumption.
104
symmetry in |- *; apply Rabs_right; left; prove_sup.
108
forall (x h eps l1 alp_f2 alp_f2t2:R) (eps_f2:posreal)
115
Rabs (f2 (x + a) - f2 x) < Rabs (eps * Rsqr (f2 x) / (8 * l1))) ->
117
Rabs a < Rmin eps_f2 alp_f2 -> / Rabs (f2 (x + a)) < 2 / Rabs (f2 x)) ->
120
Rabs h < Rmin eps_f2 alp_f2 ->
121
l1 <> 0 -> Rabs (l1 / (f2 x * f2 (x + h)) * (f2 x - f2 (x + h))) < eps / 4.
124
assert (H8 := H3 h H6).
125
assert (H9 := H2 h H5).
126
apply Rle_lt_trans with
127
(Rabs (l1 / (f2 x * f2 (x + h))) * Rabs (eps * Rsqr (f2 x) / (8 * l1))).
128
rewrite Rabs_mult; apply Rmult_le_compat_l.
130
rewrite <- (Rabs_Ropp (f2 x - f2 (x + h))); rewrite Ropp_minus_distr.
132
apply Rlt_le_trans with
133
(Rabs (2 * (l1 / (f2 x * f2 x))) * Rabs (eps * Rsqr (f2 x) / (8 * l1))).
134
apply Rmult_lt_compat_r.
136
unfold Rdiv in |- *; unfold Rsqr in |- *; repeat apply prod_neq_R0;
137
try assumption || discrR.
138
red in |- *; intro H10; rewrite H10 in H; elim (Rlt_irrefl _ H).
139
apply Rinv_neq_0_compat; apply prod_neq_R0; try assumption || discrR.
141
repeat rewrite Rinv_mult_distr; try assumption.
142
repeat rewrite Rabs_mult.
143
replace (Rabs 2) with 2.
144
rewrite (Rmult_comm 2).
145
replace (Rabs l1 * (Rabs (/ f2 x) * Rabs (/ f2 x)) * 2) with
146
(Rabs l1 * (Rabs (/ f2 x) * (Rabs (/ f2 x) * 2)));
148
repeat apply Rmult_lt_compat_l.
149
apply Rabs_pos_lt; assumption.
150
apply Rabs_pos_lt; apply Rinv_neq_0_compat; assumption.
151
repeat rewrite Rabs_Rinv; try assumption.
152
rewrite <- (Rmult_comm 2).
153
unfold Rdiv in H8; exact H8.
154
symmetry in |- *; apply Rabs_right; left; prove_sup0.
156
unfold Rsqr, Rdiv in |- *.
157
do 1 rewrite Rinv_mult_distr; try assumption || discrR.
158
do 1 rewrite Rinv_mult_distr; try assumption || discrR.
159
repeat rewrite Rabs_mult.
160
repeat rewrite Rabs_Rinv; try assumption || discrR.
161
replace (Rabs eps) with eps.
162
replace (Rabs 8) with 8.
163
replace (Rabs 2) with 2.
164
replace 8 with (4 * 2); [ idtac | ring ].
165
rewrite Rinv_mult_distr; discrR.
167
(2 * (Rabs l1 * (/ Rabs (f2 x) * / Rabs (f2 x))) *
168
(eps * (Rabs (f2 x) * Rabs (f2 x)) * (/ 4 * / 2 * / Rabs l1))) with
169
(eps * / 4 * (Rabs l1 * / Rabs l1) * (Rabs (f2 x) * / Rabs (f2 x)) *
170
(Rabs (f2 x) * / Rabs (f2 x)) * (2 * / 2)); [ idtac | ring ].
171
repeat rewrite <- Rinv_r_sym; try (apply Rabs_no_R0; assumption) || discrR.
173
symmetry in |- *; apply Rabs_right; left; prove_sup0.
174
symmetry in |- *; apply Rabs_right; left; prove_sup.
175
symmetry in |- *; apply Rabs_right; left; assumption.
179
forall (x h eps l2 alp_f2:R) (eps_f2 alp_f2d:posreal)
187
Rabs ((f2 (x + h) - f2 x) / h - l2) <
188
Rabs (Rsqr (f2 x) * eps / (8 * f1 x))) ->
190
Rabs a < Rmin eps_f2 alp_f2 -> / Rabs (f2 (x + a)) < 2 / Rabs (f2 x)) ->
193
Rabs h < Rmin eps_f2 alp_f2 ->
195
Rabs (f1 x / (f2 x * f2 (x + h)) * ((f2 (x + h) - f2 x) / h - l2)) <
199
assert (H8 := H2 h H4 H5).
200
assert (H9 := H3 h H6).
201
apply Rle_lt_trans with
202
(Rabs (f1 x / (f2 x * f2 (x + h))) * Rabs (Rsqr (f2 x) * eps / (8 * f1 x))).
204
apply Rmult_le_compat_l.
207
apply Rlt_le_trans with
208
(Rabs (2 * (f1 x / (f2 x * f2 x))) * Rabs (Rsqr (f2 x) * eps / (8 * f1 x))).
209
apply Rmult_lt_compat_r.
211
unfold Rdiv in |- *; unfold Rsqr in |- *; repeat apply prod_neq_R0;
213
red in |- *; intro H10; rewrite H10 in H; elim (Rlt_irrefl _ H).
214
apply Rinv_neq_0_compat; apply prod_neq_R0; discrR || assumption.
216
repeat rewrite Rinv_mult_distr; try assumption.
217
repeat rewrite Rabs_mult.
218
replace (Rabs 2) with 2.
219
rewrite (Rmult_comm 2).
220
replace (Rabs (f1 x) * (Rabs (/ f2 x) * Rabs (/ f2 x)) * 2) with
221
(Rabs (f1 x) * (Rabs (/ f2 x) * (Rabs (/ f2 x) * 2)));
223
repeat apply Rmult_lt_compat_l.
224
apply Rabs_pos_lt; assumption.
225
apply Rabs_pos_lt; apply Rinv_neq_0_compat; assumption.
226
repeat rewrite Rabs_Rinv; assumption || idtac.
227
rewrite <- (Rmult_comm 2).
228
unfold Rdiv in H9; exact H9.
229
symmetry in |- *; apply Rabs_right; left; prove_sup0.
231
unfold Rsqr, Rdiv in |- *.
232
rewrite Rinv_mult_distr; try assumption || discrR.
233
rewrite Rinv_mult_distr; try assumption || discrR.
234
repeat rewrite Rabs_mult.
235
repeat rewrite Rabs_Rinv; try assumption || discrR.
236
replace (Rabs eps) with eps.
237
replace (Rabs 8) with 8.
238
replace (Rabs 2) with 2.
239
replace 8 with (4 * 2); [ idtac | ring ].
240
rewrite Rinv_mult_distr; discrR.
242
(2 * (Rabs (f1 x) * (/ Rabs (f2 x) * / Rabs (f2 x))) *
243
(Rabs (f2 x) * Rabs (f2 x) * eps * (/ 4 * / 2 * / Rabs (f1 x)))) with
244
(eps * / 4 * (Rabs (f2 x) * / Rabs (f2 x)) * (Rabs (f2 x) * / Rabs (f2 x)) *
245
(Rabs (f1 x) * / Rabs (f1 x)) * (2 * / 2)); [ idtac | ring ].
246
repeat rewrite <- Rinv_r_sym; try discrR || (apply Rabs_no_R0; assumption).
248
symmetry in |- *; apply Rabs_right; left; prove_sup0.
249
symmetry in |- *; apply Rabs_right; left; prove_sup.
250
symmetry in |- *; apply Rabs_right; left; assumption.
254
forall (x h eps l2 alp_f2 alp_f2c:R) (eps_f2:posreal)
261
Rabs (f2 (x + a) - f2 x) <
262
Rabs (Rsqr (f2 x) * f2 x * eps / (8 * f1 x * l2))) ->
264
Rabs a < Rmin eps_f2 alp_f2 -> / Rabs (f2 (x + a)) < 2 / Rabs (f2 x)) ->
267
Rabs h < Rmin eps_f2 alp_f2 ->
270
Rabs (l2 * f1 x / (Rsqr (f2 x) * f2 (x + h)) * (f2 (x + h) - f2 x)) <
274
assert (H9 := H2 h H5).
275
assert (H10 := H3 h H6).
276
apply Rle_lt_trans with
277
(Rabs (l2 * f1 x / (Rsqr (f2 x) * f2 (x + h))) *
278
Rabs (Rsqr (f2 x) * f2 x * eps / (8 * f1 x * l2))).
280
apply Rmult_le_compat_l.
283
apply Rlt_le_trans with
284
(Rabs (2 * l2 * (f1 x / (Rsqr (f2 x) * f2 x))) *
285
Rabs (Rsqr (f2 x) * f2 x * eps / (8 * f1 x * l2))).
286
apply Rmult_lt_compat_r.
288
unfold Rdiv in |- *; unfold Rsqr in |- *; repeat apply prod_neq_R0;
290
red in |- *; intro H11; rewrite H11 in H; elim (Rlt_irrefl _ H).
291
apply Rinv_neq_0_compat; apply prod_neq_R0.
297
repeat rewrite Rinv_mult_distr;
298
try assumption || (unfold Rsqr in |- *; apply prod_neq_R0; assumption).
299
repeat rewrite Rabs_mult.
300
replace (Rabs 2) with 2.
302
(2 * Rabs l2 * (Rabs (f1 x) * (Rabs (/ Rsqr (f2 x)) * Rabs (/ f2 x)))) with
303
(Rabs l2 * (Rabs (f1 x) * (Rabs (/ Rsqr (f2 x)) * (Rabs (/ f2 x) * 2))));
306
(Rabs l2 * Rabs (f1 x) * (Rabs (/ Rsqr (f2 x)) * Rabs (/ f2 (x + h)))) with
307
(Rabs l2 * (Rabs (f1 x) * (Rabs (/ Rsqr (f2 x)) * Rabs (/ f2 (x + h)))));
309
repeat apply Rmult_lt_compat_l.
310
apply Rabs_pos_lt; assumption.
311
apply Rabs_pos_lt; assumption.
312
apply Rabs_pos_lt; apply Rinv_neq_0_compat; unfold Rsqr in |- *;
313
apply prod_neq_R0; assumption.
314
repeat rewrite Rabs_Rinv; [ idtac | assumption | assumption ].
315
rewrite <- (Rmult_comm 2).
316
unfold Rdiv in H10; exact H10.
317
symmetry in |- *; apply Rabs_right; left; prove_sup0.
318
right; unfold Rsqr, Rdiv in |- *.
319
rewrite Rinv_mult_distr; try assumption || discrR.
320
rewrite Rinv_mult_distr; try assumption || discrR.
321
rewrite Rinv_mult_distr; try assumption || discrR.
322
rewrite Rinv_mult_distr; try assumption || discrR.
323
repeat rewrite Rabs_mult.
324
repeat rewrite Rabs_Rinv; try assumption || discrR.
325
replace (Rabs eps) with eps.
326
replace (Rabs 8) with 8.
327
replace (Rabs 2) with 2.
328
replace 8 with (4 * 2); [ idtac | ring ].
329
rewrite Rinv_mult_distr; discrR.
332
(Rabs (f1 x) * (/ Rabs (f2 x) * / Rabs (f2 x) * / Rabs (f2 x))) *
333
(Rabs (f2 x) * Rabs (f2 x) * Rabs (f2 x) * eps *
334
(/ 4 * / 2 * / Rabs (f1 x) * / Rabs l2))) with
335
(eps * / 4 * (Rabs l2 * / Rabs l2) * (Rabs (f1 x) * / Rabs (f1 x)) *
336
(Rabs (f2 x) * / Rabs (f2 x)) * (Rabs (f2 x) * / Rabs (f2 x)) *
337
(Rabs (f2 x) * / Rabs (f2 x)) * (2 * / 2)); [ idtac | ring ].
338
repeat rewrite <- Rinv_r_sym; try discrR || (apply Rabs_no_R0; assumption).
340
symmetry in |- *; apply Rabs_right; left; prove_sup0.
341
symmetry in |- *; apply Rabs_right; left; prove_sup.
342
symmetry in |- *; apply Rabs_right; left; assumption.
343
apply prod_neq_R0; assumption || discrR.
344
apply prod_neq_R0; assumption.
347
Lemma D_x_no_cond : forall x a:R, a <> 0 -> D_x no_cond x (x + a).
350
unfold D_x, no_cond in |- *.
354
unfold Rminus in |- *.
355
rewrite Ropp_plus_distr.
356
rewrite <- Rplus_assoc.
359
apply Ropp_neq_0_compat; assumption.
363
forall a b c d:R, Rabs (a + b + c + d) <= Rabs a + Rabs b + Rabs c + Rabs d.
366
apply Rle_trans with (Rabs (a + b) + Rabs (c + d)).
367
replace (a + b + c + d) with (a + b + (c + d)); [ apply Rabs_triang | ring ].
368
apply Rle_trans with (Rabs a + Rabs b + Rabs (c + d)).
369
apply Rplus_le_compat_r.
371
repeat rewrite Rplus_assoc; repeat apply Rplus_le_compat_l.
376
forall a b c d e f g h:R,
377
a < b -> c < d -> e < f -> g < h -> a + c + e + g < b + d + f + h.
379
intros; apply Rlt_trans with (b + c + e + g).
380
repeat apply Rplus_lt_compat_r; assumption.
381
repeat rewrite Rplus_assoc; apply Rplus_lt_compat_l.
382
apply Rlt_trans with (d + e + g).
383
rewrite Rplus_assoc; apply Rplus_lt_compat_r; assumption.
384
rewrite Rplus_assoc; apply Rplus_lt_compat_l; apply Rlt_trans with (f + g).
385
apply Rplus_lt_compat_r; assumption.
386
apply Rplus_lt_compat_l; assumption.
389
Lemma Rmin_2 : forall a b c:R, a < b -> a < c -> a < Rmin b c.
391
intros; unfold Rmin in |- *; case (Rle_dec b c); intro; assumption.
394
Lemma quadruple : forall x:R, 4 * x = x + x + x + x.
399
Lemma quadruple_var : forall x:R, x = x / 4 + x / 4 + x / 4 + x / 4.
401
intro; rewrite <- quadruple.
402
unfold Rdiv in |- *; rewrite <- Rmult_assoc; rewrite Rinv_r_simpl_m; discrR.
407
Lemma continuous_neq_0 :
408
forall (f:R -> R) (x0:R),
409
continuity_pt f x0 ->
411
exists eps : posreal, (forall h:R, Rabs h < eps -> f (x0 + h) <> 0).
413
intros; unfold continuity_pt in H; unfold continue_in in H;
414
unfold limit1_in in H; unfold limit_in in H; elim (H (Rabs (f x0 / 2))).
415
intros; elim H1; intros.
416
exists (mkposreal x H2).
417
intros; assert (H5 := H3 (x0 + h)).
419
(dist R_met (x0 + h) x0 < x ->
420
dist R_met (f (x0 + h)) (f x0) < Rabs (f x0 / 2)).
421
unfold dist in |- *; simpl in |- *; unfold R_dist in |- *;
422
replace (x0 + h - x0) with h.
423
intros; assert (H7 := H6 H4).
425
rewrite H8 in H7; unfold Rminus in H7; rewrite Rplus_0_l in H7;
426
rewrite Rabs_Ropp in H7; unfold Rdiv in H7; rewrite Rabs_mult in H7;
427
pattern (Rabs (f x0)) at 1 in H7; rewrite <- Rmult_1_r in H7.
428
cut (0 < Rabs (f x0)).
429
intro; assert (H10 := Rmult_lt_reg_l _ _ _ H9 H7).
430
cut (Rabs (/ 2) = / 2).
431
assert (Hyp : 0 < 2).
433
intro; rewrite H11 in H10; assert (H12 := Rmult_lt_compat_l 2 _ _ Hyp H10);
434
rewrite Rmult_1_r in H12; rewrite <- Rinv_r_sym in H12;
437
unfold IZR in |- *; unfold INR, nat_of_P in |- *; simpl in |- *; intro;
438
elim (Rlt_irrefl 1 (Rlt_trans _ _ _ H13 H12)).
440
unfold Rabs in |- *; case (Rcase_abs (/ 2)); intro.
441
assert (Hyp : 0 < 2).
443
assert (H11 := Rmult_lt_compat_l 2 _ _ Hyp r); rewrite Rmult_0_r in H11;
444
rewrite <- Rinv_r_sym in H11; [ idtac | discrR ].
445
elim (Rlt_irrefl 0 (Rlt_trans _ _ _ Rlt_0_1 H11)).
447
apply (Rabs_pos_lt _ H0).
449
assert (H6 := Req_dec x0 (x0 + h)); elim H6; intro.
450
intro; rewrite <- H7; unfold dist, R_met in |- *; unfold R_dist in |- *;
451
unfold Rminus in |- *; rewrite Rplus_opp_r; rewrite Rabs_R0;
453
unfold Rdiv in |- *; apply prod_neq_R0;
454
[ assumption | apply Rinv_neq_0_compat; discrR ].
457
unfold D_x, no_cond in |- *.
458
split; trivial || assumption.
460
change (0 < Rabs (f x0 / 2)) in |- *.
461
apply Rabs_pos_lt; unfold Rdiv in |- *; apply prod_neq_R0.
463
apply Rinv_neq_0_compat; discrR.