Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 084702d

Browse files
committed
chore(analysis/normed_algebra/exponential): golf, generalize (#9740)
* move `real.summable_pow_div_factorial` to `analysis.specific_limits`, golf the proof; * use recently added lemma `inv_nat_cast_smul_eq` to golf the proof of equality of exponentials defined using different fields and generalize the statement: we no longer require one field to be a normed algebra over another. * rename `exp_eq_exp_of_field_extension` → `exp_eq_exp` and `exp_series_eq_exp_series_of_field_extension` → `exp_series_eq_exp_series` because we no longer require `[normed_algebra 𝕂 𝕂']`.
1 parent 376bba8 commit 084702d

File tree

4 files changed

+44
-67
lines changed

4 files changed

+44
-67
lines changed

src/algebra/order/field.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ begin
327327
exact mul_le_mul_of_nonneg_right h (one_div_nonneg.2 hc)
328328
end
329329

330-
@[mono] lemma div_le_div_of_le_left (ha : 0 ≤ a) (hc : 0 < c) (h : c ≤ b) : a / b ≤ a / c :=
330+
-- Not a `mono` lemma b/c `div_le_div` is strictly more general
331+
lemma div_le_div_of_le_left (ha : 0 ≤ a) (hc : 0 < c) (h : c ≤ b) : a / b ≤ a / c :=
331332
begin
332333
rw [div_eq_mul_inv, div_eq_mul_inv],
333334
exact mul_le_mul_of_nonneg_left ((inv_le_inv (hc.trans_le h) hc).mpr h) ha

src/analysis/normed_space/exponential.lean

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Copyright (c) 2021 Anatole Dedecker. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Anatole Dedecker
55
-/
6-
import algebra.char_p.algebra
76
import analysis.calculus.deriv
87
import analysis.calculus.fderiv_analytic
98
import analysis.specific_limits
@@ -56,9 +55,7 @@ We prove most result for an arbitrary field `𝕂`, and then specialize to `𝕂
5655
5756
### Other useful compatibility results
5857
59-
- `exp_eq_exp_of_field_extension` : given `𝕂' / 𝕂` a normed field extension (that is, an instance
60-
of `normed_algebra 𝕂 𝕂'`) and a normed algebra `𝔸` over both `𝕂` and `𝕂'` then
61-
`exp 𝕂 𝔸 = exp 𝕂' 𝔸`
58+
- `exp_eq_exp` : if `𝔸` is a normed algebra over two fields `𝕂` and `𝕂'`, then `exp 𝕂 𝔸 = exp 𝕂' 𝔸`
6259
- `complex.exp_eq_exp_ℂ_ℂ` : `complex.exp = exp ℂ ℂ`
6360
- `real.exp_eq_exp_ℝ_ℝ` : `real.exp = exp ℝ ℝ`
6461
@@ -330,36 +327,6 @@ section any_algebra
330327

331328
variables {𝕂 𝔸 : Type*} [is_R_or_C 𝕂] [normed_ring 𝔸] [normed_algebra 𝕂 𝔸]
332329

