Lean formalization of the Riemann Hypothesis (Alpöge, 2026-11-20) being cleaned up by members of the Lean community.
Python
refactor(New/UpperBound): use Mathlib for sums under ring homomorphisms
√2bb86c790d1f4
diff --git a/src/New/UpperBound/ElementaryDivisors/Depth.lean b/src/New/UpperBound/ElementaryDivisors/Depth.leanindex 0edc66ff37d..1074396e94e 100644--- a/src/New/UpperBound/ElementaryDivisors/Depth.lean+++ b/src/New/UpperBound/ElementaryDivisors/Depth.lean@@ -64,13 +64,6 @@ section DeepFormsvariable {N k : ℕ} {W K : Type} [CommRing W] [IsLocalRing W] [Field K] (T : FrobeniusCycle N W K)-private lemma ringHom_map_sum {ι R S : Type*} [NonAssocSemiring R] [NonAssocSemiring S]- (f : R →+* S) (s : Finset ι) (g : ι → R) : f (∑ i ∈ s, g i) = ∑ i ∈ s, f (g i) := by- classical- induction s using Finset.induction_on with- | empty => exact RingHom.map_zero f- | insert a s ha ih => rw [Finset.sum_insert ha, Finset.sum_insert ha, RingHom.map_add, ih]-private lemma ringHom_ne_zero {R S : Type*} [NonAssocSemiring R] [NonAssocSemiring S]{f : R →+* S} (hf : Function.Injective f) {a : R} (ha : a ≠ 0) : f a ≠ 0 :=fun h ↦ ha (hf (h.trans (RingHom.map_zero f).symm))@@ -165,7 +158,7 @@ theorem map_polyOfCoeffs_mem_pow_of_mem_deepForms {n r τ : ℕ} {F : Exponentshave h_expand : ψ (polyOfCoeffs F) = ∑ β : Exponents N k n,ψ (C (G β)) * ∏ v : Fin k × ZMod N, ψ (T.polyAction g⁻¹ (X v)) ^ exponentOf β v := byrw [hF_eq, ← polyAction_polyOfCoeffs, polyOfCoeffs, LinearMap.sum_apply, ← AlgHom.coe_toRingHom,- ringHom_map_sum, ringHom_map_sum]+ map_sum, map_sum]refine Finset.sum_congr rfl fun β _ ↦ ?_rw [LinearMap.comp_apply, LinearMap.proj_apply, monomial_eq,Finsupp.prod_fintype _ _ (fun _ ↦ pow_zero _), AlgHom.coe_toRingHom, map_mul,@@ -233,7 +226,7 @@ theorem exists_eq_of_mem_support_specializeShallow {L : Type} [CommRing L] {n rx (C (F β)) * x (∏ v with T.deepIndicator r v = 0, X v ^ exponentOf β v)have h_expand : T.specializeShallow r x (polyOfCoeffs F) =∑ β : Exponents N k n, C (c β) * ∏ v ∈ deep, X v ^ exponentOf β v := by- rw [polyOfCoeffs, LinearMap.sum_apply, ringHom_map_sum]+ rw [polyOfCoeffs, LinearMap.sum_apply, map_sum]refine Finset.sum_congr rfl fun β _ ↦ ?_rw [LinearMap.comp_apply, LinearMap.proj_apply, monomial_eq,Finsupp.prod_fintype _ _ (fun _ ↦ pow_zero _), RingHom.map_mul, map_prod]@@ -498,7 +491,7 @@ lemma exists_specializeShallow_polyAction_X_eq_sub [NeZero N]if T.isEven v.2 then ∑ b : Fin k, C (T.embedding v.2 (A b v.1)) * X (b, v.2)else -∑ b : Fin k, C (T.embedding v.2 (A v.1 b)) * X (b, v.2) := bycases h_even : T.isEven v.2 <;>- simp only [Bool.false_eq_true, ↓reduceIte, A_apply, ringHom_map_sum, Finset.sum_mul,+ simp only [Bool.false_eq_true, ↓reduceIte, A_apply, map_sum, Finset.sum_mul,← Finset.sum_neg_distrib] <;> rw [Finset.sum_comm]all_goalsrefine Finset.sum_congr rfl fun t _ ↦ ?_@@ -519,7 +512,7 @@ lemma exists_specializeShallow_polyAction_X_eq_sub [NeZero N]split_ifs <;> simp [specializeShallow, h_zero]have h_X : T.specializeShallow r x (X v) = X v := by simp [specializeShallow, hv]have h_C (a : K) : T.specializeShallow r x (C a) = C (x (C a)) := by simp [specializeShallow]- rw [h_image, RingHom.map_sub, h_X, ringHom_map_sum, entryFormValue, dotProduct, ringHom_map_sum]+ rw [h_image, RingHom.map_sub, h_X, map_sum, entryFormValue, dotProduct, map_sum]congr 1refine Finset.sum_congr rfl fun t _ ↦ ?_rw [RingHom.map_mul, h_C, h_coeff, ← RingHom.map_mul C]