Contents
v436-FiniteBernoulliSmoothing.lean
Statement index · Original Lean file
1
import Thesis.PadicBernoulliSums23/-!4# Integral moments for divided Bernoulli numbers56Multiplication by a unit permutes the representatives modulo `q = p^r`.7Taking first differences of powers supplies the factor `n` needed in8`B_n/n`, even when `p ∣ n`.9-/1011open Finset Filter12open scoped BigOperators Topology1314namespace Thesis.FiniteBernoulli1516theorem firstOrderPower (x h : ℤ) (m : ℕ) :17 ∃ e : ℤ, (x + h) ^ (m + 1) =18 x ^ (m + 1) + ((m : ℤ) + 1) * x ^ m * h + h ^ 2 * e := by19 induction m with20 | zero => exact ⟨0, by ring⟩21 | succ m ih =>22 obtain ⟨e, he⟩ := ih23 refine ⟨((m : ℤ) + 1) * x ^ m + (x + h) * e, ?_⟩24 rw [pow_succ (x + h) (m + 1), he]25 push_cast26 simp only [pow_succ]27 ring2829/-- The first-order contribution when the scaled representative crosses a30 multiple of the modulus. -/31def carryMoment (c q m : ℕ) : ℤ :=32 ∑ a ∈ range q, ((c * a / q : ℕ) : ℤ) * ((c * a % q : ℕ) : ℤ) ^ m3334theorem sum_permute {A : Type*} [AddCommMonoid A] (c q : ℕ) (hq : 0 < q)35 (hc : q.Coprime c) (f : ℕ → A) :36 ∑ a ∈ range q, f (c*a % q) = ∑ a ∈ range q, f a := by37 classical38 have hinj : Set.InjOn (fun a => c*a % q) (↑(range q) : Set ℕ) := by39 intro a ha b hb hab40 have h : c*a ≡ c*b [MOD q] := hab41 exact (Nat.ModEq.cancel_left_of_coprime hc h).eq_of_lt_of_lt42 (mem_range.mp ha) (mem_range.mp hb)43 have him : (range q).image (fun a => c*a % q) = range q :=44 Finset.eq_of_subset_of_card_le45 (by intro x hx; obtain ⟨a, _, rfl⟩ := mem_image.mp hx; exact mem_range.mpr (Nat.mod_lt _ hq))46 (by rw [Finset.card_image_of_injOn hinj])47 calc48 _ = ∑ b ∈ (range q).image (fun a => c*a % q), f b := (Finset.sum_image hinj).symm49 _ = _ := by rw [him]5051theorem carry_summand (a c q m : ℕ) : ∃ e : ℤ,52 ((c : ℤ)*a) ^ (m+1) - ((c*a%q : ℕ) : ℤ) ^ (m+1) =53 ((m : ℤ)+1)*q*(((c*a/q : ℕ) : ℤ)*((c*a%q : ℕ) : ℤ)^m) + (q : ℤ)^2 * e := by54 let b : ℤ := (c*a%q : ℕ)55 let d : ℤ := (c*a/q : ℕ)56 have h : b + (q : ℤ)*d = (c : ℤ)*a := by57 dsimp [b, d]58 exact_mod_cast Nat.mod_add_div (c*a) q59 obtain ⟨e, he⟩ := firstOrderPower b ((q : ℤ)*d) m60 refine ⟨d^2*e, ?_⟩61 change ((c : ℤ)*a)^(m+1)-b^(m+1) = ((m : ℤ)+1)*q*(d*b^m) + (q : ℤ)^2*(d^2*e)62 rw [← h, he]63 ring6465theorem finite_smoothing (c q m : ℕ) (hq : 0 < q) (hc : q.Coprime c) :66 ∃ e : ℤ, ((c : ℤ) ^ (m+1) - 1) * (∑ a ∈ range q, (a : ℤ) ^ (m+1)) =67 ((m : ℤ) + 1) * q * carryMoment c q m + (q : ℤ)^2 * e := by68 classical69 choose e he using fun a => carry_summand a c q m70 refine ⟨∑ a ∈ range q, e a, ?_⟩71 have hs := Finset.sum_congr (show range q = range q from rfl) (fun a _ => he a)72 rw [sum_sub_distrib, sum_permute c q hq hc (fun x => (x : ℤ)^(m+1)), sum_add_distrib, ← Finset.mul_sum,73 ← Finset.mul_sum] at hs74 simpa only [mul_pow, ← Finset.mul_sum, sub_mul, one_mul, carryMoment] using hs7576variable {p : ℕ} [Fact p.Prime]7778noncomputable def smoothedValue (c m : ℕ) : ℚ_[p] :=79 ((c : ℚ_[p]) ^ (m+1) - 1) * (bernoulli (m+1) : ℚ_[p]) / ((m : ℚ_[p])+1)8081theorem carryMoment_tendsto (c m : ℕ) (hc : p.Coprime c) :82 Tendsto (fun r : ℕ => (carryMoment c (p^r) m : ℚ_[p])) atTop83 (𝓝 (smoothedValue (p := p) c m)) := by84 have hp : p.Prime := Fact.out85 have hp0 := hp.ne_zero86 have hq (r : ℕ) : 0 < p ^ r := pow_pos hp.pos r87 choose e he using fun r => finite_smoothing c (p^r) m (hq r) (hc.pow_left r)88 have hkernel (r : ℕ) :89 (((c : ℚ_[p]) ^ (m+1)-1) * PadicBernoulli.normPowSum (p := p) r (m+1)) /90 ((m : ℚ_[p])+1) - ((p : ℚ_[p]) ^ r * (e r : ℚ_[p])) / ((m : ℚ_[p])+1) =91 (carryMoment c (p^r) m : ℚ_[p]) := by92 have h := congrArg (Int.cast : ℤ → ℚ_[p]) (he r)93 push_cast at h94 have hpn : (p : ℚ_[p]) ^ r ≠ 0 := pow_ne_zero _ (Nat.cast_ne_zero.mpr hp0)95 have hm : (m : ℚ_[p])+1 ≠ 0 := by exact_mod_cast Nat.succ_ne_zero m96 unfold PadicBernoulli.normPowSum PadicBernoulli.powSum97 field_simp [hpn, hm]98 linear_combination h99 have hsmall : Tendsto (fun r : ℕ => (p : ℚ_[p]) ^ r * (e r : ℚ_[p])) atTop (𝓝 0) := by100 apply tendsto_zero_iff_norm_tendsto_zero.mpr101 have ht : Tendsto (fun r : ℕ => ‖(p : ℚ_[p])^r‖) atTop (𝓝 0) :=102 by simpa using (PadicBernoulli.tendsto_p_pow (p := p)).norm103 apply squeeze_zero (fun r => norm_nonneg _) (fun r => ?_) ht104 rw [norm_mul]105 exact mul_le_of_le_one_right (norm_nonneg ((p : ℚ_[p])^r)) (Padic.norm_int_le_one (p := p) (e r))106 have ht := (((tendsto_const_nhds (x := (c : ℚ_[p])^(m+1)-1)).mul107 (PadicBernoulli.tendsto_normPowSum (p := p) (m+1))).div_const ((m : ℚ_[p])+1)).sub108 (hsmall.div_const ((m : ℚ_[p])+1))109 simpa only [hkernel, zero_div, sub_zero, smoothedValue] using ht110111theorem smoothedValue_integral (c m : ℕ) (hc : p.Coprime c) :112 ‖smoothedValue (p := p) c m‖ ≤ 1 :=113 le_of_tendsto (carryMoment_tendsto c m hc).norm114 (Eventually.of_forall fun _ => Padic.norm_int_le_one _)115116/-- A representative of a generator of the multiplicative residue field makes117 the smoothing factor a unit in every nonzero class modulo p-1. -/118theorem exists_smoothing_unit {n : ℕ} (hn : ¬ (p-1) ∣ n) :119 ∃ c : ℕ, p.Coprime c ∧ (c : ZMod p)^n ≠ 1 := by120 obtain ⟨g, hg⟩ :=121 (isCyclic_iff_exists_orderOf_eq_natCard.mp (inferInstance : IsCyclic (ZMod p)ˣ))122 have ho : orderOf g = p-1 := by123 simpa only [Nat.card_eq_fintype_card, ZMod.card_units, Nat.totient_prime (Fact.out : p.Prime)] using hg124 refine ⟨(g : ZMod p).val, ?_, ?_⟩125 · apply (Fact.out : p.Prime).coprime_iff_not_dvd.mpr126 intro hd127 have hz := (ZMod.natCast_eq_zero_iff (g : ZMod p).val p).mpr hd128 rw [ZMod.natCast_zmod_val] at hz129 exact g.ne_zero hz130 · rw [ZMod.natCast_zmod_val]131 intro h132 have h' : g^n = 1 := Units.ext (by simpa using h)133 exact hn (ho ▸ orderOf_dvd_of_pow_eq_one h')134135theorem norm_smoothing_factor {c n : ℕ} (hn : (c : ZMod p)^n ≠ 1) :136 ‖(c : ℚ_[p])^n-1‖ = 1 := by137 let z : ℤ := (c : ℤ)^n-1138 have hcast : (z : ℚ_[p]) = (c : ℚ_[p])^n-1 := by simp [z]139 rw [← hcast]140 apply le_antisymm (Padic.norm_int_le_one z)141 apply le_of_not_gt142 intro hlt143 have hd := (Padic.norm_intCast_lt_one_iff.mp hlt)144 have hz := (ZMod.intCast_zmod_eq_zero_iff_dvd z p).mpr hd145 apply hn146 exact sub_eq_zero.mp (by simpa [z] using hz)147148theorem divided_bernoulli_integral {n : ℕ} (hn : 0 < n) (hclass : ¬ (p-1) ∣ n) :149 ‖(bernoulli n : ℚ_[p]) / (n : ℚ_[p])‖ ≤ 1 := by150 obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hn.ne'151 obtain ⟨c, hc, hu⟩ := exists_smoothing_unit hclass152 have h := smoothedValue_integral (p := p) c m hc153 simpa only [smoothedValue, mul_div_assoc, norm_mul, norm_smoothing_factor hu, one_mul,154 Nat.cast_succ] using h155156private theorem residue_pow {m n : ℕ} (x : ZMod p) (hm : m ≠ 0) (hn : n ≠ 0)157 (h : m ≡ n [MOD p-1]) : x^m = x^n := by158 by_cases hx : x = 0159 · simp [hx, hm, hn]160 · exact pow_eq_pow_of_modEq h (ZMod.pow_card_sub_one_eq_one hx)161162theorem carryMoment_congruent (c q : ℕ) {m n : ℕ} (hm : m ≠ 0) (hn : n ≠ 0)163 (h : m ≡ n [MOD p-1]) : (p : ℤ) ∣ carryMoment c q m - carryMoment c q n := by164 apply (ZMod.intCast_zmod_eq_zero_iff_dvd _ p).mp165 rw [Int.cast_sub, sub_eq_zero]166 unfold carryMoment167 push_cast168 exact Finset.sum_congr rfl (fun a _ => by rw [residue_pow _ hm hn h])169170private theorem norm_int_difference (a b : ℤ) (h : (p : ℤ) ∣ a-b) :171 ‖(a : ℚ_[p])-(b : ℚ_[p])‖ ≤ (p : ℝ)⁻¹ := by172 have hh := (Padic.norm_int_le_pow_iff_dvd (p := p) (a-b) 1).mpr (by simpa using h)173 simpa using hh174175theorem smoothedValue_congruent (c : ℕ) (hc : p.Coprime c) {m n : ℕ} (hm : m ≠ 0)176 (hn : n ≠ 0) (h : m ≡ n [MOD p-1]) :177 ‖smoothedValue (p := p) c m - smoothedValue c n‖ ≤ (p : ℝ)⁻¹ := by178 apply le_of_tendsto (((carryMoment_tendsto c m hc).sub (carryMoment_tendsto c n hc)).norm)179 exact Eventually.of_forall (fun r => norm_int_difference _ _ (carryMoment_congruent c (p^r) hm hn h))180181/-- The divided Bernoulli congruence, including indices divisible by p. -/182theorem divided_bernoulli_kummer {m n : ℕ} (hm : m ≠ 0) (hn : n ≠ 0)183 (h : m ≡ n [MOD p-1]) (hmclass : ¬ (p-1) ∣ m+1) :184 ‖(bernoulli (m+1) : ℚ_[p]) / (↑(m+1 : ℕ) : ℚ_[p]) -185 (bernoulli (n+1) : ℚ_[p]) / (↑(n+1 : ℕ) : ℚ_[p])‖ ≤ (p : ℝ)⁻¹ := by186 obtain ⟨c, hc, hu⟩ := exists_smoothing_unit hmclass187 have h' : m+1 ≡ n+1 [MOD p-1] := h.add_right 1188 have hpow := residue_pow (c : ZMod p) (Nat.succ_ne_zero m) (Nat.succ_ne_zero n) h'189 have hnclass : ¬ (p-1) ∣ n+1 := by190 intro hd191 apply hmclass192 exact Nat.dvd_of_mod_eq_zero ((show (m+1) % (p-1) = (n+1) % (p-1) from h').trans193 (Nat.mod_eq_zero_of_dvd hd))194 set A : ℚ_[p] := (bernoulli (m+1) : ℚ_[p]) / (↑(m+1 : ℕ) : ℚ_[p])195 set B : ℚ_[p] := (bernoulli (n+1) : ℚ_[p]) / (↑(n+1 : ℕ) : ℚ_[p])196 set U : ℚ_[p] := (c : ℚ_[p])^(m+1)-1197 set V : ℚ_[p] := (c : ℚ_[p])^(n+1)-1198 have huNorm : ‖U‖ = 1 := norm_smoothing_factor hu199 have hb : ‖B‖ ≤ 1 := divided_bernoulli_integral (Nat.succ_pos n) hnclass200 have huv : ‖V-U‖ ≤ (p : ℝ)⁻¹ := by201 have hdiv : (p : ℤ) ∣ (c:ℤ)^(n+1)-(c:ℤ)^(m+1) := by202 apply (ZMod.intCast_zmod_eq_zero_iff_dvd _ p).mp203 simpa using (sub_eq_zero.mpr hpow.symm)204 have hnorm := norm_int_difference (p := p) ((c:ℤ)^(n+1)) ((c:ℤ)^(m+1)) hdiv205 simpa [V, U] using hnorm206 have hAB : ‖U*A - V*B‖ ≤ (p:ℝ)⁻¹ := by207 simpa [A, B, U, V, smoothedValue, mul_div_assoc] using (smoothedValue_congruent c hc hm hn h)208 calc209 ‖A-B‖ = ‖U*(A-B)‖ := by rw [norm_mul, huNorm, one_mul]210 _ = ‖(U*A-V*B)+(V-U)*B‖ := by congr 1; ring211 _ ≤ _ := (IsUltrametricDist.norm_add_le_max _ _).trans (max_le hAB (by212 rw [norm_mul]213 exact (mul_le_of_le_one_right (norm_nonneg _) hb).trans huv))214215/-- Transfer of the divided value to the completed algebraic closure. -/216theorem complex_divided_integral {n : ℕ} (hn : 0 < n) (hclass : ¬ (p-1) ∣ n) :217 ‖-(bernoulli n : ℂ_[p]) / (n : ℂ_[p])‖ ≤ 1 := by218 let φ : ℚ_[p] →+* ℂ_[p] := algebraMap _ _219 have hnorm (x : ℚ_[p]) : ‖φ x‖ = ‖x‖ := PadicComplex.norm_extends' p x220 rw [neg_div, norm_neg]221 calc222 _ = ‖φ ((bernoulli n : ℚ_[p]) / (n : ℚ_[p]))‖ := by simp223 _ = _ := hnorm _224 _ ≤ 1 := divided_bernoulli_integral hn hclass225226theorem complex_kummer {m n : ℕ} (hm : 0 < m) (hn : 0 < n)227 (hmn : Int.ModEq ((p-1 : ℕ) : ℤ) m n)228 (hmres : ¬Int.ModEq ((p-1 : ℕ) : ℤ) m (-1)) :229 ‖-(bernoulli (m+1) : ℂ_[p]) / ((m : ℂ_[p])+1)‖ ≤ 1 ∧230 ‖-(bernoulli (n+1) : ℂ_[p]) / ((n : ℂ_[p])+1)‖ ≤ 1 ∧231 ‖(-(bernoulli (m+1) : ℂ_[p]) / ((m : ℂ_[p])+1) -232 -(bernoulli (n+1) : ℂ_[p]) / ((n : ℂ_[p])+1)) / (p : ℂ_[p])‖ ≤ 1 := by233 have h : m ≡ n [MOD p-1] := Int.natCast_modEq_iff.mp hmn234 have hclass {t : ℕ} (ht : ¬Int.ModEq ((p-1 : ℕ) : ℤ) t (-1)) : ¬ (p-1) ∣ t+1 := by235 intro hd236 apply ht237 rw [Int.modEq_iff_dvd]238 have hz : ((p-1 : ℕ) : ℤ) ∣ (t : ℤ)+1 := by exact_mod_cast hd239 convert dvd_neg.mpr hz using 1240 ring241 have hmclass := hclass hmres242 have hnclass := hclass (fun hn' => hmres (hmn.trans hn'))243 refine ⟨by simpa using complex_divided_integral (Nat.succ_pos m) hmclass,244 by simpa using complex_divided_integral (Nat.succ_pos n) hnclass, ?_⟩245 let φ : ℚ_[p] →+* ℂ_[p] := algebraMap _ _246 let A : ℚ_[p] := (bernoulli (m+1) : ℚ_[p]) / (↑(m+1 : ℕ) : ℚ_[p])247 let B : ℚ_[p] := (bernoulli (n+1) : ℚ_[p]) / (↑(n+1 : ℕ) : ℚ_[p])248 have hbound : ‖A-B‖ ≤ (p : ℝ)⁻¹ := divided_bernoulli_kummer hm.ne' hn.ne' h hmclass249 have hnorm (x : ℚ_[p]) : ‖φ x‖ = ‖x‖ := PadicComplex.norm_extends' p x250 have hpos : 0 < (p : ℝ)⁻¹ := inv_pos.mpr (by exact_mod_cast (Fact.out : p.Prime).pos)251 calc252 _ = ‖φ ((B-A) / (p : ℚ_[p]))‖ := by simp [A, B]; ring_nf253 _ = _ := hnorm _254 _ ≤ 1 := by rw [norm_div, Padic.norm_p, div_le_one₀ hpos, norm_sub_rev]; exact hbound255256end Thesis.FiniteBernoulli257258#print axioms Thesis.FiniteBernoulli.divided_bernoulli_integral259#print axioms Thesis.FiniteBernoulli.divided_bernoulli_kummer260#print axioms Thesis.FiniteBernoulli.complex_kummer