333-
-- This is private because one can use the more general `exp_series_summable_field` intead.
334-
private lemma real.summable_pow_div_factorial (x : ℝ) : summable (λ n : ℕ, x^n / n!) :=
335-
begin
336-
by_cases h : x = 0,
337-
{ refine summable_of_norm_bounded_eventually 0 summable_zero _,
338-
filter_upwards [eventually_cofinite_ne 0],
339-
intros n hn,
340-
rw [h, zero_pow' n hn, zero_div, norm_zero],
341-
exact le_refl _ },
342-
{ refine summable_of_ratio_test_tendsto_lt_one zero_lt_one (eventually_of_forall $
343-
λ n, div_ne_zero (pow_ne_zero n h) (nat.cast_ne_zero.mpr n.factorial_ne_zero)) _,
344-
suffices : ∀ n : ℕ, ∥x^(n+1) / (n+1)!∥ / ∥x^n / n!∥ = ∥x∥ / ∥((n+1 : ℕ) : ℝ)∥,
345-
{ conv {congr, funext, rw [this, real.norm_coe_nat] },
346-
exact (tendsto_const_div_at_top_nhds_0_nat _).comp (tendsto_add_at_top_nat 1) },
347-
intro n,
348-
calc ∥x^(n+1) / (n+1)!∥ / ∥x^n / n!∥
349-
= (∥x∥^n * ∥x∥) * (∥(n! : ℝ)∥⁻¹ * ∥((n+1 : ℕ) : ℝ)∥⁻¹) * ((∥x∥^n)⁻¹ * ∥(n! : ℝ)∥) :
350-
by rw [ normed_field.norm_div, normed_field.norm_div,
351-
normed_field.norm_pow, normed_field.norm_pow, pow_add, pow_one,
352-
div_eq_mul_inv, div_eq_mul_inv, div_eq_mul_inv, mul_inv₀, inv_inv₀,
353-
nat.factorial_succ, nat.cast_mul, normed_field.norm_mul, mul_inv_rev₀ ]
354-
... = (∥x∥ * ∥((n+1 : ℕ) : ℝ)∥⁻¹) * (∥x∥^n * (∥x∥^n)⁻¹) * (∥(n! : ℝ)∥ * ∥(n! : ℝ)∥⁻¹) :
355-
by linarith --faster than ac_refl !
356-
... = (∥x∥ * ∥((n+1 : ℕ) : ℝ)∥⁻¹) * 1 * 1 :
357-
by rw [mul_inv_cancel (pow_ne_zero _ $ λ h', h $ norm_eq_zero.mp h'), mul_inv_cancel
358-
(λ h', n.factorial_ne_zero $ nat.cast_eq_zero.mp $ norm_eq_zero.mp h')];
359-
apply_instance
360-
... = ∥x∥ / ∥((n+1 : ℕ) : ℝ)∥ : by rw [mul_one, mul_one, ← div_eq_mul_inv] }
361-
end
362-
363330
variables (𝕂 𝔸)
364331

365332
/-- In a normed algebra `𝔸` over `𝕂 = ℝ` or `𝕂 = ℂ`, the series defining the exponential map
@@ -521,41 +488,25 @@ end is_R_or_C
521488
section scalar_tower
522489

523490
variables (𝕂 𝕂' 𝔸 : Type*) [nondiscrete_normed_field 𝕂] [nondiscrete_normed_field 𝕂']
524-
[normed_ring 𝔸] [normed_algebra 𝕂 𝔸] [normed_algebra 𝕂 𝕂'] [normed_algebra 𝕂' 𝔸]
525-
[is_scalar_tower 𝕂 𝕂' 𝔸]
491+
[normed_ring 𝔸] [normed_algebra 𝕂 𝔸] [normed_algebra 𝕂' 𝔸]
526492

527-
lemma exp_series_eq_exp_series_of_field_extension (n : ℕ) (x : 𝔸) :
493+
/-- If a normed ring `𝔸` is a normed algebra over two fields, then they define the same
494+
`exp_series` on `𝔸`. -/
495+
lemma exp_series_eq_exp_series (n : ℕ) (x : 𝔸) :
528496
(exp_series 𝕂 𝔸 n (λ _, x)) = (exp_series 𝕂' 𝔸 n (λ _, x)) :=
529-
begin
530-
let p := ring_char 𝕂,
531-
haveI : char_p 𝕂' p := char_p_of_injective_algebra_map (algebra_map 𝕂 𝕂').injective p,
532-
rw [exp_series, exp_series,
533-
smul_apply, mk_pi_algebra_fin_apply, list.of_fn_const, list.prod_repeat,
534-
smul_apply, mk_pi_algebra_fin_apply, list.of_fn_const, list.prod_repeat,
535-
←inv_eq_one_div, ←inv_eq_one_div, ← smul_one_smul 𝕂' (_ : 𝕂) (_ : 𝔸)],
536-
congr,
537-
symmetry,
538-
have key : (n! : 𝕂) = 0 ↔ (n! : 𝕂') = 0,
539-
{ rw [char_p.cast_eq_zero_iff 𝕂' p, char_p.cast_eq_zero_iff 𝕂 p] },
540-
by_cases h : (n! : 𝕂) = 0,
541-
{ have h' : (n! : 𝕂') = 0 := key.mp h,
542-
field_simp [h, h'] },
543-
{ have h' : (n! : 𝕂') ≠ 0 := λ hyp, h (key.mpr hyp),
544-
suffices : (n! : 𝕂) • (n!⁻¹ : 𝕂') = (n! : 𝕂) • ((n!⁻¹ : 𝕂) • 1),
545-
{ apply_fun (λ (x : 𝕂'), (n!⁻¹ : 𝕂) • x) at this,
546-
rwa [inv_smul_smul₀ h, inv_smul_smul₀ h] at this },
547-
rw [← smul_assoc, ← nsmul_eq_smul_cast, nsmul_eq_smul_cast 𝕂' _ (_ : 𝕂')],
548-
field_simp [h, h'] }
549-
end
550-
551-
/-- Given `𝕂' / 𝕂` a normed field extension (that is, an instance of `normed_algebra 𝕂 𝕂'`) and a
552-
normed algebra `𝔸` over both `𝕂` and `𝕂'` then `exp 𝕂 𝔸 = exp 𝕂' 𝔸`. -/
553-
lemma exp_eq_exp_of_field_extension : exp 𝕂 𝔸 = exp 𝕂' 𝔸 :=
497+
by rw [exp_series, exp_series,
498+
smul_apply, mk_pi_algebra_fin_apply, list.of_fn_const, list.prod_repeat,
499+
smul_apply, mk_pi_algebra_fin_apply, list.of_fn_const, list.prod_repeat,
500+
one_div, one_div, inv_nat_cast_smul_eq 𝕂 𝕂']
501+
502+
/-- If a normed ring `𝔸` is a normed algebra over two fields, then they define the same
503+
exponential function on `𝔸`. -/
504+
lemma exp_eq_exp : exp 𝕂 𝔸 = exp 𝕂' 𝔸 :=
554505
begin
555506
ext,
556507
rw [exp, exp],
557508
refine tsum_congr (λ n, _),
558-
rw exp_series_eq_exp_series_of_field_extension 𝕂 𝕂' 𝔸 n x
509+
rw exp_series_eq_exp_series 𝕂 𝕂' 𝔸 n x
559510
end
560511

561512
end scalar_tower
@@ -571,7 +522,7 @@ begin
571522
end
572523

573524
lemma exp_ℝ_ℂ_eq_exp_ℂ_ℂ : exp ℝ ℂ = exp ℂ ℂ :=
574-
exp_eq_exp_of_field_extension ℝ ℂ ℂ
525+
exp_eq_exp ℝ ℂ ℂ
575526

576527
end complex
577528

src/analysis/specific_limits.lean

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,31 @@ tendsto_of_tendsto_of_tendsto_of_le_of_le'
992992
{ refine (div_le_one $ by exact_mod_cast hn).mpr _, norm_cast, linarith }
993993
end
994994

995+
/-- The series `∑' n, x ^ n / n!` is summable of any `x : ℝ`. See also `exp_series_field_summable`
996+
for a version that also works in `ℂ`, and `exp_series_summable'` for a version that works in
997+
any normed algebra over `ℝ` or `ℂ`. -/
998+
lemma real.summable_pow_div_factorial (x : ℝ) :
999+
summable (λ n, x ^ n / n! : ℕ → ℝ) :=
1000+
begin
1001+
-- We start with trivial extimates
1002+
have A : (0 : ℝ) < ⌊∥x∥⌋₊ + 1, from zero_lt_one.trans_le (by simp),
1003+
have B : ∥x∥ / (⌊∥x∥⌋₊ + 1) < 1, from (div_lt_one A).2 (nat.lt_floor_add_one _),
1004+
-- Then we apply the ratio test. The estimate works for `n ≥ ⌊∥x∥⌋₊`.
1005+
suffices : ∀ n ≥ ⌊∥x∥⌋₊, ∥x ^ (n + 1) / (n + 1)!∥ ≤ ∥x∥ / (⌊∥x∥⌋₊ + 1) * ∥x ^ n / ↑n!∥,
1006+
from summable_of_ratio_norm_eventually_le B (eventually_at_top.2 ⟨⌊∥x∥⌋₊, this⟩),
1007+
-- Finally, we prove the upper estimate
1008+
intros n hn,
1009+
calc ∥x ^ (n + 1) / (n + 1)!∥ = (∥x∥ / (n + 1)) * ∥x ^ n / n!∥ :
1010+
by rw [pow_succ, nat.factorial_succ, nat.cast_mul, ← div_mul_div,
1011+
normed_field.norm_mul, normed_field.norm_div, real.norm_coe_nat, nat.cast_succ]
1012+
... ≤ (∥x∥ / (⌊∥x∥⌋₊ + 1)) * ∥x ^ n / n!∥ :
1013+
by mono* with [0 ≤ ∥x ^ n / n!∥, 0 ≤ ∥x∥]; apply norm_nonneg
1014+
end
1015+
1016+
lemma real.tendsto_pow_div_factorial_at_top (x : ℝ) :
1017+
tendsto (λ n, x ^ n / n! : ℕ → ℝ) at_top (𝓝 0) :=
1018+
(real.summable_pow_div_factorial x).tendsto_at_top_zero
1019+
9951020
/-!
9961021
### Ceil and floor
9971022
-/

src/data/nat/cast.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ variables [ordered_semiring α]
166166
| 0 := le_refl _
167167
| (n+1) := add_nonneg (cast_nonneg n) zero_le_one
168168

169-
theorem mono_cast : monotone (coe : ℕ → α) :=
169+
@[mono] theorem mono_cast : monotone (coe : ℕ → α) :=
170170
λ m n h, let ⟨k, hk⟩ := le_iff_exists_add.1 h in by simp [hk]
171171

172172
variable [nontrivial α]
@@ -179,7 +179,7 @@ theorem strict_mono_cast : strict_mono (coe : ℕ → α) :=
179179
(m : α) ≤ n ↔ m ≤ n :=
180180
strict_mono_cast.le_iff_le
181181

182-
@[simp, norm_cast] theorem cast_lt {m n : ℕ} : (m : α) < n ↔ m < n :=
182+
@[simp, norm_cast, mono] theorem cast_lt {m n : ℕ} : (m : α) < n ↔ m < n :=
183183
strict_mono_cast.lt_iff_lt
184184

185185
@[simp] theorem cast_pos {n : ℕ} : (0 : α) < n ↔ 0 < n :=

0 commit comments

Comments
 (0)