Lean formalization of the Riemann Hypothesis (Alpöge, 2026-11-20) being cleaned up by members of the Lean community.
Python
refactor(Lib/Shimura/GoodReduction): split the proof of bddAbove_of_mem_sizes
Sheapedb8f7bfd9ba1
diff --git a/src/Lib/Shimura/GoodReduction/TorsionSizes.lean b/src/Lib/Shimura/GoodReduction/TorsionSizes.leanindex f22deb8830a..85379a6eeb8 100644--- a/src/Lib/Shimura/GoodReduction/TorsionSizes.lean+++ b/src/Lib/Shimura/GoodReduction/TorsionSizes.lean@@ -133,6 +133,25 @@ lemma sizeAt_pow : (n • B).sizeAt v (f ^ n) = B.sizeAt v f ^ n := byextsimp [sizeAt]+/-- The size of `a • g (2 ·) ^ n` in degree `(4 * n) • B` at `y` is the `n`-th power of the size+of `g` in degree `B` at `2 • y`, times `v a`. -/+lemma sizeAt_smul_pow_comp_two (a : ℂ) (y : torsionPoints L) :+ ((4 * n) • B).sizeAt v (a • (g ∘ ((2 : ℂ) • ·)) ^ n) y = B.sizeAt v g (2 • y) ^ n * v a := by+ simp only [sizeAt, thetaShift_apply, Pi.pow_apply, Function.comp_apply, Pi.smul_apply,+ smul_eq_mul, add_zero, zero_add, map_zero, neg_zero, AddSubgroupClass.coe_nsmul,+ ofNat_smul_eq_nsmul, mul_pow, ← map_pow, ← exp_nsmul, smul_apply, map_nsmul, nsmul_eq_mul,+ Nat.cast_mul, Nat.cast_ofNat]+ rw [← map_mul]+ congr 1+ ring_nf++/-- The ultrametric inequality for sizes: if each `F i` has size at most `M` at `x`, then so does+the sum `∑ i ∈ s, F i`. -/+lemma sizeAt_sum_le {ι : Type*} {s : Finset ι} {F : ι → V → ℂ} {M : ℝ≥0}+ (h_le : ∀ i ∈ s, B.sizeAt v (F i) x ≤ M) : B.sizeAt v (∑ i ∈ s, F i) x ≤ M := by+ rw [sizeAt, map_sum, Finset.sum_apply]+ exact v.map_sum_le h_le+lemma valuation_eq_one_of_pow_eq_one {ζ : ℂ} (hn : n ≠ 0) (hζ : ζ ^ n = 1) : v ζ = 1 := bysimpa [hn] using congrArg v hζ@@ -309,14 +328,47 @@ lemma LatticeForm.HasShiftBound.of_doubling {ι : Sort*} (B : ι → LatticeFormcalc φ y ^ 2 ≤ D * ⨆ x, φ x * φ (x + w i) := hD i φ hφ y_ ≤ C * ⨆ x, φ x * φ (x + w i) := by gcongr+/-- Let `(B, χ)` be an Appell–Humbert datum with positive Riemann form on a full-rank lattice `L`,+and let `g` be a theta function of type `(B, χ)`, with `χ ^ n = 1` on `L` for `n ≠ 0`. Then+`g (2 ·) ^ n` is a theta function of the same type `((4 * n) • B, χ ^ (4 * n))` as `g ^ (4 * n)`,+so by irreducibility `g ^ (4 * n)` is a combination of the translates of `g (2 ·) ^ n` by the dual+lattice of `(4 * n) • B`. -/+lemma _root_.New.IsAppellHumbert.pow_four_mul_mem_span_thetaShift (hB : IsAppellHumbert B χ)+ (h_pos : IsPosRiemann B) (hn : n ≠ 0) (hχn : ∀ l ∈ L, χ l ^ n = 1)+ (hg : g ∈ B.thetaSpace χ) :+ g ^ (4 * n) ∈ span ℂ ((fun a ↦ ((4 * n) • B).thetaShift a ((g ∘ ((2 : ℂ) • ·)) ^ n)) ''+ ((4 * n) • B).dualLattice) := by+ have hB' : IsAppellHumbert ((4 * n) • B) (χ ^ (4 * n)) := hB.nsmul _+ have h_pos' : IsPosRiemann ((4 * n) • B) := h_pos.nsmul (by lia)+ obtain rfl | hg0 := eq_or_ne g 0+ · simp [hn]+ have hg₂ : (g ∘ ((2 : ℂ) • ·)) ^ n ∈ ((4 * n) • B).thetaSpace (χ ^ (4 * n)) := by+ obtain ⟨h_diff, h_per⟩ := hg+ refine ⟨by fun_prop, fun l hl z ↦ ?_⟩+ -- both multipliers `χ (2 l) ^ n` and `χ l ^ (4 * n)` are `1`; the exponents agree+ have h1 : χ (2 • l) ^ n = 1 := hχn _ (nsmul_mem hl 2)+ have h2 : χ l ^ (4 * n) = 1 := by rw [mul_comm 4 n, pow_mul, hχn l hl, one_pow]+ have h_per2 := h_per (2 • l) (nsmul_mem hl 2) ((2 : ℂ) • z)+ simp only [Pi.pow_apply, Function.comp_apply, smul_add, ofNat_smul_eq_nsmul] at h_per2 ⊢+ rw [h_per2, mul_pow, mul_pow, h1, one_mul, h2, one_mul, ← exp_nsmul]+ simp only [smul_apply, map_nsmul, nsmul_eq_mul]+ congr 2+ push_cast+ ring+ have hg₂0 : (g ∘ ((2 : ℂ) • ·)) ^ n ≠ 0 :=+ pow_ne_zero n ((MulAction.surjective₀ (two_ne_zero' ℂ)).injective_comp_right.ne hg0)+ -- irreducibility: the translates of one nonzero theta function by the dual lattice span all+ -- theta functions of its type, in particular `g ^ (4 * n)`+ exact hB'.thetaSpace_le_of_thetaShift_mem hg₂ hg₂0 _ (image_subset_iff.mp subset_span) (pow hg _)+/-- Let `L` be a full lattice in a finite-dimensional complex space `V`, and let `v` be anℝ≥0-valued valuation on ℂ. A size φ of degree `B` is the function `sizeAt` of `f` on the torsionpoints of `V/L`, where `f` is a theta function of type (`B`, χ) for some χ with `IsAmpleType B χ`.Every such φ is bounded above. -/lemma bddAbove_of_mem_sizes (hφ : φ ∈ B.sizes v) : BddAbove (range φ) := by- -- Let `φ` be the size of `g`, with multiplier of order dividing `n`. Then `g ^ (4 * n)` and- -- `g₂ = g (2 ·) ^ n` have the same type, so the first is a combination of translates of `g₂`,- -- with coefficients `c i`. Write `|c i|` for `v (c i)`.+ -- Let `φ` be the size of `g`, with multiplier of order dividing `n`. Then `g ^ (4 * n)` is a+ -- combination of translates of `g (2 ·) ^ n`, with coefficients `c i`. Write `|c i|` for+ -- `v (c i)`.-- The maximum `M` of `φ` on a group `H`, finite modulo `L`, holding the translations and a given-- point then has `M ^ (4 * n) ≤ M ^ n * max |c i|`, so `M ≤ max 1 (max |c i|)`.obtain @⟨χ, g, h_ample, hg⟩ := hφ@@ -324,30 +376,9 @@ lemma bddAbove_of_mem_sizes (hφ : φ ∈ B.sizes v) : BddAbove (range φ) := byhave hB : IsAppellHumbert ((4 * n) • B) (χ ^ (4 * n)) := h_ample.isAppellHumbert.nsmul _have h_pos : IsPosRiemann ((4 * n) • B) := h_ample.isPosRiemann.nsmul (by lia)obtain ⟨N, hN, hNL⟩ := hB.exists_nsmul_mem_of_mem_dualLattice- let g₂ : V → ℂ := (g ∘ fun z ↦ (2 : ℂ) • z) ^ n- have h_span : g ^ (4 * n) ∈- span ℂ ((fun a ↦ ((4 * n) • B).thetaShift a g₂) '' ((4 * n) • B).dualLattice) := by- obtain rfl | hg0 := eq_or_ne g 0- · simp [hn]- have hg₂ : g₂ ∈ ((4 * n) • B).thetaSpace (χ ^ (4 * n)) := by- obtain ⟨h_diff, h_per⟩ := hg- refine ⟨by fun_prop, fun l hl z ↦ ?_⟩- -- both multipliers `χ (2 l) ^ n` and `χ l ^ (4 * n)` are `1`; the exponents agree- have h1 : χ (2 • l) ^ n = 1 := hχn _ (nsmul_mem hl 2)- have h2 : χ l ^ (4 * n) = 1 := by rw [mul_comm 4 n, pow_mul, hχn l hl, one_pow]- have h_per2 := h_per (2 • l) (nsmul_mem hl 2) ((2 : ℂ) • z)- simp only [g₂, Pi.pow_apply, Function.comp_apply, smul_add, ofNat_smul_eq_nsmul] at h_per2 ⊢- rw [h_per2, mul_pow, mul_pow, h1, one_mul, h2, one_mul, ← exp_nsmul]- simp only [smul_apply, map_nsmul, nsmul_eq_mul]- congr 2- push_cast- ring- have hg₂0 : g₂ ≠ 0 :=- pow_ne_zero n ((MulAction.surjective₀ (two_ne_zero' ℂ)).injective_comp_right.ne hg0)- -- irreducibility: the translates of one nonzero theta function by the dual lattice span all- -- theta functions of its type, in particular `g ^ (4 * n)`- exact hB.thetaSpace_le_of_thetaShift_mem hg₂ hg₂0 _ (image_subset_iff.mp subset_span) (pow hg _)- obtain ⟨t, ht, c, hc⟩ := (mem_span_image_iff_exists_fun ℂ).mp h_span+ obtain ⟨t, ht, c, hc⟩ :=+ (mem_span_image_iff_exists_fun ℂ).mp+ (h_ample.isAppellHumbert.pow_four_mul_mem_span_thetaShift h_ample.isPosRiemann hn hχn hg)refine ⟨1 ⊔ iSup (v ∘ c), forall_mem_range.mpr fun ⟨x, m, hm, hx⟩ ↦ ?_⟩-- `H`: the points killed by `N * m` modulo `L`; `φ` is periodic, so takes finitely many valueslet H : Submodule ℤ (torsionPoints L) := L.comap ((N * m) • (torsionPoints L).subtype)@@ -356,31 +387,21 @@ lemma bddAbove_of_mem_sizes (hφ : φ ∈ B.sizes v) : BddAbove (range φ) := byset M : ℝ≥0 := ⨆ z : H, B.sizeAt v g zhave h_le (z : torsionPoints L) (hz : z ∈ H) : B.sizeAt v g z ≤ M :=le_ciSup h_fin.bddAbove ⟨z, hz⟩- -- the normalising factor of degree `4 n B` at `y` is the `n`-th power of that of `B` at `2 y`- have h_double (a : ℂ) (y : torsionPoints L) :- ((4 * n) • B).sizeAt v (a • g₂) y = B.sizeAt v g (2 • y) ^ n * v a := by- simp only [g₂, sizeAt, thetaShift_apply, Pi.pow_apply, Function.comp_apply, Pi.smul_apply,- smul_eq_mul, add_zero, zero_add, map_zero, neg_zero, AddSubgroupClass.coe_nsmul,- ofNat_smul_eq_nsmul, mul_pow, ← map_pow, ← exp_nsmul, smul_apply, map_nsmul, nsmul_eq_mul,- Nat.cast_mul, Nat.cast_ofNat]- rw [← map_mul]- congr 1- ring_nf+ -- the translations `a i` lie in the dual lattice, so they are torsion points, and they lie in `H`+ let a (i : t) : torsionPoints L := ⟨i, N, hN, hNL _ (ht i.property)⟩+ have ha (i : t) : a i ∈ H := by+ change (N * m) • (i : V) ∈ L+ rw [mul_nsmul]+ exact nsmul_mem (hNL _ (ht i.property)) m-- ultrametric inequality: it suffices to bound each term of the combinationhave h_size_pow_le (z : H) : ((4 * n) • B).sizeAt v (g ^ (4 * n)) z ≤ M ^ n * iSup (v ∘ c) := by- rw [← hc, sizeAt, map_sum, Finset.sum_apply]- refine v.map_sum_le fun i _ ↦ ?_- let a : torsionPoints L := ⟨i, N, hN, hNL _ (ht i.property)⟩- have ha : a ∈ H := by- change (N * m) • (i : V) ∈ L- rw [mul_nsmul]- exact nsmul_mem (hNL _ (ht i.property)) m+ rw [← hc]+ refine sizeAt_sum_le fun i _ ↦ ?_rw [← map_smul]- calc _ = ((4 * n) • B).sizeAt v (c i • g₂) (z + a) := hB.sizeAt_thetaShift a z- _ = B.sizeAt v g (2 • (z + a)) ^ n * v (c i) := h_double (c i) (z + a)- _ ≤ M ^ n * iSup (v ∘ c) := by- gcongr- exacts [h_le _ (nsmul_mem (add_mem z.property ha) 2), Finite.le_ciSup (v ∘ c) i]+ refine (hB.sizeAt_thetaShift (a i) z).trans_le ?_+ rw [sizeAt_smul_pow_comp_two]+ gcongr+ exacts [h_le _ (nsmul_mem (add_mem z.property (ha i)) 2), Finite.le_ciSup (v ∘ c) i]have h_pow : M ^ (4 * n) ≤ M ^ n * iSup (v ∘ c) := byrw [iSup_pow]exact ciSup_le' fun z ↦ (sizeAt_pow.ge (z : torsionPoints L)).trans (h_size_pow_le z)