Contents
GeneralizedBernoulli.lean
Statement index · Original Lean file
1
import Thesis.Prelude23/-!4# Generalized Bernoulli numbers (equation 2.9)56We use the equivalent Bernoulli-polynomial formula7`Bₙ,χ = N^(n-1) ∑ a ∈ [1,N], χ(a) Bₙ(a/N)`.8The literal endpoints matter at `N = n = 1`: equation (2.9) gives9`B_(1,1) = bernoulli' 1 = 1/2`, whereas Mathlib's `bernoulli 1 = -1/2`.10For every `n ≠ 1`, the two ordinary conventions agree.11-/1213namespace Thesis1415open scoped BigOperators16open Polynomial1718variable {A : Type*} [Field A] [Algebra ℚ A]1920/-- Generalized Bernoulli numbers attached to a Dirichlet character. -/21noncomputable def generalizedBernoulli {N : ℕ}22 (χ : DirichletCharacter A N) (n : ℕ) : A :=23 (N : A) ^ ((n : ℤ) - 1) *24 ∑ a ∈ Finset.Icc 1 N, χ a *25 ((Polynomial.bernoulli n).map (algebraMap ℚ A)).eval ((a : A) / (N : A))2627lemma generalizedBernoulli_eq_zmod {N : ℕ} [NeZero N] (hN : 2 ≤ N)28 (χ : DirichletCharacter A N) (n : ℕ) :29 generalizedBernoulli χ n =30 (N : A) ^ ((n : ℤ) - 1) *31 ∑ a : ZMod N, χ a *32 ((Polynomial.bernoulli n).map (algebraMap ℚ A)).eval ((a.val : A) / N) := by33 rw [generalizedBernoulli]34 congr 135 apply Finset.sum_bij (s := Finset.Icc 1 N) (t := Finset.univ)36 (f := fun a => χ (a : ZMod N) *37 ((Polynomial.bernoulli n).map (algebraMap ℚ A)).eval ((a : A) / N))38 (g := fun a => χ a *39 ((Polynomial.bernoulli n).map (algebraMap ℚ A)).eval ((a.val : A) / N))40 (fun a _ => (a : ZMod N))41 · intro a ha42 exact Finset.mem_univ _43 · intro a ha b hb hab44 apply Nat.ModEq.eq_of_abs_lt ((ZMod.natCast_eq_natCast_iff a b N).mp hab)45 simp only [Finset.mem_Icc] at ha hb46 rw [abs_lt]47 constructor <;> omega48 · intro b hb49 by_cases hb0 : b = 050 · refine ⟨N, ?_, ?_⟩51 · exact Finset.mem_Icc.mpr ⟨by omega, le_rfl⟩52 · simp [hb0]53 · refine ⟨b.val, ?_, ?_⟩54 · exact Finset.mem_Icc.mpr ⟨Nat.pos_of_ne_zero ((ZMod.val_eq_zero b).not.mpr hb0),55 (ZMod.val_lt b).le⟩56 · simp57 · intro a ha58 by_cases haN : a = N59 · subst a60 simp [DirichletCharacter.map_zero' χ (by omega : N ≠ 1)]61 · have hlt : a < N := by62 have ha' := Finset.mem_Icc.mp ha63 omega64 simp [ZMod.val_natCast_of_lt hlt]6566/-- Theorem D's right-hand side, used as a concrete realization of `L(1-n,χ)`. -/67noncomputable def dirichletValue {N : ℕ}68 (χ : DirichletCharacter A N) (n : ℕ) : A :=69 -generalizedBernoulli χ n / n7071omit [Algebra ℚ A] in72lemma dirichletCharacter_one_cast {N M : ℕ} (hN : N = M) :73 (1 : DirichletCharacter A M) = hN ▸ (1 : DirichletCharacter A N) := by74 subst M75 rfl7677lemma dirichletValue_congr {N M : ℕ} (hN : N = M) {χ : DirichletCharacter A N}78 {ψ : DirichletCharacter A M} {n : ℕ} (hχ : χ = hN ▸ ψ) :79 dirichletValue χ n = dirichletValue ψ n := by80 subst M81 subst χ82 rfl8384/-- The value attached to the unique primitive character inducing `χ`. -/85noncomputable def primitiveDirichletValue {N : ℕ}86 (χ : DirichletCharacter A N) (n : ℕ) : A :=87 dirichletValue χ.primitiveCharacter n8889omit [Algebra ℚ A] in90lemma sum_Icc_character_eq_zero_of_ne_one {N : ℕ} [NeZero N]91 (χ : DirichletCharacter A N) (hχ : χ ≠ 1) :92 ∑ a ∈ Finset.Icc 1 N, χ a = 0 := by93 have hN : 1 < N := by94 have hne : N ≠ 1 := by95 intro h96 subst N97 exact hχ (Subsingleton.elim _ _)98 have hpos : 0 < N := Nat.pos_of_ne_zero (NeZero.ne N)99 omega100 rw [← MulChar.sum_eq_zero_of_ne_one hχ]101 refine Finset.sum_bij (s := Finset.Icc 1 N) (t := Finset.univ)102 (f := fun a => χ (a : ZMod N)) (g := fun a => χ a) (fun a _ => (a : ZMod N)) ?_ ?_ ?_ ?_103 · intro a ha104 exact Finset.mem_univ _105 · intro a ha b hb hab106 apply Nat.ModEq.eq_of_abs_lt ((ZMod.natCast_eq_natCast_iff a b N).mp hab)107 simp only [Finset.mem_Icc] at ha hb108 rw [abs_lt]109 constructor <;> omega110 · intro b hb111 by_cases hb0 : b = 0112 · refine ⟨N, ?_, ?_⟩113 · exact Finset.mem_Icc.mpr ⟨by omega, le_rfl⟩114 · simp [hb0]115 · refine ⟨b.val, ?_, ?_⟩116 · exact Finset.mem_Icc.mpr ⟨Nat.pos_of_ne_zero ((ZMod.val_eq_zero b).not.mpr hb0),117 (ZMod.val_lt b).le⟩118 · simp119 · intro a ha120 rfl121122lemma generalizedBernoulli_one {N : ℕ} [NeZero N] (χ : DirichletCharacter A N) :123 generalizedBernoulli χ 1 =124 ∑ a ∈ Finset.Icc 1 N, χ a * ((a : A) / N - (2 : A)⁻¹) := by125 simp [generalizedBernoulli, Polynomial.bernoulli_one]126127lemma generalizedBernoulli_one_of_ne_one {N : ℕ} [NeZero N]128 (χ : DirichletCharacter A N) (hχ : χ ≠ 1) :129 generalizedBernoulli χ 1 = (N : A)⁻¹ * ∑ a ∈ Finset.Icc 1 N, χ a * a := by130 rw [generalizedBernoulli_one]131 have hsum : ∑ a ∈ Finset.Icc 1 N, χ a = 0 := sum_Icc_character_eq_zero_of_ne_one χ hχ132 calc133 (∑ a ∈ Finset.Icc 1 N, χ a * ((a : A) / N - (2 : A)⁻¹)) =134 ∑ a ∈ Finset.Icc 1 N, ((N : A)⁻¹ * (χ a * a) - (2 : A)⁻¹ * χ a) := by135 apply Finset.sum_congr rfl136 intro a ha137 ring138 _ = (∑ a ∈ Finset.Icc 1 N, (N : A)⁻¹ * (χ a * a)) -139 ∑ a ∈ Finset.Icc 1 N, (2 : A)⁻¹ * χ a := by140 simp only [Finset.sum_sub_distrib]141 _ = (N : A)⁻¹ * (∑ a ∈ Finset.Icc 1 N, χ a * a) -142 (2 : A)⁻¹ * ∑ a ∈ Finset.Icc 1 N, χ a := by143 rw [Finset.mul_sum, Finset.mul_sum]144 _ = (N : A)⁻¹ * ∑ a ∈ Finset.Icc 1 N, χ a * a := by145 rw [hsum, mul_zero, sub_zero]146147/-- Equation (2.9) specializes to the positive Bernoulli convention at level one. -/148lemma generalizedBernoulli_modOne (χ : DirichletCharacter A 1) (n : ℕ) :149 generalizedBernoulli χ n = (bernoulli' n : ℚ) := by150 have hχ : χ = 1 := Subsingleton.elim _ _151 simp [generalizedBernoulli, hχ]152 rw [MulChar.one_apply (isUnit_of_subsingleton _), one_mul]153 simp [Polynomial.aeval_def, Polynomial.eval₂_at_one]154155/-- At every index other than one, equation (2.9) uses Mathlib's ordinary `bernoulli`. -/156lemma generalizedBernoulli_modOne_of_ne_one (χ : DirichletCharacter A 1) {n : ℕ}157 (hn : n ≠ 1) : generalizedBernoulli χ n = (bernoulli n : ℚ) := by158 rw [generalizedBernoulli_modOne, bernoulli_eq_bernoulli'_of_ne_one hn]159160end Thesis