@@ -30,7 +30,7 @@ exp, log
30
30
31
31
noncomputable theory
32
32
33
- open finset filter metric asymptotics
33
+ open finset filter metric asymptotics set function
34
34
open_locale classical topological_space
35
35
36
36
namespace complex
41
41
rw has_deriv_at_iff_is_o_nhds_zero,
42
42
have : (1 : ℕ) < 2 := by norm_num,
43
43
refine (is_O.of_bound (∥exp x∥) _).trans_is_o (is_o_pow_id this ),
44
- have : metric.ball (0 : ℂ) 1 ∈ nhds (0 : ℂ) := metric.ball_mem_nhds 0 zero_lt_one,
45
- apply filter.mem_sets_of_superset this (λz hz, _),
46
- simp only [metric.mem_ball, dist_zero_right] at hz,
47
- simp only [exp_zero, mul_one, one_mul, add_comm, normed_field.norm_pow,
48
- zero_add, set.mem_set_of_eq],
44
+ filter_upwards [metric.ball_mem_nhds (0 : ℂ) zero_lt_one],
45
+ simp only [metric.mem_ball, dist_zero_right, normed_field.norm_pow],
46
+ intros z hz,
49
47
calc ∥exp (x + z) - exp x - z * exp x∥
50
48
= ∥exp x * (exp z - 1 - z)∥ : by { congr, rw [exp_add], ring }
51
49
... = ∥exp x∥ * ∥exp z - 1 - z∥ : normed_field.norm_mul _ _
@@ -64,7 +62,7 @@ funext $ λ x, (has_deriv_at_exp x).deriv
64
62
65
63
@[simp] lemma iter_deriv_exp : ∀ n : ℕ, (deriv^[n] exp) = exp
66
64
| 0 := rfl
67
- | (n+1 ) := by rw [function. iterate_succ_apply, deriv_exp, iter_deriv_exp n]
65
+ | (n+1 ) := by rw [iterate_succ_apply, deriv_exp, iter_deriv_exp n]
68
66
69
67
lemma continuous_exp : continuous exp :=
70
68
differentiable_exp.continuous
@@ -177,7 +175,7 @@ funext $ λ x, (has_deriv_at_exp x).deriv
177
175
178
176
@[simp] lemma iter_deriv_exp : ∀ n : ℕ, (deriv^[n] exp) = exp
179
177
| 0 := rfl
180
- | (n+1 ) := by rw [function. iterate_succ_apply, deriv_exp, iter_deriv_exp n]
178
+ | (n+1 ) := by rw [iterate_succ_apply, deriv_exp, iter_deriv_exp n]
181
179
182
180
lemma continuous_exp : continuous exp :=
183
181
differentiable_exp.continuous
@@ -305,26 +303,25 @@ lemma tendsto_exp_at_bot : tendsto exp at_bot (𝓝 0) :=
305
303
(tendsto_exp_neg_at_top_nhds_0.comp tendsto_neg_at_bot_at_top).congr $
306
304
λ x, congr_arg exp $ neg_neg x
307
305
308
- lemma tendsto_exp_at_bot_nhds_within : tendsto exp at_bot (𝓝[set. Ioi 0 ] 0 ) :=
306
+ lemma tendsto_exp_at_bot_nhds_within : tendsto exp at_bot (𝓝[Ioi 0 ] 0 ) :=
309
307
tendsto_inf.2 ⟨tendsto_exp_at_bot, tendsto_principal.2 $ eventually_of_forall exp_pos⟩
310
308
311
- lemma range_exp : set.range exp = set.Ioi 0 :=
312
- set.ext $ λ y, ⟨λ ⟨x, hx⟩, hx ▸ exp_pos x,
313
- λ hy, mem_range_of_exists_le_of_exists_ge continuous_exp
314
- (tendsto_exp_at_bot.eventually (ge_mem_nhds hy)).exists
315
- (tendsto_exp_at_top.eventually (eventually_ge_at_top y)).exists⟩
316
-
317
309
/-- `real.exp` as an order isomorphism between `ℝ` and `(0, +∞)`. -/
318
- def exp_order_iso : ℝ ≃o set.Ioi (0 : ℝ) :=
319
- (exp_strict_mono.order_iso _).trans $ order_iso.set_congr _ _ range_exp
310
+ def exp_order_iso : ℝ ≃o Ioi (0 : ℝ) :=
311
+ strict_mono.order_iso_of_surjective _ (exp_strict_mono.cod_restrict exp_pos) $
312
+ surjective_of_continuous (continuous_subtype_mk _ continuous_exp)
313
+ (by simp only [tendsto_Ioi_at_top, coe_cod_restrict_apply, tendsto_exp_at_top])
314
+ (by simp [tendsto_exp_at_bot_nhds_within])
320
315
321
316
@[simp] lemma coe_exp_order_iso_apply (x : ℝ) : (exp_order_iso x : ℝ) = exp x := rfl
322
317
323
318
@[simp] lemma coe_comp_exp_order_iso : coe ∘ exp_order_iso = exp := rfl
324
319
320
+ @[simp] lemma range_exp : range exp = Ioi 0 :=
321
+ by rw [← coe_comp_exp_order_iso, range_comp, exp_order_iso.range_eq, image_univ, subtype.range_coe]
322
+
325
323
@[simp] lemma map_exp_at_top : map exp at_top = at_top :=
326
- by rw [← coe_comp_exp_order_iso, ← filter.map_map, order_iso.map_at_top,
327
- map_coe_Ioi_at_top]
324
+ by rw [← coe_comp_exp_order_iso, ← filter.map_map, order_iso.map_at_top, map_coe_Ioi_at_top]
328
325
329
326
@[simp] lemma comap_exp_at_top : comap exp at_top = at_top :=
330
327
by rw [← map_exp_at_top, comap_map exp_injective, map_exp_at_top]
@@ -337,15 +334,14 @@ lemma tendsto_comp_exp_at_top {α : Type*} {l : filter α} {f : ℝ → α} :
337
334
tendsto (λ x, f (exp x)) at_top l ↔ tendsto f at_top l :=
338
335
by rw [← tendsto_map'_iff, map_exp_at_top]
339
336
340
- @[simp] lemma map_exp_at_bot : map exp at_bot = 𝓝[set.Ioi 0 ] 0 :=
341
- by rw [← coe_comp_exp_order_iso, ← filter.map_map, order_iso.map_at_bot,
342
- ← map_coe_Ioi_at_bot]
337
+ @[simp] lemma map_exp_at_bot : map exp at_bot = 𝓝[Ioi 0 ] 0 :=
338
+ by rw [← coe_comp_exp_order_iso, ← filter.map_map, exp_order_iso.map_at_bot, ← map_coe_Ioi_at_bot]
343
339
344
- lemma comap_exp_nhds_within_Ioi_zero : comap exp (𝓝[set. Ioi 0 ] 0 ) = at_bot :=
340
+ lemma comap_exp_nhds_within_Ioi_zero : comap exp (𝓝[Ioi 0 ] 0 ) = at_bot :=
345
341
by rw [← map_exp_at_bot, comap_map exp_injective]
346
342
347
343
lemma tendsto_comp_exp_at_bot {α : Type *} {l : filter α} {f : ℝ → α} :
348
- tendsto (λ x, f (exp x)) at_bot l ↔ tendsto f (𝓝[set. Ioi 0 ] 0 ) l :=
344
+ tendsto (λ x, f (exp x)) at_bot l ↔ tendsto f (𝓝[Ioi 0 ] 0 ) l :=
349
345
by rw [← map_exp_at_bot, tendsto_map'_iff]
350
346
351
347
/-- The real logarithm function, equal to the inverse of the exponential for `x > 0`,
@@ -372,17 +368,16 @@ by { rw exp_log_eq_abs (ne_of_lt hx), exact abs_of_neg hx }
372
368
@[simp] lemma log_exp (x : ℝ) : log (exp x) = x :=
373
369
exp_injective $ exp_log (exp_pos x)
374
370
375
- lemma surj_on_log : set. surj_on log (set. Ioi 0 ) set. univ :=
371
+ lemma surj_on_log : surj_on log (Ioi 0 ) univ :=
376
372
λ x _, ⟨exp x, exp_pos x, log_exp x⟩
377
373
378
- lemma log_surjective : function. surjective log :=
374
+ lemma log_surjective : surjective log :=
379
375
λ x, ⟨exp x, log_exp x⟩
380
376
381
- @[simp] lemma range_log : set. range log = set. univ :=
377
+ @[simp] lemma range_log : range log = univ :=
382
378
log_surjective.range_eq
383
379
384
- @[simp] lemma log_zero : log 0 = 0 :=
385
- by simp [log]
380
+ @[simp] lemma log_zero : log 0 = 0 := dif_pos rfl
386
381
387
382
@[simp] lemma log_one : log 1 = 0 :=
388
383
exp_injective $ by rw [exp_log zero_lt_one, exp_zero]
397
392
@[simp] lemma log_neg_eq_log (x : ℝ) : log (-x) = log x :=
398
393
by rw [← log_abs x, ← log_abs (-x), abs_neg]
399
394
400
- lemma surj_on_log' : set. surj_on log (set. Iio 0 ) set. univ :=
395
+ lemma surj_on_log' : surj_on log (Iio 0 ) univ :=
401
396
λ x _, ⟨-exp x, neg_lt_zero.2 $ exp_pos x, by rw [log_neg_eq_log, log_exp]⟩
402
397
403
398
lemma log_mul (hx : x ≠ 0 ) (hy : y ≠ 0 ) : log (x * y) = log x + log y :=
@@ -420,13 +415,13 @@ lemma log_lt_log_iff (hx : 0 < x) (hy : 0 < y) : log x < log y ↔ x < y :=
420
415
by { rw [← exp_lt_exp, exp_log hx, exp_log hy] }
421
416
422
417
lemma log_pos_iff (hx : 0 < x) : 0 < log x ↔ 1 < x :=
423
- by { rw ← log_one, exact log_lt_log_iff ( by norm_num) hx }
418
+ by { rw ← log_one, exact log_lt_log_iff zero_lt_one hx }
424
419
425
420
lemma log_pos (hx : 1 < x) : 0 < log x :=
426
421
(log_pos_iff (lt_trans zero_lt_one hx)).2 hx
427
422
428
423
lemma log_neg_iff (h : 0 < x) : log x < 0 ↔ x < 1 :=
429
- by { rw ← log_one, exact log_lt_log_iff h ( by norm_num) }
424
+ by { rw ← log_one, exact log_lt_log_iff h zero_lt_one }
430
425
431
426
lemma log_neg (h0 : 0 < x) (h1 : x < 1 ) : log x < 0 := (log_neg_iff h0).2 h1
432
427
@@ -467,15 +462,15 @@ tendsto_comp_exp_at_top.1 $ by simpa only [log_exp] using tendsto_id
467
462
lemma tendsto_log_nhds_within_zero : tendsto log (𝓝[{0 }ᶜ] 0 ) at_bot :=
468
463
begin
469
464
rw [← (show _ = log, from funext log_abs)],
470
- refine tendsto.comp (_ : tendsto log (𝓝[set. Ioi 0 ] (abs 0 )) at_bot)
465
+ refine tendsto.comp (_ : tendsto log (𝓝[Ioi 0 ] (abs 0 )) at_bot)
471
466
((continuous_abs.tendsto 0 ).inf (tendsto_principal_principal.2 $ λ a, abs_pos.2 )),
472
467
rw [abs_zero, ← tendsto_comp_exp_at_bot],
473
468
simpa using tendsto_id
474
469
end
475
470
476
471
lemma continuous_on_log : continuous_on log {0 }ᶜ :=
477
472
begin
478
- rw [continuous_on_iff_continuous_restrict, set. restrict],
473
+ rw [continuous_on_iff_continuous_restrict, restrict],
479
474
conv in (log _) { rw [log_of_ne_zero (show (x : ℝ) ≠ 0 , from x.2 )] },
480
475
exact exp_order_iso.symm.continuous.comp (continuous_subtype_mk _ continuous_subtype_coe.norm)
481
476
end
686
681
/-- The function `x^n * exp(-x)` tends to `0` at `+∞`, for any natural number `n`. -/
687
682
lemma tendsto_pow_mul_exp_neg_at_top_nhds_0 (n : ℕ) : tendsto (λx, x^n * exp (-x)) at_top (𝓝 0 ) :=
688
683
(tendsto_inv_at_top_zero.comp (tendsto_exp_div_pow_at_top n)).congr $ λx,
689
- by rw [function. comp_app, inv_eq_one_div, div_div_eq_mul_div, one_mul, div_eq_mul_inv, exp_neg]
684
+ by rw [comp_app, inv_eq_one_div, div_div_eq_mul_div, one_mul, div_eq_mul_inv, exp_neg]
690
685
691
686
/-- The function `(b * exp x + c) / (x ^ n)` tends to `+∞` at `+∞`, for any positive natural number
692
687
`n` and any real numbers `b` and `c` such that `b` is positive. -/
@@ -733,7 +728,7 @@ begin
733
728
and then apply the mean value inequality. -/
734
729
let F : ℝ → ℝ := λ x, ∑ i in range n, x^(i+1 )/(i+1 ) + log (1 -x),
735
730
-- First step: compute the derivative of `F`
736
- have A : ∀ y ∈ set. Ioo (-1 : ℝ) 1 , deriv F y = - (y^n) / (1 - y),
731
+ have A : ∀ y ∈ Ioo (-1 : ℝ) 1 , deriv F y = - (y^n) / (1 - y),
737
732
{ assume y hy,
738
733
have : (∑ i in range n, (↑i + 1 ) * y ^ i / (↑i + 1 )) = (∑ i in range n, y ^ i),
739
734
{ congr' with i,
@@ -743,9 +738,9 @@ begin
743
738
sub_ne_zero_of_ne (ne_of_gt hy.2 ), sub_ne_zero_of_ne (ne_of_lt hy.2 )],
744
739
ring },
745
740
-- second step: show that the derivative of `F` is small
746
- have B : ∀ y ∈ set. Icc (-abs x) (abs x), abs (deriv F y) ≤ (abs x)^n / (1 - abs x),
741
+ have B : ∀ y ∈ Icc (-abs x) (abs x), abs (deriv F y) ≤ (abs x)^n / (1 - abs x),
747
742
{ assume y hy,
748
- have : y ∈ set. Ioo (-(1 : ℝ)) 1 := ⟨lt_of_lt_of_le (neg_lt_neg h) hy.1 , lt_of_le_of_lt hy.2 h⟩,
743
+ have : y ∈ Ioo (-(1 : ℝ)) 1 := ⟨lt_of_lt_of_le (neg_lt_neg h) hy.1 , lt_of_le_of_lt hy.2 h⟩,
749
744
calc abs (deriv F y) = abs (-(y^n) / (1 - y)) : by rw [A y this ]
750
745
... ≤ (abs x)^n / (1 - abs x) :
751
746
begin
@@ -757,7 +752,7 @@ begin
757
752
end },
758
753
-- third step: apply the mean value inequality
759
754
have C : ∥F x - F 0 ∥ ≤ ((abs x)^n / (1 - abs x)) * ∥x - 0 ∥,
760
- { have : ∀ y ∈ set. Icc (- abs x) (abs x), differentiable_at ℝ F y,
755
+ { have : ∀ y ∈ Icc (- abs x) (abs x), differentiable_at ℝ F y,
761
756
{ assume y hy,
762
757
have : 1 - y ≠ 0 := sub_ne_zero_of_ne (ne_of_gt (lt_of_le_of_lt hy.2 h)),
763
758
simp [F, this ] },
0 commit comments