Lean formalization of the Riemann Hypothesis (Alpöge, 2026-11-20) being cleaned up by members of the Lean community.
Python
refactor(Lib): drop five seals of `Abelian.Ext` by naming a functor or elaborating a term first
roy774d5f07ed8b4
diff --git a/src/Lib/Cohomology/ProjectiveLine/ConstantLineFormula.lean b/src/Lib/Cohomology/ProjectiveLine/ConstantLineFormula.leanindex 80e6edad176..2f56e6213a6 100644--- a/src/Lib/Cohomology/ProjectiveLine/ConstantLineFormula.lean+++ b/src/Lib/Cohomology/ProjectiveLine/ConstantLineFormula.lean@@ -315,8 +315,7 @@ lemma pointMap_ofSelf_bijective :end/-! ### The projective line formula over a valuation ring -/--- Without the seal, unification unfolds these functors, Ext groups, and their group structure.-seal locConstCoeff projLine CategoryTheory.Abelian.Ext addCommGroupH in+/-- If every non-zero element of A is a unit in every test g(d) (so every g(d) lies over the genericpoint of A) and `New.Variety.etaOneClass` vanishes at the residue field of A at its generic point(`residueTest (TestOver.ofSelf A) ⊥`, with A seen as a test over itself), then y · η = 0 over the@@ -352,7 +351,7 @@ lemma lerayHirsch_lineBasis_single_false_eq_zero_of_etaOneClass_eq_zero {C : Typ(Theory.locallyConstant.toTorsionCoeff.onElements(X := projLineAlong (𝟭 (TestOver A)))).functor)M.onElements.functor :=- TotalH.map (restrictAlong (elementsProj (projLineAlong g))) T+ (TotalH.map (restrictAlong (elementsProj (projLineAlong g))) T :)rw [h_one]change pullbackAlong(oneLocConst (g := elementsProj (g ⋙ ringOf (𝟭 (TestOver A)) ⋙ projLine) ⋙ g))diff --git a/src/Lib/Cohomology/WoodsHole.lean b/src/Lib/Cohomology/WoodsHole.leanindex 6cc3df8c0d6..f9c81cd2eaa 100644--- a/src/Lib/Cohomology/WoodsHole.lean+++ b/src/Lib/Cohomology/WoodsHole.lean@@ -147,8 +147,6 @@ private lemma Polynomial.dual_sum_pow_mul {k : Type} [Field k] {d h : ℕ}simp_rw [hL]simp--- Keeps definitional checks from unfolding the Ext groups.-seal CategoryTheory.Abelian.Ext in/-- Applying `hodgeTateMap d` to the pull-back of a cross product `x × y` along `scaledGraph t f g`expands as a polynomial in `t` of degree `d`, whose `t ^ j` coefficient is the diagonal pull-back ofthe cross product of `λ_{d - j} (g^* y)` and `λ_j (f^* x)` with the Koszul sign and binomial weight@@ -164,8 +162,9 @@ private lemma New.Variety.hodgeTateMap_scaledGraph_baseChange_cross {p : ℕ} {E(cup exteriorAlg.mulPairing x y e :)))) =∑ j ∈ range (d + 1), t ^ j •PairH.map (freeAb.map (lift (𝟙 W) (𝟙 W)) ≫ freeAb.prod W W)- ((d.choose j • (-1 : k) ^ ((q + j) * (d - j)) • HodgeTatePair.cross- (hodgeTateMap (d - j) (HodgeH.map (freeAbMap g) y.baseChange)))+ ((d.choose j • (-1 : k) ^ ((q + j) * (d - j)) •+ HodgeTatePair.cross (M := HodgeTatePair.pairAlg ⋙ freeAb.obj W)+ (hodgeTateMap (d - j) (HodgeH.map (freeAbMap g) y.baseChange)))(hodgeTateMap j (HodgeH.map (freeAbMap f) x.baseChange))) := bylet Δ := PairH.map (freeAb.map (lift (𝟙 W) (𝟙 W)) ≫ freeAb.prod W W)refine (congrArg (hodgeTateMap (N := freeAb W) d)diff --git a/src/Lib/PadicComparison/Duality/GoodPairs.lean b/src/Lib/PadicComparison/Duality/GoodPairs.leanindex 57254ad8130..e5a485fc5b5 100644--- a/src/Lib/PadicComparison/Duality/GoodPairs.lean+++ b/src/Lib/PadicComparison/Duality/GoodPairs.lean@@ -274,8 +274,6 @@ lemma isFiniteLerayHirsch_iff_of_locally_bijective (u : E ⟶ Y)(fun ⟨x, hx⟩ ↦ ⟨relFreeAb.mk (U.preimage u) x, congrArg (relFreeAb.mk U) hx⟩)fun hU ↦ ⟨0, (relFreeAb.mk_eq_zero hU).symm⟩⟩--- Unsealed, `Ext` is unfolded when the two forms of the restricted Tate module are compared.-seal Abelian.Ext in/-- For a flat functor `N`, a class `ξ` in the total Ext from `P` to the Tate module, a map`p : N' ⟶ N ⊗ P` and a map `π : N ⟶ K`: the operation `y ↦ p^*((π^* y) · ξ)` from the total Ext of`K ∘ g` to that of `N' ∘ g`, with coefficients in a theory `Θ` along `g`, natural in `Θ`. -/@@ -285,20 +283,22 @@ def mulClassOp {N N' K P : AbFunctor (TestOver A)} [HasFlatValues N]-- pull back along `π`, multiply by `ξ`, pull back along `p`app t :=(pullbackAlong (t.toTestOver.whiskerLeft p)).comp- ((t.theory.mulClass (TotalH.map (restrictAlong t.toTestOver) ξ)).comp+ ((t.theory.mulClass (S := t.toTestOver ⋙ N)+ (TotalH.map (restrictAlong t.toTestOver) ξ :)).comp(pullbackAlong (t.toTestOver.whiskerLeft π)))naturality := byintro C _ t φ Θ l b xlet ξt : TotalH (t.toTestOver ⋙ P) (tateModule t.toTestOver) :=- TotalH.map (restrictAlong t.toTestOver) ξ+ (TotalH.map (restrictAlong t.toTestOver) ξ :)let ξφ : TotalH ((φ ⋙ t.toTestOver) ⋙ P) (tateModule (φ ⋙ t.toTestOver)) :=- TotalH.map (restrictAlong (φ ⋙ t.toTestOver)) ξ+ (TotalH.map (restrictAlong (φ ⋙ t.toTestOver)) ξ :)let y := pullbackAlong (t.toTestOver.whiskerLeft π) xchange mapThenComp (restrictAlong φ) b- (pullbackAlong (t.toTestOver.whiskerLeft p) (t.theory.mulClass ξt y)) =+ (pullbackAlong (t.toTestOver.whiskerLeft p)+ (t.theory.mulClass (S := t.toTestOver ⋙ N) ξt y)) =pullbackAlong ((φ ⋙ t.toTestOver).whiskerLeft p)- (Θ.mulClass ξφ (pullbackAlong ((φ ⋙ t.toTestOver).whiskerLeft π)- (mapThenComp (restrictAlong φ) b x)))+ (Θ.mulClass (S := (φ ⋙ t.toTestOver) ⋙ N) ξφ+ (pullbackAlong ((φ ⋙ t.toTestOver).whiskerLeft π) (mapThenComp (restrictAlong φ) b x)))refine (mapThenComp_comp map_homClass).trans ?_refine congrArg (pullbackAlong ((φ ⋙ t.toTestOver).whiskerLeft p)) ?_refine (t.theory.mulClass_naturality φ Θ.toTorsionCoeff b ξt y).trans ?_diff --git a/src/Lib/PadicComparison/Duality/LineIntegration.lean b/src/Lib/PadicComparison/Duality/LineIntegration.leanindex 89ee4040b3b..48bf777800a 100644--- a/src/Lib/PadicComparison/Duality/LineIntegration.lean+++ b/src/Lib/PadicComparison/Duality/LineIntegration.lean@@ -45,9 +45,10 @@ Notions from other files:## Implementation notes-Several declarations are preceded by `seal Abelian.Ext Abelian.Ext.instAddCommGroup in`. Sealing-the Ext groups and their group structure makes unification compare Ext groups by their arguments-instead of unfolding them into the derived category, which is slow.+`exists_move_kernel_of_eq_imp_eq` is preceded by+`seal TorsionCoeff.mulClass Abelian.Ext Abelian.Ext.instAddCommGroup in`. Sealing the product+`mulClass`, the Ext groups and their group structure makes unification compare them by their+arguments instead of unfolding them into the derived category, which is slow.## Relation to the literature@@ -398,7 +399,6 @@ lemma map_foldr_etaAt {X : C ⥤ Type 1} {J : Type*}variable (h : M.HasLineFormula) {φ} {M' : TorsionCoeff (φ ⋙ g)} (β : φ ⋙ M.functor ⟶ M'.functor)-seal CategoryTheory.Abelian.Ext CategoryTheory.Abelian.Ext.instAddCommGroup in/-- Restriction along `φ` followed by the product with a class `T` from `M.functor` restricted along`φ` to `M'.functor` commutes with the two maps `x ↦ x · 1` and `x ↦ x · η` to the cohomology overthe points of the line. -/@@ -419,7 +419,7 @@ lemma lineBasis_naturality (T : TotalH ((restrictAlong φ).obj M.functor) M'.funchange comp (map (restrictAlong π') (comp (map (restrictAlong φ) x) T))(M'.lineBasis i).toTotalH =comp (map (restrictAlong ψ) (comp (map (restrictAlong π) x) (M.lineBasis i).toTotalH))- (map (restrictAlong π') T)+ (map (restrictAlong π') T :)rw [map_comp_assoc, map_comp_assoc, map_restrictAlong_restrictAlong,map_restrictAlong_restrictAlong]cases i@@ -427,7 +427,7 @@ lemma lineBasis_naturality (T : TotalH ((restrictAlong φ).obj M.functor) M'.funrw [TorsionCoeff.lineBasis_false, TorsionCoeff.lineBasis_false]refine congrArg (comp (map (restrictAlong (elementsProj (projLineAlong (φ ⋙ g)) ⋙ φ)) x)) ?_exact (M.onElements.etaAt_naturality (precomp φ (projLineAlong g)) M'.onElements- (map (restrictAlong (elementsProj (projLineAlong (φ ⋙ g)))) T)+ (map (restrictAlong (elementsProj (projLineAlong (φ ⋙ g)))) T :)(freeAb.map (tautologicalSection (X := projLineAlong g)))).symm· -- the class `1` is the identity, so the products with it drop outhave h_id : (M.lineBasis true).toTotalH =@@ -804,7 +804,6 @@ lemma isFiniteLerayHirsch_of_retract [HasFlatValues N] (r : ι → NaturalOp 0 (/-! ### Pairs in a power of the projective line -/-seal Abelian.Ext Abelian.Ext.instAddCommGroup in/-- `D.IsFiniteLerayHirsch` passes from `N` to `ℤ[(ℙ¹)^m]/ℤ[U]`, `U = I.topPoints`, given classes`β i` from it to `N`, operations `T i` with `d` parameters in `ℙ¹` from its quotient by `ℓ` to `N`,and `σ` sending parameters to coordinates, such that (`h_sum_eq_foldr`) for every stage `t` with@@ -856,20 +855,20 @@ lemma isFiniteLerayHirsch_of_integrate_params (β : ι → TotalH (relFreeAb I.t(.homClass (𝟙 _)) yhave h_proj :r (pullbackAlong (t.toTestOver.whiskerLeft (abCoker.π _)) x) =- pullbackAlong ((elementsProj X ⋙ t.toTestOver).whiskerLeft (abCoker.π _)) (r x) :=+ pullbackAlong ((elementsProj X ⋙ t.toTestOver).whiskerLeft (abCoker.π _)) (r x :) :=mapThenComp_comp map_homClassrefine (isBijective_relFreeAb_tautologicalSection(I.topPoints.whisker t.toTestOver)).bijective_totalH.injective ?_-- After `r`, the left side is the sum of the operations at `t'` applied to `r x`.have h_sum_r :- r (∑ i, (ρ i).app t ((T i).app t x)) = ∑ i, (ρ i).app t' ((T i).app t' (r x)) := by+ r (∑ i, (ρ i).app t ((T i).app t x)) = ∑ i, (ρ i).app t' ((T i).app t' (r x :)) := byrw [map_sum]exact Finset.sum_congr rfl fun i _ ↦ (h_nat (ρ i) _).trans (congrArg _ (h_nat (T i) x))change comp _ (r _) = comp _ (r _)refine (congrArg (comp _) h_sum_r).trans ?_refine Eq.trans ?_ (congrArg (comp _) h_proj).symm-- This is `h_sum_eq_foldr` at `t'` and the tautological section `a ↦ a.2` of `X`.- exact h_sum_eq_foldr t' ⟨fun a ↦ a.val, fun f ↦ f.map_val⟩ (r x)+ exact h_sum_eq_foldr t' ⟨fun a ↦ a.val, fun f ↦ f.map_val⟩ (r x :)| succ d ih =>-- Apply the induction hypothesis to the integrated operations.refine ih (fun j ↦ σ j.succ) (fun i ↦ (T i).integrate) fun t q' w ↦ ?_@@ -896,7 +895,9 @@ lemma isFiniteLerayHirsch_of_integrate_params (β : ι → TotalH (relFreeAb I.tsimp only [map_comp_assoc, map_restrictAlong_restrictAlong, map_homClass,TorsionCoeff.map_etaAt_onElements, foldr_succ, foldr_eq_finRange_foldr] at h_sum_eq_foldr ⊢-- Restriction to the line passes through the fold factor by factor.- conv_rhs => erw [← map_add, ← map_add, map_foldr_etaAt, map_pullbackAlong]+ conv_rhs =>+ erw [← map_add, ← map_add, map_foldr_etaAt (X := projLineAlong t.toTestOver),+ map_pullbackAlong (Φ := restrictAlong (elementsProj (projLineAlong t.toTestOver)))]-- The integrands agree by `h_sum_eq_foldr` over the points of the line, with the tautological-- point as first parameter.-- (`apply`: compares the statement with the goal once; `exact congrArg _ (…)` does it twice)