Skip to content

Commit d4131b7

Browse files
PeriecleRoman Kvasnytskyi
andcommitted
refactor(NumberTheory/LSeries): move evaluation argument s to last in LSeries_congr (#29060)
Align with Mathlib convention of having evaluation variables last, improving readability, partial application, and consistency with derivative/continuity lemmas. Previously, `s` was first, which was slightly off-pattern and less ergonomic in pipelines. Co-authored-by: Roman Kvasnytskyi <rkvasnytskyi@playtika.com>
1 parent e2217c8 commit d4131b7

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

Mathlib/NumberTheory/LSeries/Basic.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ noncomputable
160160
def LSeries (f : ℕ → ℂ) (s : ℂ) : ℂ :=
161161
∑' n, term f s n
162162

163-
-- TODO: change argument order in `LSeries_congr` to have `s` last.
164-
lemma LSeries_congr {f g : ℕ → ℂ} (s : ℂ) (h : ∀ {n}, n ≠ 0 → f n = g n) :
163+
/-- Congruence for `LSeries` with the evaluation variable `s`. -/
164+
lemma LSeries_congr {f g : ℕ → ℂ} (h : ∀ {n}, n ≠ 0 → f n = g n) (s : ℂ) :
165165
LSeries f s = LSeries g s :=
166166
tsum_congr <| term_congr h s
167167

@@ -226,7 +226,7 @@ lemma LSeriesHasSum_iff {f : ℕ → ℂ} {s a : ℂ} :
226226

227227
lemma LSeriesHasSum_congr {f g : ℕ → ℂ} (s a : ℂ) (h : ∀ {n}, n ≠ 0 → f n = g n) :
228228
LSeriesHasSum f s a ↔ LSeriesHasSum g s a := by
229-
simp [LSeriesHasSum_iff, LSeriesSummable_congr s h, LSeries_congr s h]
229+
simp [LSeriesHasSum_iff, LSeriesSummable_congr s h, LSeries_congr h s]
230230

231231
lemma LSeriesSummable.of_re_le_re {f : ℕ → ℂ} {s s' : ℂ} (h : s.re ≤ s'.re)
232232
(hf : LSeriesSummable f s) : LSeriesSummable f s' := by

Mathlib/NumberTheory/LSeries/Dirichlet.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ namespace ArithmeticFunction
250250
to the constant sequence `1`. -/
251251
lemma LSeries_zeta_eq : L ↗ζ = L 1 := by
252252
ext s
253-
exact (LSeries_congr s const_one_eq_zeta).symm
253+
exact (LSeries_congr const_one_eq_zeta s).symm
254254

255255
/-- The `LSeries` associated to the arithmetic function `ζ` converges at `s` if and only if
256256
`re s > 1`. -/
@@ -376,7 +376,7 @@ lemma LSeries_twist_vonMangoldt_eq {N : ℕ} (χ : DirichletCharacter ℂ N) {s
376376
have hΛ : LSeriesSummable (↗χ * ↗Λ) s := LSeriesSummable_twist_vonMangoldt χ hs
377377
rw [eq_div_iff <| LSeries_ne_zero_of_one_lt_re χ hs, ← LSeries_convolution' hΛ hχ,
378378
convolution_twist_vonMangoldt, LSeries_deriv hs', neg_neg]
379-
exact LSeries_congr s fun _ ↦ by simp [mul_comm, logMul]
379+
exact LSeries_congr (fun _ ↦ by simp [mul_comm, logMul]) s
380380

381381
end DirichletCharacter
382382

@@ -386,7 +386,7 @@ open DirichletCharacter in
386386
/-- The L-series of the von Mangoldt function `Λ` equals the negative logarithmic derivative
387387
of the L-series of the constant sequence `1` on its domain of convergence `re s > 1`. -/
388388
lemma LSeries_vonMangoldt_eq {s : ℂ} (hs : 1 < s.re) : L ↗Λ s = - deriv (L 1) s / L 1 s := by
389-
refine (LSeries_congr s fun {n} _ ↦ ?_).trans <|
389+
refine (LSeries_congr (fun {n} _ ↦ ?_) s).trans <|
390390
LSeries_modOne_eq ▸ LSeries_twist_vonMangoldt_eq χ₁ hs
391391
simp [Subsingleton.eq_one (n : ZMod 1)]
392392

Mathlib/NumberTheory/LSeries/Injectivity.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ lemma LSeries.tendsto_atTop {f : ℕ → ℂ} (ha : abscissaOfAbsConv f < ⊤) :
124124
have hF₀ : F 0 = 0 := rfl
125125
have hF {n : ℕ} (hn : n ≠ 0) : F n = f n := if_neg hn
126126
have ha' : abscissaOfAbsConv F < ⊤ := (abscissaOfAbsConv_congr hF).symm ▸ ha
127-
simp_rw [← LSeries_congr _ hF]
127+
simp_rw [← LSeries_congr hF]
128128
convert LSeries.tendsto_cpow_mul_atTop (n := 0) (fun _ hm ↦ Nat.le_zero.mp hm ▸ hF₀) ha' using 1
129129
simp
130130

@@ -149,7 +149,7 @@ lemma LSeries_eventually_eq_zero_iff' {f : ℕ → ℂ} :
149149
have hF {n : ℕ} (hn : n ≠ 0) : F n = f n := if_neg hn
150150
suffices ∀ n, F n = 0 from fun n hn ↦ (hF hn).symm.trans (this n)
151151
have ha : ¬ abscissaOfAbsConv F = ⊤ := abscissaOfAbsConv_congr hF ▸ h
152-
have h' (x : ℝ) : LSeries F x = LSeries f x := LSeries_congr x hF
152+
have h' (x : ℝ) : LSeries F x = LSeries f x := LSeries_congr hF x
153153
have H' (n : ℕ) : (fun x : ℝ ↦ n ^ (x : ℂ) * LSeries F x) =ᶠ[atTop] fun _ ↦ 0 := by
154154
simp only [h']
155155
rw [eventuallyEq_iff_exists_mem] at H ⊢
@@ -167,7 +167,7 @@ lemma LSeries_eventually_eq_zero_iff' {f : ℕ → ℂ} :
167167
| succ n =>
168168
simpa using LSeries.tendsto_cpow_mul_atTop (fun m hm ↦ ih m <| lt_succ_of_le hm) <|
169169
Ne.lt_top ha
170-
· simp [LSeries_congr x fun {n} ↦ H n, show (fun _ : ℕ ↦ (0 : ℂ)) = 0 from rfl]
170+
· simp [LSeries_congr (fun {n} ↦ H n) x, show (fun _ : ℕ ↦ (0 : ℂ)) = 0 from rfl]
171171

172172
open Nat in
173173
/-- Assuming `f 0 = 0`, the `LSeries` of `f` is zero if and only if either `f = 0` or the
@@ -228,7 +228,7 @@ if `f n = g n` whenever `n ≠ 0`. -/
228228
lemma LSeries_eq_iff_of_abscissaOfAbsConv_lt_top {f g : ℕ → ℂ} (hf : abscissaOfAbsConv f < ⊤)
229229
(hg : abscissaOfAbsConv g < ⊤) :
230230
LSeries f = LSeries g ↔ ∀ n ≠ 0, f n = g n := by
231-
refine ⟨fun H n hn ↦ ?_, fun H ↦ funext (LSeries_congr · fun {n} ↦ H n)⟩
231+
refine ⟨fun H n hn ↦ ?_, fun H ↦ funext (LSeries_congr fun {n} ↦ H n)⟩
232232
refine eq_of_LSeries_eventually_eq hf hg ?_ hn
233233
exact Filter.Eventually.of_forall fun x ↦ congr_fun H x
234234

Mathlib/NumberTheory/LSeries/Nonvanishing.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private lemma F_eq_LSeries (B : BadChar N) {s : ℂ} (hs : 1 < s.re) :
150150
simp only [ne_eq, hs', not_false_eq_true, Function.update_of_ne, B.χ.LFunction_eq_LSeries hs]
151151
congr 1
152152
· simp_rw [← LSeries_zeta_eq_riemannZeta hs, ← natCoe_apply]
153-
· exact LSeries_congr s B.χ.apply_eq_toArithmeticFunction_apply
153+
· exact LSeries_congr B.χ.apply_eq_toArithmeticFunction_apply s
154154
-- summability side goals from `LSeries_convolution'`
155155
· exact LSeriesSummable_zeta_iff.mpr hs
156156
· exact (LSeriesSummable_congr _ fun h ↦ (B.χ.apply_eq_toArithmeticFunction_apply h).symm).mpr <|

Mathlib/NumberTheory/LSeries/PrimesInAP.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ lemma LSeries_residueClass_eq (ha : IsUnit a) {s : ℂ} (hs : 1 < s.re) :
287287
rw [eq_inv_mul_iff_mul_eq₀ <| mod_cast (Nat.totient_pos.mpr q.pos_of_neZero).ne']
288288
simp_rw [← LSeries_smul,
289289
← LSeries_sum <| fun χ _ ↦ (LSeriesSummable_twist_vonMangoldt χ hs).smul _]
290-
refine LSeries_congr s fun {n} _ ↦ ?_
290+
refine LSeries_congr (fun {n} _ ↦ ?_) s
291291
simp only [Pi.smul_apply, residueClass_apply ha, smul_eq_mul, ← mul_assoc,
292292
mul_inv_cancel_of_invertible, one_mul, Finset.sum_apply, Pi.mul_apply]
293293

Mathlib/NumberTheory/LSeries/SumCoeff.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ theorem LSeries_eq_mul_integral (f : ℕ → ℂ) {r : ℝ} (hr : 0 ≤ r) {s :
137137
(by filter_upwards [eventually_ne_atTop 0] with n h using if_neg h)] at hS
138138
have (n : _) : ∑ k ∈ Icc 1 n, (if k = 0 then 0 else f k) = ∑ k ∈ Icc 1 n, f k :=
139139
Finset.sum_congr rfl fun k hk ↦ by rw [if_neg (zero_lt_one.trans_le (mem_Icc.mp hk).1).ne']
140-
rw [← LSeries_congr _ (fun _ ↦ if_neg _), LSeries_eq_mul_integral_aux (if_pos rfl) hr hs hS] <;>
140+
rw [← LSeries_congr fun _ ↦ if_neg _, LSeries_eq_mul_integral_aux (if_pos rfl) hr hs hS] <;>
141141
simp_all
142142

143143
/-- A version of `LSeries_eq_mul_integral` where we use the stronger condition that the partial sums

0 commit comments

Comments
 (0)