Skip to content

Commit 5b3fe12

Browse files
committed
chore(NumberTheory/LSeries): unsqueeze lots of terminal simps (#21133)
1 parent 410dd1f commit 5b3fe12

14 files changed

+306
-415
lines changed

Mathlib/NumberTheory/LSeries/AbstractFuncEq.lean

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,11 @@ variable (P : StrongFEPair E)
177177

178178
/-- As `x → ∞`, `f x` decays faster than any power of `x`. -/
179179
lemma hf_top' (r : ℝ) : P.f =O[atTop] (· ^ r) := by
180-
simpa only [P.hf₀, sub_zero] using P.hf_top r
180+
simpa [P.hf₀] using P.hf_top r
181181

182182
/-- As `x → 0`, `f x` decays faster than any power of `x`. -/
183183
lemma hf_zero' (r : ℝ) : P.f =O[𝓝[>] 0] (· ^ r) := by
184-
have := P.hg₀ ▸ P.hf_zero r
185-
simpa only [smul_zero, sub_zero]
184+
simpa using (P.hg₀ ▸ P.hf_zero r :)
186185

187186
/-!
188187
## Main theorems on strong FE-pairs
@@ -231,8 +230,7 @@ theorem functional_equation (s : ℂ) :
231230
simp_rw [P.h_feq' t ht, ← mul_smul]
232231
-- some simple `cpow` arithmetic to finish
233232
rw [cpow_neg, ofReal_cpow (le_of_lt ht)]
234-
have : (t : ℂ) ^ (P.k : ℂ) ≠ 0 := by
235-
simpa only [← ofReal_cpow (le_of_lt ht), ofReal_ne_zero] using (rpow_pos_of_pos ht _).ne'
233+
have : (t : ℂ) ^ (P.k : ℂ) ≠ 0 := by simpa [← ofReal_cpow ht.le] using (rpow_pos_of_pos ht _).ne'
236234
field_simp [P.hε]
237235

238236
end StrongFEPair
@@ -397,13 +395,13 @@ theorem differentiableAt_Λ {s : ℂ} (hs : s ≠ 0 ∨ P.f₀ = 0) (hs' : s ≠
397395
DifferentiableAt ℂ P.Λ s := by
398396
refine ((P.differentiable_Λ₀ s).sub ?_).sub ?_
399397
· rcases hs with hs | hs
400-
· simpa only [one_div] using (differentiableAt_inv hs).smul_const P.f₀
401-
· simpa only [hs, smul_zero] using differentiableAt_const (0 : E)
398+
· simpa using (differentiableAt_inv hs).smul_const _
399+
· simp [hs]
402400
· rcases hs' with hs' | hs'
403401
· apply DifferentiableAt.smul_const
404402
apply (differentiableAt_const _).div ((differentiableAt_const _).sub (differentiable_id _))
405-
rwa [sub_ne_zero, ne_comm]
406-
· simpa only [hs', smul_zero] using differentiableAt_const (0 : E)
403+
simpa [sub_eq_zero, eq_comm]
404+
· simp [hs']
407405

408406
/-- Relation between `Λ s` and the Mellin transform of `f - f₀`, where the latter is defined. -/
409407
theorem hasMellin [CompleteSpace E]

Mathlib/NumberTheory/LSeries/Basic.lean

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ lemma pow_mul_term_eq (f : ℕ → ℂ) (s : ℂ) (n : ℕ) :
104104
lemma norm_term_eq (f : ℕ → ℂ) (s : ℂ) (n : ℕ) :
105105
‖term f s n‖ = if n = 0 then 0 else ‖f n‖ / n ^ s.re := by
106106
rcases eq_or_ne n 0 with rfl | hn
107-
· simp only [term_zero, norm_zero, ↓reduceIte]
108-
· rw [if_neg hn, term_of_ne_zero hn, norm_div, norm_natCast_cpow_of_pos <| Nat.pos_of_ne_zero hn]
107+
· simp
108+
· simp [hn, norm_natCast_cpow_of_pos <| Nat.pos_of_ne_zero hn]
109109

110110
lemma norm_term_le {f g : ℕ → ℂ} (s : ℂ) {n : ℕ} (h : ‖f n‖ ≤ ‖g n‖) :
111111
‖term f s n‖ ≤ ‖term g s n‖ := by
@@ -118,8 +118,8 @@ lemma norm_term_le_of_re_le_re (f : ℕ → ℂ) {s s' : ℂ} (h : s.re ≤ s'.r
118118
‖term f s' n‖ ≤ ‖term f s n‖ := by
119119
simp only [norm_term_eq]
120120
split
121-
next => rfl
122-
next hn => gcongr; exact Nat.one_le_cast.mpr <| Nat.one_le_iff_ne_zero.mpr hn
121+
· next => rfl
122+
· next hn => gcongr; exact Nat.one_le_cast.mpr <| Nat.one_le_iff_ne_zero.mpr hn
123123

124124
section positivity
125125

@@ -178,9 +178,9 @@ lemma LSeriesSummable.congr' {f g : ℕ → ℂ} (s : ℂ) (h : f =ᶠ[atTop] g)
178178
rw [eventuallyEq_iff_exists_mem] at h ⊢
179179
obtain ⟨S, hS, hS'⟩ := h
180180
refine ⟨S \ {0}, diff_mem hS <| (Set.finite_singleton 0).compl_mem_cofinite, fun n hn ↦ ?_⟩
181-
simp only [Set.mem_diff, Set.mem_singleton_iff] at hn
182-
simp only [term_of_ne_zero hn.2, hS' hn.1]
183-
exact Eventually.mono this.symm fun n hn ↦ by simp only [hn, le_rfl]
181+
rw [Set.mem_diff, Set.mem_singleton_iff] at hn
182+
simp [hn.2, hS' hn.1]
183+
exact this.symm.mono fun n hn ↦ by simp [hn]
184184

185185
open Filter in
186186
/-- If `f` and `g` agree on large `n : ℕ`, then the `LSeries` of `f` converges at `s`
@@ -195,8 +195,7 @@ theorem LSeries.eq_zero_of_not_LSeriesSummable (f : ℕ → ℂ) (s : ℂ) :
195195

196196
@[simp]
197197
theorem LSeriesSummable_zero {s : ℂ} : LSeriesSummable 0 s := by
198-
simp only [LSeriesSummable, funext (term_def 0 s), Pi.zero_apply, zero_div, ite_self,
199-
summable_zero]
198+
simp [LSeriesSummable, funext (term_def 0 s), summable_zero]
200199

201200
/-- This states that the L-series of the sequence `f` converges absolutely at `s` and that
202201
the value there is `a`. -/
@@ -221,7 +220,7 @@ lemma LSeriesHasSum_iff {f : ℕ → ℂ} {s a : ℂ} :
221220

222221
lemma LSeriesHasSum_congr {f g : ℕ → ℂ} (s a : ℂ) (h : ∀ {n}, n ≠ 0 → f n = g n) :
223222
LSeriesHasSum f s a ↔ LSeriesHasSum g s a := by
224-
simp only [LSeriesHasSum_iff, LSeriesSummable_congr s h, LSeries_congr s h]
223+
simp [LSeriesHasSum_iff, LSeriesSummable_congr s h, LSeries_congr s h]
225224

226225
lemma LSeriesSummable.of_re_le_re {f : ℕ → ℂ} {s s' : ℂ} (h : s.re ≤ s'.re)
227226
(hf : LSeriesSummable f s) : LSeriesSummable f s' := by
@@ -260,7 +259,7 @@ scoped[LSeries.notation] notation "δ" => delta
260259
@[simp]
261260
lemma LSeries_zero : LSeries 0 = 0 := by
262261
ext
263-
simp only [LSeries, LSeries.term, Pi.zero_apply, zero_div, ite_self, tsum_zero]
262+
simp [LSeries, LSeries.term]
264263

265264
section delta
266265

@@ -272,16 +271,14 @@ open Nat Complex
272271

273272
lemma term_delta (s : ℂ) (n : ℕ) : term δ s n = if n = 1 then 1 else 0 := by
274273
rcases eq_or_ne n 0 with rfl | hn
275-
· simp only [term_zero, zero_ne_one, ↓reduceIte]
276-
· simp only [ne_eq, hn, not_false_eq_true, term_of_ne_zero, delta]
277-
rcases eq_or_ne n 1 with rfl | hn'
278-
· simp only [↓reduceIte, cast_one, one_cpow, ne_eq, one_ne_zero, not_false_eq_true, div_self]
279-
· simp only [hn', ↓reduceIte, zero_div]
274+
· simp
275+
· rcases eq_or_ne n 1 with hn' | hn' <;>
276+
simp [hn, hn', delta]
280277

281278
lemma mul_delta_eq_smul_delta {f : ℕ → ℂ} : f * δ = f 1 • δ := by
282279
ext n
283-
simp only [Pi.mul_apply, delta, mul_ite, mul_one, mul_zero, Pi.smul_apply, smul_eq_mul]
284-
split_ifs with hn <;> simp only [hn]
280+
by_cases hn : n = 1 <;>
281+
simp [hn, delta]
285282

286283
lemma mul_delta {f : ℕ → ℂ} (h : f 1 = 1) : f * δ = δ := by
287284
rw [mul_delta_eq_smul_delta, h, one_smul]
@@ -297,7 +294,7 @@ end LSeries
297294
/-- The L-series of `δ` is the constant function `1`. -/
298295
lemma LSeries_delta : LSeries δ = 1 := by
299296
ext
300-
simp only [LSeries, LSeries.term_delta, tsum_ite_eq, Pi.one_apply]
297+
simp [LSeries, LSeries.term_delta]
301298

302299
end delta
303300

@@ -335,31 +332,25 @@ lemma LSeriesSummable_of_le_const_mul_rpow {f : ℕ → ℂ} {x : ℝ} {s : ℂ}
335332
(h : ∃ C, ∀ n ≠ 0, ‖f n‖ ≤ C * n ^ (x - 1)) :
336333
LSeriesSummable f s := by
337334
obtain ⟨C, hC⟩ := h
338-
have hC₀ : 0 ≤ C := by
339-
specialize hC 1 one_ne_zero
340-
simp only [Nat.cast_one, Real.one_rpow, mul_one] at hC
341-
exact (norm_nonneg _).trans hC
335+
have hC₀ : 0 ≤ C := (norm_nonneg <| f 1).trans <| by simpa using hC 1 one_ne_zero
342336
have hsum : Summable fun n : ℕ ↦ ‖(C : ℂ) / n ^ (s + (1 - x))‖ := by
343337
simp_rw [div_eq_mul_inv, norm_mul, ← cpow_neg]
344338
have hsx : -s.re + x - 1 < -1 := by linarith only [hs]
345339
refine Summable.mul_left _ <|
346340
Summable.of_norm_bounded_eventually_nat (fun n ↦ (n : ℝ) ^ (-s.re + x - 1)) ?_ ?_
347-
· simp only [Real.summable_nat_rpow, hsx]
348-
· simp only [neg_add_rev, neg_sub, norm_norm, Filter.eventually_atTop]
349-
refine ⟨1, fun n hn ↦ ?_⟩
341+
· simpa
342+
· simp only [norm_norm, Filter.eventually_atTop]
343+
refine ⟨1, fun n hn ↦ le_of_eq ?_⟩
350344
simp only [norm_natCast_cpow_of_pos hn, add_re, sub_re, neg_re, ofReal_re, one_re]
351-
convert le_refl ?_ using 2
352-
ring
345+
ring_nf
353346
refine Summable.of_norm <| hsum.of_nonneg_of_le (fun _ ↦ norm_nonneg _) (fun n ↦ ?_)
354347
rcases n.eq_zero_or_pos with rfl | hn
355-
· simp only [term_zero, norm_zero]
356-
exact norm_nonneg _
348+
· simpa only [term_zero, norm_zero] using norm_nonneg _
357349
have hn' : 0 < (n : ℝ) ^ s.re := Real.rpow_pos_of_pos (Nat.cast_pos.mpr hn) _
358350
simp_rw [term_of_ne_zero hn.ne', norm_div, norm_natCast_cpow_of_pos hn, div_le_iff₀ hn',
359351
norm_eq_abs (C : ℂ), abs_ofReal, _root_.abs_of_nonneg hC₀, div_eq_mul_inv, mul_assoc,
360352
← Real.rpow_neg <| Nat.cast_nonneg _, ← Real.rpow_add <| Nat.cast_pos.mpr hn]
361-
simp only [add_re, sub_re, one_re, ofReal_re, neg_add_rev, neg_sub, neg_add_cancel_right]
362-
exact hC n <| Nat.pos_iff_ne_zero.mp hn
353+
simpa using hC n <| Nat.pos_iff_ne_zero.mp hn
363354

364355
open Filter Finset Real Nat in
365356
/-- If `f = O(n^(x-1))` and `re s > x`, then the `LSeries` of `f` is summable at `s`. -/
@@ -386,12 +377,11 @@ lemma LSeriesSummable_of_isBigO_rpow {f : ℕ → ℂ} {x : ℝ} {s : ℂ} (hs :
386377
/-- If `f` is bounded, then its `LSeries` is summable at `s` when `re s > 1`. -/
387378
theorem LSeriesSummable_of_bounded_of_one_lt_re {f : ℕ → ℂ} {m : ℝ}
388379
(h : ∀ n ≠ 0, Complex.abs (f n) ≤ m) {s : ℂ} (hs : 1 < s.re) :
389-
LSeriesSummable f s := by
390-
refine LSeriesSummable_of_le_const_mul_rpow hs ⟨m, fun n hn ↦ ?_⟩
391-
simp only [norm_eq_abs, sub_self, Real.rpow_zero, mul_one, h n hn]
380+
LSeriesSummable f s :=
381+
LSeriesSummable_of_le_const_mul_rpow hs ⟨m, fun n hn ↦ by simp [h n hn]⟩
392382

393383
/-- If `f` is bounded, then its `LSeries` is summable at `s : ℝ` when `s > 1`. -/
394384
theorem LSeriesSummable_of_bounded_of_one_lt_real {f : ℕ → ℂ} {m : ℝ}
395385
(h : ∀ n ≠ 0, Complex.abs (f n) ≤ m) {s : ℝ} (hs : 1 < s) :
396386
LSeriesSummable f s :=
397-
LSeriesSummable_of_bounded_of_one_lt_re h <| by simp only [ofReal_re, hs]
387+
LSeriesSummable_of_bounded_of_one_lt_re h <| by simp [hs]

Mathlib/NumberTheory/LSeries/Convergence.lean

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -41,47 +41,42 @@ open LSeries
4141

4242
lemma LSeriesSummable_of_abscissaOfAbsConv_lt_re {f : ℕ → ℂ} {s : ℂ}
4343
(hs : abscissaOfAbsConv f < s.re) : LSeriesSummable f s := by
44-
simp only [abscissaOfAbsConv, sInf_lt_iff, Set.mem_image, Set.mem_setOf_eq,
45-
exists_exists_and_eq_and, EReal.coe_lt_coe_iff] at hs
46-
obtain ⟨y, hy, hys⟩ := hs
44+
obtain ⟨y, hy, hys⟩ : ∃ a : ℝ, LSeriesSummable f a ∧ a < s.re := by
45+
simpa [abscissaOfAbsConv, sInf_lt_iff] using hs
4746
exact hy.of_re_le_re <| ofReal_re y ▸ hys.le
4847

4948
lemma LSeriesSummable_lt_re_of_abscissaOfAbsConv_lt_re {f : ℕ → ℂ} {s : ℂ}
5049
(hs : abscissaOfAbsConv f < s.re) :
5150
∃ x : ℝ, x < s.re ∧ LSeriesSummable f x := by
5251
obtain ⟨x, hx₁, hx₂⟩ := EReal.exists_between_coe_real hs
53-
exact ⟨x, EReal.coe_lt_coe_iff.mp hx₂, LSeriesSummable_of_abscissaOfAbsConv_lt_re hx₁⟩
52+
exact ⟨x, by simpa using hx₂, LSeriesSummable_of_abscissaOfAbsConv_lt_re hx₁⟩
5453

5554
lemma LSeriesSummable.abscissaOfAbsConv_le {f : ℕ → ℂ} {s : ℂ} (h : LSeriesSummable f s) :
56-
abscissaOfAbsConv f ≤ s.re := by
57-
refine sInf_le <| Membership.mem.out ?_
58-
simp only [Set.mem_setOf_eq, Set.mem_image, EReal.coe_eq_coe_iff, exists_eq_right]
59-
exact h.of_re_le_re <| by simp only [ofReal_re, le_refl]
55+
abscissaOfAbsConv f ≤ s.re :=
56+
sInf_le <| by simpa using h.of_re_le_re (by simp)
6057

6158
lemma LSeries.abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable {f : ℕ → ℂ} {x : ℝ}
6259
(h : ∀ y : ℝ, x < y → LSeriesSummable f y) :
6360
abscissaOfAbsConv f ≤ x := by
64-
refine sInf_le_iff.mpr fun y hy ↦ ?_
65-
simp only [mem_lowerBounds, Set.mem_image, Set.mem_setOf_eq, forall_exists_index, and_imp,
66-
forall_apply_eq_imp_iff₂] at hy
67-
have H (a : EReal) : x < a → y ≤ a := by
68-
induction' a with a₀
69-
· simp only [not_lt_bot, le_bot_iff, IsEmpty.forall_iff]
70-
· exact_mod_cast fun ha ↦ hy a₀ (h a₀ ha)
71-
· simp only [EReal.coe_lt_top, le_top, forall_true_left]
72-
exact Set.Ioi_subset_Ici_iff.mp H
61+
refine sInf_le_iff.mpr fun y hy ↦ le_of_forall_gt_imp_ge_of_dense fun a ↦ ?_
62+
replace hy : ∀ (a : ℝ), LSeriesSummable f a → y ≤ a := by simpa [mem_lowerBounds] using hy
63+
cases a with
64+
| h_real a₀ => exact_mod_cast fun ha ↦ hy a₀ (h a₀ ha)
65+
| h_bot => simp
66+
| h_top => simp
7367

7468
lemma LSeries.abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable' {f : ℕ → ℂ} {x : EReal}
7569
(h : ∀ y : ℝ, x < y → LSeriesSummable f y) :
7670
abscissaOfAbsConv f ≤ x := by
77-
induction' x with y
78-
· refine le_of_eq <| sInf_eq_bot.mpr fun y hy ↦ ?_
79-
induction' y with z
80-
· simp only [gt_iff_lt, lt_self_iff_false] at hy
81-
· exact ⟨z - 1, ⟨z-1, h (z - 1) <| EReal.bot_lt_coe _, rfl⟩, by norm_cast; exact sub_one_lt z⟩
82-
· exact ⟨0, ⟨0, h 0 <| EReal.bot_lt_coe 0, rfl⟩, EReal.zero_lt_top⟩
83-
· exact abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable <| by exact_mod_cast h
84-
· exact le_top
71+
cases x with
72+
| h_real => exact abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable <| mod_cast h
73+
| h_top => exact le_top
74+
| h_bot =>
75+
refine le_of_eq <| sInf_eq_bot.mpr fun y hy ↦ ?_
76+
cases y with
77+
| h_bot => simp at hy
78+
| h_real y => exact ⟨_, ⟨_, h _ <| EReal.bot_lt_coe _, rfl⟩, mod_cast sub_one_lt y⟩
79+
| h_top => exact ⟨_, ⟨_, h _ <| EReal.bot_lt_coe 0, rfl⟩, EReal.zero_lt_top⟩
8580

8681
/-- If `‖f n‖` is bounded by a constant times `n^x`, then the abscissa of absolute convergence
8782
of `f` is bounded by `x + 1`. -/
@@ -108,35 +103,27 @@ lemma LSeries.abscissaOfAbsConv_le_of_isBigO_rpow {f : ℕ → ℂ} {x : ℝ}
108103
/-- If `f` is bounded, then the abscissa of absolute convergence of `f` is bounded above by `1`. -/
109104
lemma LSeries.abscissaOfAbsConv_le_of_le_const {f : ℕ → ℂ} (h : ∃ C, ∀ n ≠ 0, ‖f n‖ ≤ C) :
110105
abscissaOfAbsConv f ≤ 1 := by
111-
convert abscissaOfAbsConv_le_of_le_const_mul_rpow (x := 0) ?_
112-
· simp only [EReal.coe_zero, zero_add]
113-
· simpa only [norm_eq_abs, Real.rpow_zero, mul_one] using h
106+
simpa using abscissaOfAbsConv_le_of_le_const_mul_rpow (x := 0) (by simpa using h)
114107

115108
open Filter in
116109
/-- If `f` is `O(1)`, then the abscissa of absolute convergence of `f` is bounded above by `1`. -/
117-
lemma LSeries.abscissaOfAbsConv_le_one_of_isBigO_one {f : ℕ → ℂ} (h : f =O[atTop] (1 : ℕ → ℝ)) :
110+
lemma LSeries.abscissaOfAbsConv_le_one_of_isBigO_one {f : ℕ → ℂ} (h : f =O[atTop] fun _ ↦ (1 : ℝ)) :
118111
abscissaOfAbsConv f ≤ 1 := by
119-
convert abscissaOfAbsConv_le_of_isBigO_rpow (x := 0) ?_
120-
· simp only [EReal.coe_zero, zero_add]
121-
· simpa only [Real.rpow_zero] using h
112+
simpa using abscissaOfAbsConv_le_of_isBigO_rpow (x := 0) (by simpa using h)
122113

123114
/-- If `f` is real-valued and `x` is strictly greater than the abscissa of absolute convergence
124115
of `f`, then the real series `∑' n, f n / n ^ x` converges. -/
125116
lemma LSeries.summable_real_of_abscissaOfAbsConv_lt {f : ℕ → ℝ} {x : ℝ}
126117
(h : abscissaOfAbsConv (f ·) < x) :
127118
Summable fun n : ℕ ↦ f n / (n : ℝ) ^ x := by
128-
have h' : abscissaOfAbsConv (f ·) < (x : ℂ).re := by simpa only [ofReal_re] using h
129-
have := LSeriesSummable_of_abscissaOfAbsConv_lt_re h'
130-
rw [LSeriesSummable, show term _ _ = fun n ↦ _ from rfl] at this
131-
conv at this =>
132-
enter [1, n]
133-
rw [term_def, ← ofReal_natCast, ← ofReal_cpow n.cast_nonneg, ← ofReal_div, ← ofReal_zero,
134-
← apply_ite]
135-
rw [summable_ofReal] at this
119+
have aux : term (f ·) x = fun n ↦ ↑(if n = 0 then 0 else f n / (n : ℝ) ^ x) := by
120+
ext n
121+
simp [term_def, apply_ite ((↑) : ℝ → ℂ), ofReal_cpow n.cast_nonneg]
122+
have := LSeriesSummable_of_abscissaOfAbsConv_lt_re (ofReal_re x ▸ h)
123+
simp only [LSeriesSummable, aux, summable_ofReal] at this
136124
refine this.congr_cofinite ?_
137-
filter_upwards [Set.Finite.compl_mem_cofinite <| Set.finite_singleton 0] with n hn
138-
simp only [Set.mem_compl_iff, Set.mem_singleton_iff] at hn
139-
exact if_neg hn
125+
filter_upwards [(Set.finite_singleton 0).compl_mem_cofinite] with n hn
126+
using if_neg (by simpa using hn)
140127

141128
/-- If `F` is a binary operation on `ℕ → ℂ` with the property that the `LSeries` of `F f g`
142129
converges whenever the `LSeries` of `f` and `g` do, then the abscissa of absolute convergence

0 commit comments

Comments
 (0)