From c26c93c48f731f943964b5e5408afa6431fab801 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Sun, 8 Nov 2026 23:18:45 +0000 Subject: [PATCH] Optimize LeanModularForms proofs and elaboration Reuse calculus and Hecke-algebra lemmas, share FTC transport, and narrow proof searches and private imports while preserving all original declarations. --- .../ForMathlib/QExpansion.lean | 2 +- .../ForMathlib/SlashActions.lean | 6 +- .../GeneralizedResidueTheory/Basic.lean | 3 +- .../GeneralizedResidueTheory/Bridges.lean | 4 +- .../CauchyPrimitive.lean | 8 +- .../GeneralizedResidueTheory/Cycle.lean | 7 +- .../GeneralizedResidueTheorem.lean | 4 +- .../HomologicalCauchy.lean | 1 - .../HomologicalCauchy/Basic.lean | 5 +- .../HomologicalCauchy/DixonProof.lean | 30 ++--- .../HomologicalCauchy/Meromorphic.lean | 7 +- .../Homotopy/CircleParam.lean | 11 +- .../Homotopy/Integrality.lean | 10 +- .../Homotopy/Invariance.lean | 16 +-- .../Homotopy/MathlibBridge.lean | 2 +- .../Homotopy/ParametricDiff.lean | 2 +- .../GeneralizedResidueTheory/LogDerivFTC.lean | 8 ++ .../OnCurvePV/Basic.lean | 1 - .../PVInfrastructure/AnnulusBounds.lean | 15 ++- .../PVInfrastructure/GammaAnalysis.lean | 12 +- .../PVInfrastructure/RemainderAnalysis.lean | 12 +- .../PVInfrastructure/SingularAnnulus.lean | 11 +- .../PVInfrastructure/StepBounds.lean | 12 +- .../PVInfrastructure/UniformStepBound.lean | 3 +- .../PiecewiseCurveAPI.lean | 2 +- .../GeneralizedResidueTheory/Residue.lean | 12 +- .../Residue/Flatness.lean | 18 +-- .../Residue/FlatnessTransfer.lean | 1 - .../FlatnessTransfer/BoundaryVanishing.lean | 20 ++-- .../FlatnessTransfer/CPVExistence.lean | 3 +- .../CutoffInfrastructure.lean | 8 +- .../FlatnessTransfer/HigherOrderAssembly.lean | 20 ++-- .../FlatnessTransfer/PerTermVanishing.lean | 5 +- .../PerTermVanishing/CPVHelpers.lean | 5 +- .../Residue/GeneralizedTheorem.lean | 1 - .../Residue/GeneralizedTheoremBase.lean | 5 +- .../Residue/MathlibBridge.lean | 1 - .../Residue/MeromorphicLaurent.lean | 1 - .../Residue/MeromorphicPrincipalPart.lean | 13 ++- .../Residue/MultipointPV.lean | 7 +- .../MultipointPV/DominatedConvergence.lean | 14 ++- .../Residue/SectorCurve.lean | 30 ++--- .../Residue/SectorCurveLemma.lean | 38 +++--- .../WindingNumber.lean | 1 - .../WindingNumber/CrossingAnalysis.lean | 9 +- .../WindingNumber/Decomposition.lean | 1 - .../WindingNumber/Defs.lean | 2 +- .../WindingNumber/Proposition22.lean | 13 +-- .../AbstractHeckeRing/Associativity.lean | 27 +++-- .../HeckeRIngs/AbstractHeckeRing/Basic.lean | 10 +- .../AbstractHeckeRing/Commutativity.lean | 6 +- .../HeckeRIngs/AbstractHeckeRing/Degree.lean | 17 +-- .../HeckeRIngs/AbstractHeckeRing/Module.lean | 6 +- .../AbstractHeckeRing/Multiplication.lean | 3 +- .../HeckeRIngs/AbstractHeckeRing/Ring.lean | 4 +- .../HeckeRIngs/GL2/CongruenceIndex.lean | 17 ++- .../HeckeRIngs/GL2/Degree.lean | 7 +- .../HeckeRIngs/GL2/HeckeAction.lean | 6 +- .../HeckeRIngs/GL2/HeckeModularForm.lean | 5 +- .../HeckeRIngs/GL2/MultiplicationTable.lean | 57 ++++----- .../HeckeRIngs/GLn/Basic.lean | 22 ++-- .../HeckeRIngs/GLn/CoprimeMul.lean | 44 +++---- .../HeckeRIngs/GLn/CosetDecomposition.lean | 36 +++--- .../HeckeRIngs/GLn/Degree.lean | 21 ++-- .../HeckeRIngs/GLn/DiagonalCosets.lean | 110 +++++++++--------- .../HeckeRIngs/GLn/PolynomialRing.lean | 2 +- .../HeckeRIngs/GLn/SLnTransvection.lean | 29 +++-- .../GLn/TransposeAntiInvolution.lean | 2 +- .../LeanModularForms/Modularforms/BigO.lean | 4 +- .../Modularforms/Cauchylems.lean | 25 ++-- .../Modularforms/ClogArgLems.lean | 4 +- .../LeanModularForms/Modularforms/Csqrt.lean | 4 +- .../LeanModularForms/Modularforms/Delta.lean | 50 ++++---- .../Modularforms/Derivative.lean | 52 ++++++--- .../Modularforms/DimensionFormulas.lean | 21 ++-- .../LeanModularForms/Modularforms/E2.lean | 7 +- .../Modularforms/Eisenstein.lean | 56 +++++---- .../Modularforms/EisensteinAsymptotics.lean | 20 ++-- .../Modularforms/Eisensteinqexpansions.lean | 24 ++-- .../LeanModularForms/Modularforms/Eta.lean | 6 +- .../Modularforms/EtaCleanup.lean | 37 +++--- .../Modularforms/ExpLems.lean | 2 +- .../Modularforms/Generators/Defs.lean | 5 +- .../Modularforms/Generators/Injectivity.lean | 5 +- .../Modularforms/Generators/Surjectivity.lean | 2 +- .../Modularforms/IccIcoLems.lean | 7 +- .../Modularforms/IsCuspForm.lean | 3 +- .../Modularforms/Iteratedderivs.lean | 70 ++--------- .../Modularforms/JacobiTheta.lean | 102 +++++++++------- .../Modularforms/MultipliableLems.lean | 10 +- .../Modularforms/QExpansion.lean | 9 +- .../Modularforms/QExpansionLems.lean | 13 ++- .../Modularforms/ResToImagAxis.lean | 47 +++++--- .../Modularforms/SerreDerivativeSlash.lean | 3 +- .../Modularforms/SlashActionAuxil.lean | 18 ++- .../Modularforms/SummableLems.lean | 103 ++++++++-------- .../Modularforms/ThetaDerivIdentities.lean | 41 ++++--- .../Modularforms/TsumderivWithin.lean | 13 ++- .../Modularforms/Uniformcts.lean | 1 - .../SpherePacking/CuspDecay.lean | 37 ++++-- .../SpherePacking/ViazovskaMagicFunction.lean | 60 ++++++---- .../ValenceFormula/Boundary/Basic.lean | 6 +- .../ValenceFormula/Boundary/Bounds.lean | 32 ++--- .../ValenceFormula/Boundary/Smooth.lean | 52 +++++---- .../Boundary/Winding/LeftEdge.lean | 70 ++++++----- .../Boundary/Winding/RightEdge.lean | 97 +++++++-------- .../Boundary/Winding/UnitArc.lean | 39 +++---- .../Boundary/Winding/UnitArcHelpers.lean | 60 +++++----- .../ValenceFormula/CoreIdentity.lean | 13 ++- .../ValenceFormula/Definitions.lean | 6 +- .../ValenceFormula/InteriorWinding.lean | 34 +++--- .../ValenceFormula/ModularInvariance.lean | 22 ++-- .../ValenceFormula/OnCurvePV/Basic.lean | 2 - .../OnCurvePV/EndpointCorner.lean | 71 +++++------ .../ValenceFormula/OnCurvePV/Main.lean | 67 ++++++----- .../ValenceFormula/OrbitPairing.lean | 25 ++-- .../ValenceFormula/OrbitSum.lean | 13 ++- .../ValenceFormula/PVChain.lean | 2 - .../PVChain/ArcContribution.lean | 17 ++- .../ValenceFormula/PVChain/Assembly.lean | 34 +++--- .../PVChain/Assembly/ResidueSide.lean | 2 - .../ValenceFormula/PVChain/Helpers.lean | 59 +++++++--- .../PVChain/OnCurveCapture.lean | 16 +-- .../PVChain/ResidueSideInfra.lean | 35 +++--- .../PVChain/Seg5CuspIntegral.lean | 12 +- .../RectHomotopy/AngleAnalysis.lean | 27 +++-- .../BoundaryHomotopyDerivBounds.lean | 5 +- .../RectHomotopy/BoundaryHomotopyDiff.lean | 1 - .../RectHomotopy/BoundaryHomotopySmooth.lean | 10 +- .../ValenceFormula/RectHomotopy/Geometry.lean | 8 +- .../RectHomotopy/HomotopyDef.lean | 7 +- .../RectHomotopy/MainTheorem.lean | 1 - .../RectHomotopy/MainTheoremBound.lean | 8 +- .../RectHomotopy/MainTheoremDerivCont.lean | 12 +- .../RectHomotopy/PolygonProps.lean | 9 +- .../RectHomotopy/PolygonSlope.lean | 6 +- .../RectHomotopy/RadialHomotopy.lean | 46 +++++--- .../RectHomotopy/WindingBase.lean | 21 ++-- .../RectHomotopy/WindingProof.lean | 1 - .../ValenceFormula/TextbookExistence.lean | 2 +- .../ValenceFormula/TextbookForm.lean | 41 ++++--- .../ValenceFormula/TrigLemmas.lean | 1 - .../ValenceFormula/WindingWeights.lean | 1 - .../ValenceFormula/WindingWeights/Common.lean | 9 +- .../ValenceFormula/WindingWeights/I.lean | 33 +++--- .../ValenceFormula/WindingWeights/Rho.lean | 11 +- .../WindingWeights/RhoPlusOne.lean | 36 +++--- 147 files changed, 1519 insertions(+), 1277 deletions(-) diff --git a/LeanPool/LeanModularForms/ForMathlib/QExpansion.lean b/LeanPool/LeanModularForms/ForMathlib/QExpansion.lean index 63012a270c..8d66f51869 100644 --- a/LeanPool/LeanModularForms/ForMathlib/QExpansion.lean +++ b/LeanPool/LeanModularForms/ForMathlib/QExpansion.lean @@ -47,7 +47,7 @@ theorem periodic_comp_ofComplex' (hΓ : Γ.width ∣ h) : Periodic (f ∘ ofComp simp only [comp_apply, ofComplex_apply_of_im_pos this, ofComplex_apply_of_im_pos hw, ← vAdd_width_periodic f k (Nat.cast_dvd_cast hΓ) ⟨w, hw⟩] congr 1 - simp [UpperHalfPlane.ext_iff, add_comm] + simp only [Int.cast_natCast, UpperHalfPlane.ext_iff, coe_vadd, ofReal_natCast, add_comm] · have : im (w + h) ≤ 0 := by simpa only [add_im, natCast_im, add_zero, not_lt] using hw simp only [comp_apply, ofComplex_apply_of_im_nonpos this, ofComplex_apply_of_im_nonpos (not_lt.mp hw)] diff --git a/LeanPool/LeanModularForms/ForMathlib/SlashActions.lean b/LeanPool/LeanModularForms/ForMathlib/SlashActions.lean index 5214268ba7..41a4b59ced 100644 --- a/LeanPool/LeanModularForms/ForMathlib/SlashActions.lean +++ b/LeanPool/LeanModularForms/ForMathlib/SlashActions.lean @@ -49,4 +49,8 @@ theorem ModularForm.slash_neg' {k : ℤ} (g : SL(2, ℤ)) (f : ℍ → ℂ) (hk rw [SL_slash, ← slash_neg _ _ hk] congr ext - simp + simp only [Matrix.SpecialLinearGroup.coe_int_neg, Units.val_neg, + Matrix.SpecialLinearGroup.coe_GL_coe_matrix, Matrix.SpecialLinearGroup.coe_neg, + Matrix.SpecialLinearGroup.map_apply_coe, RingHom.mapMatrix_apply, Int.coe_castRingHom, + Matrix.neg_apply, Matrix.map_apply, neg_neg, Matrix.SpecialLinearGroup.mapGL_coe_matrix, + algebraMap_int_eq] diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Basic.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Basic.lean index b31896607f..ebf78aeaa2 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Basic.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Basic.lean @@ -152,7 +152,8 @@ private theorem exists_min_above_in_finite_union have hS_above_finite : S_above.Finite := hS_finite.subset (fun s hs => hs.1) have hne : hS_above_finite.toFinset.Nonempty := by - rw [Set.Finite.toFinset_nonempty]; exact ⟨b, by simp [S_above, S, ht_lt_b]⟩ + rw [Set.Finite.toFinset_nonempty]; exact ⟨b, by simp only [singleton_union, mem_insert_iff, + SetLike.mem_coe, mem_ofPred_eq, true_or, ht_lt_b, and_self, S_above, S]⟩ set s_min := hS_above_finite.toFinset.min' hne have hs_min_in : s_min ∈ S_above := (Set.Finite.mem_toFinset hS_above_finite).mp (Finset.min'_mem _ hne) diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Bridges.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Bridges.lean index fc5439a4fa..321000f6e5 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Bridges.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Bridges.lean @@ -38,11 +38,11 @@ private theorem rescale_mem_Icc (γ : PiecewiseC1Curve) (t : I) : private theorem rescale_zero (γ : PiecewiseC1Curve) : (γ.rescale ⟨0, left_mem_Icc.mpr zero_le_one⟩ : ℝ) = γ.a := by - simp [rescale, iccHomeoI_symm_apply_coe] + simp only [rescale, Icc.mk_zero, iccHomeoI_symm_apply_coe, Icc.coe_zero, mul_zero, zero_add] private theorem rescale_one (γ : PiecewiseC1Curve) : (γ.rescale ⟨1, right_mem_Icc.mpr zero_le_one⟩ : ℝ) = γ.b := by - simp [rescale, iccHomeoI_symm_apply_coe] + simp only [rescale, Icc.mk_one, iccHomeoI_symm_apply_coe, Icc.coe_one, mul_one, sub_add_cancel] /-- Convert a `PiecewiseC1Curve` to a mathlib `Path` by rescaling `[a,b]` to `[0,1]`. The path goes from `γ(a)` to `γ(b)`. -/ diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/CauchyPrimitive.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/CauchyPrimitive.lean index 09fc2efc0f..b480163704 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/CauchyPrimitive.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/CauchyPrimitive.lean @@ -83,7 +83,7 @@ private lemma integral_t_mul_deriv_eq {f : ℂ → ℂ} {S : Set ℂ} have h3 : HasDerivAt (fun _ : ℝ => c) 0 t := hasDerivAt_const t c convert h3.add h2 using 1 - ring + ac_rfl have hv_deriv : ∀ x ∈ Set.Ioo (min 0 1) (max 0 1), HasDerivAt v (v' x) x := by intro t ht @@ -96,7 +96,7 @@ private lemma integral_t_mul_deriv_eq {f : ℂ → ℂ} {S : Set ℂ} convert h_chain using 1 · rfl · simp only [γ] - ring + ac_rfl have hu'_int : IntervalIntegrable u' MeasureTheory.volume 0 1 := ContinuousOn.intervalIntegrable continuousOn_const have hv'_int : IntervalIntegrable v' MeasureTheory.volume 0 1 := by @@ -235,7 +235,7 @@ private lemma segmentIntegrand_lipschitzOnWith {f : ℂ → ℂ} h_bound _ = M * ‖t • (x - y)‖ := by rw [h_diff] _ = M * (|t| * ‖x - y‖) := by rw [norm_smul]; simp only [Real.norm_eq_abs] - _ = |t| * M * ‖x - y‖ := by ring + _ = |t| * M * ‖x - y‖ := by ac_rfl _ = |t| * M * dist x y := by rw [dist_eq_norm] _ ≤ Real.toNNReal (|t| * M) * dist x y := by simp_all only [mem_Icc, Metric.mem_ball, real_smul, add_sub_add_left_eq_sub, @@ -382,7 +382,7 @@ private lemma hasDerivAt_segmentIntegral {f : ℂ → ℂ} ∫ (t : ℝ) in (0 : ℝ)..1, ↑t * deriv f (c + t • (z - c)) * (z - c) from (intervalIntegral.integral_mul_const (𝕜 := ℂ) _ _).symm] convert h_ibp using 2 - ext t; ring + ext t; ac_rfl suffices hH : HasDerivAt H (H' z) z by have h_prod := hH.mul h1 refine h_prod.congr_deriv ?_ diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Cycle.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Cycle.lean index aed80350b4..ea0037e448 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Cycle.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Cycle.lean @@ -14,7 +14,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.Homotopy.Integrality import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Contour Cycles @@ -142,7 +141,7 @@ private theorem sum_swap_winding_residue (Γ : ContourCycle) (S0 : Finset ℂ) 2 * ↑Real.pi * I * (↑(Γ γ) * generalizedWindingNumber' γ.toFun γ.a γ.b s * residueAt f s) - from by ring), ← Finset.mul_sum, ← Finset.sum_mul] + from by ac_rfl), ← Finset.mul_sum, ← Finset.sum_mul] /-- **Generalized Residue Theorem for simple poles on a cycle.** @@ -260,11 +259,11 @@ theorem windingNumberCycle_isInt (Γ : ContourCycle) ∃ n : ℤ, windingNumberCycle Γ z = ↑n := by simp only [windingNumberCycle, Finsupp.sum] apply Finset.sum_induction _ (fun x : ℂ => ∃ n : ℤ, x = ↑n) - · rintro _ _ ⟨a, rfl⟩ ⟨b, rfl⟩; exact ⟨a + b, by push_cast; ring⟩ + · rintro _ _ ⟨a, rfl⟩ ⟨b, rfl⟩; exact ⟨a + b, by push_cast; ac_rfl⟩ · exact ⟨0, Int.cast_zero.symm⟩ · intro γ hγ obtain ⟨m, hm⟩ := windingNumber_isInt_of_immersion_closed_avoiding γ z (h_closed γ hγ) (h_avoids γ hγ) - exact ⟨Γ γ * m, by rw [hm]; push_cast; ring⟩ + exact ⟨Γ γ * m, by rw [hm]; push_cast; ac_rfl⟩ end diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/GeneralizedResidueTheorem.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/GeneralizedResidueTheorem.lean index e4815c8e46..2e3848f746 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/GeneralizedResidueTheorem.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/GeneralizedResidueTheorem.lean @@ -18,7 +18,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.Residue.FlatnessTransf import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Generalized Residue Theorem -- Public API @@ -245,7 +244,8 @@ theorem generalizedResidueTheorem_simplePoles (U : Set ℂ) (hU : IsOpen U) intro s hs rw [h_res_sing_eq s hs] have h_eq : (fun z => residueSimplePole f s / (z - s)) = - (fun z => residueSimplePole f s * (fun z => (z - s)⁻¹) z) := by ext z; simp [div_eq_mul_inv] + (fun z => residueSimplePole f s * (fun z => (z - s)⁻¹) z) := by ext z; simp only [ + div_eq_mul_inv] rw [h_eq] apply CauchyPrincipalValueExists'.const_mul apply cauchyPrincipalValueExists_of_singular_inv γ s diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy.lean index 9a1f4fc5f7..222665145c 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy.lean @@ -11,7 +11,6 @@ public import LeanPool.LeanModularForms.GeneralizedResidueTheory.HomologicalCauc import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Null-Homologous Curves and the Cauchy Integral Theorem diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/Basic.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/Basic.lean index a3c0479680..b9415d1a0c 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/Basic.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/Basic.lean @@ -12,7 +12,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.Residue import Mathlib.Analysis.Calculus.FDeriv.Mul import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus /-! @@ -87,7 +86,7 @@ private lemma partition_filter_card_lt_left (P : Finset ℝ) {a' b' c : ℝ} exact ⟨ht.1, ht.2.1, lt_trans ht.2.2 hcb⟩ · intro hsub have hcmem := hsub (Finset.mem_filter.mpr ⟨hc_part, hac, hcb⟩) - simp_all + simp_all only [Finset.mem_filter, lt_self_iff_false, and_false] private lemma partition_filter_card_lt_right (P : Finset ℝ) {a' b' c : ℝ} (hc_part : c ∈ P) (hac : a' < c) (hcb : c < b') : @@ -100,7 +99,7 @@ private lemma partition_filter_card_lt_right (P : Finset ℝ) {a' b' c : ℝ} exact ⟨ht.1, lt_trans hac ht.2.1, ht.2.2⟩ · intro hsub have hcmem := hsub (Finset.mem_filter.mpr ⟨hc_part, hac, hcb⟩) - simp_all + simp_all only [Finset.mem_filter, lt_self_iff_false, and_true, and_false] private lemma ftc_inductive_step {F : ℂ → ℂ} {f : ℂ → ℂ} (γ : PiecewiseC1Curve) (m : ℕ) (a' b' c : ℝ) diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/DixonProof.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/DixonProof.lean index afffa827d6..4b23c41781 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/DixonProof.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/DixonProof.lean @@ -16,7 +16,6 @@ import Mathlib.Analysis.Normed.Module.Connected import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init import Mathlib.LinearAlgebra.Complex.FiniteDimensional -import Mathlib.MeasureTheory.Covering.Besicovitch import Mathlib.Topology.MetricSpace.HausdorffDimension /-! @@ -146,7 +145,7 @@ theorem dixonH1_eq (hU : IsOpen U) (hf : DifferentiableOn ℂ f U) (fun t => f w / (γ.toFun t - w) * deriv γ.toFun t) volume γ.a γ.b := by rw [show (fun t => f w / (γ.toFun t - w) * deriv γ.toFun t) = (fun t => f w * ((γ.toFun t - w)⁻¹ * deriv γ.toFun t)) from by - ext t; rw [div_eq_mul_inv]; ring] + ext t; rw [div_eq_mul_inv]; ac_rfl] exact h_base_int.const_mul _ rw [intervalIntegral.integral_sub (dixonH1_cauchyIntegrand_integrable hU hf γ hγ_in_U w hoff) h_fw_int] @@ -218,12 +217,12 @@ private lemma dixonH2_deriv_bound (f : ℂ → ℂ) (γ : PiecewiseC1Immersion) apply mul_le_mul · apply mul_le_mul · exact hM_f t ht - · exact pow_le_pow_left₀ (by positivity) + · exact pow_le_pow_left₀ (by exact inv_nonneg_of_nonneg (norm_nonneg (γ.toFun t - x))) (inv_anti₀ hε_pos (hdist_lb x hx_ball t ht)) 2 - · positivity + · exact Even.pow_nonneg (even_two_mul 1) ‖γ.toFun t - x‖⁻¹ · exact hM_f_nn · exact hM_d t ht - · positivity + · exact norm_nonneg (deriv γ.toFun t) · simp_all only [mem_Icc, and_imp, Metric.mem_ball, uIoc_of_le, mem_Ioc, and_true, inv_pow, inv_pos, pow_succ_pos, mul_nonneg_iff_of_pos_right] @@ -280,8 +279,8 @@ private lemma dixonH2_hasDerivAt (f : ℂ → ℂ) (γ : PiecewiseC1Immersion) exact mul_le_mul (mul_le_mul (hM_f t ht) (pow_le_pow_left₀ (by positivity) (inv_anti₀ hε_pos (_hdist_lb_w t ht)) 2) - (by positivity) _hM_f_nn) - (hM_d t ht) (by positivity) (mul_nonneg _hM_f_nn (by positivity)) + (by exact Even.pow_nonneg (even_two_mul 1) ‖γ.toFun t - w‖⁻¹) _hM_f_nn) + (hM_d t ht) (by exact norm_nonneg (deriv γ.toFun t)) (mul_nonneg _hM_f_nn (by positivity)) have hF'_meas : AEStronglyMeasurable (dixonH2_F' f γ w) (volume.restrict (Set.uIoc γ.a γ.b)) := hF'_int.def'.aestronglyMeasurable have h_bound : ∀ᵐ t ∂volume, t ∈ Set.uIoc γ.a γ.b → @@ -516,7 +515,7 @@ private theorem dixonH1_F'_aestronglyMeasurable {M_d C_b δ₀ : ℝ} have hC : Filter.Tendsto (fun n : ℕ => (1 : ℂ) / ((n : ℂ) + 1)) Filter.atTop (𝓝 0) := by have := Complex.continuous_ofReal.continuousAt.tendsto.comp hR simp only [Function.comp_def] at this - exact this.congr (fun n => by push_cast; ring) + exact this.congr (fun n => by push_cast; ac_rfl) exact hC · exact Filter.Eventually.of_forall (fun n => by apply div_ne_zero one_ne_zero @@ -527,7 +526,8 @@ private theorem dixonH1_F'_aestronglyMeasurable {M_d C_b δ₀ : ℝ} ((1 : ℂ) / (↑n + 1))⁻¹ • (dslope f (γ.toFun t) (w₀ + 1 / (↑n + 1)) - dslope f (γ.toFun t) w₀) * deriv γ.toFun t := by - simp_all + simp_all only [mem_Icc, and_imp, mem_image, Metric.mem_ball, forall_exists_index, mem_Ioc, + and_true, hasDerivAt_deriv_iff, one_div, inv_inv, smul_eq_mul, implies_true] simp_rw [hGn_eq] exact (hderiv.tendsto_slope_zero.comp h_tendsto_zero).mul_const _ @@ -590,7 +590,7 @@ theorem dixonH1_differentiableOn (hU : IsOpen U) (hf : DifferentiableOn ℂ f U) apply Filter.eventually_of_mem (Metric.ball_mem_nhds w₀ hε_pos) intro x hx exact (dixonH1_dslope_intervalIntegrable hU hf γ hγ_in_U x C M_d hC_pos - (fun c hc => hBd c hc x (Metric.ball_subset_ball (by linarith) hx)) + (fun c hc => hBd c hc x (Metric.ball_subset_ball (by linarith only [hε_pos, h2ε_le_δ₀]) hx)) hM_d).def'.aestronglyMeasurable have hF'_meas := dixonH1_F'_aestronglyMeasurable hU hf γ hγ_in_U w₀ hw₀ hdslope_diff hM_d hδ₀_pos hBd hC_pos @@ -717,7 +717,7 @@ theorem dixonFunction_differentiable (hU : IsOpen U) (hf : DifferentiableOn ℂ obtain ⟨n2, hn2⟩ := hwn_int w'' hw'' have hm : generalizedWindingNumber' γ.toFun γ.a γ.b w''' - generalizedWindingNumber' γ.toFun γ.a γ.b w'' = (n1 - n2 : ℤ) := by - push_cast [hn1, hn2]; ring + push_cast [hn1, hn2]; ac_rfl have h_norm_m : ‖((n1 - n2 : ℤ) : ℂ)‖ < 1 / 2 := hm ▸ h_lt rw [Complex.norm_intCast] at h_norm_m have h_zero : n1 - n2 = 0 := by @@ -793,9 +793,9 @@ private lemma windingNumber_norm_lt_one (γ : PiecewiseC1Immersion) {R M_d : ℝ (hw : M_d * (γ.b - γ.a) / (2 * Real.pi) < ‖w‖ - R) : ‖generalizedWindingNumber' γ.toFun γ.a γ.b w‖ < 1 := by have hab : γ.a ≤ γ.b := le_of_lt γ.hab - have hba_nn : 0 ≤ γ.b - γ.a := by linarith + have hba_nn : 0 ≤ γ.b - γ.a := by exact sub_nonneg.mpr hab have h2pi_pos : 0 < 2 * Real.pi := Real.two_pi_pos - have hpos : 0 < ‖w‖ - R := by linarith + have hpos : 0 < ‖w‖ - R := by exact sub_pos.mpr hR_lt rw [generalizedWindingNumber_eq_classical_away γ.toPiecewiseC1Curve w hoff, norm_mul, norm_inv, norm_mul, norm_mul, Complex.norm_two, Complex.norm_real, Real.norm_of_nonneg Real.pi_pos.le, Complex.norm_I, mul_one] @@ -956,9 +956,9 @@ lemma piecewiseC1_image_interior_empty (γ : PiecewiseC1Immersion) : hLip.mono Set.inter_subset_right⟩ · apply lt_of_le_of_lt (dimH_mono (Set.subset_univ _)) simp only [Real.dimH_univ] - simp_all + simp_all only [finrank_real_complex, Nat.cast_ofNat, Nat.one_lt_ofNat] · rw [(γ.partition.finite_toSet.image γ.toFun).dimH_zero] - simp_all + simp_all only [finrank_real_complex, Nat.cast_ofNat, Nat.ofNat_pos] theorem contourIntegral_eq_zero_of_nullHomologous (hU : IsOpen U) (hf : DifferentiableOn ℂ f U) (γ : PiecewiseC1Immersion) (h_null : IsNullHomologous γ U) : diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/Meromorphic.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/Meromorphic.lean index 4fbf93d303..c30bfb4778 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/Meromorphic.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/HomologicalCauchy/Meromorphic.lean @@ -19,7 +19,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.WindingNumber.Proposit import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Meromorphic Contour Integral Vanishing (Null-Homologous) @@ -426,7 +425,7 @@ theorem conditionsAB_imply_higherOrderCancel_nh (U : Set ℂ) (hU : IsOpen U) exact intervalIntegrable_cpvIntegrandOn_of_continuousOn_diff U S0 _ hfres_cont γ h_null.image_subset ε hε rw [← intervalIntegral.integral_sub h_int_f h_int_fres] - simp_all + simp_all only [ne_eq, mem_Icc, and_imp] exact higherOrderCancel_assembly_nh U hU S0 f hf γ h_null hMero hCondA hCondB hγ_meas h_no_endpt h_unique_cross hS0_in_U @@ -489,6 +488,6 @@ lemma pv_res_tendsto_of_immersion_nullHomologous (U : Set ℂ) (S : Set ℂ) generalizedWindingNumber' γ.toFun γ.a γ.b s * residueAt f s := by have hL_eq : L = cauchyPrincipalValueOn S0 f_res γ.toFun γ.a γ.b := hL.limUnder_eq.symm - simp_all - simp_all + simp_all only [gt_iff_lt, ne_eq, mem_Icc, and_imp] + simp_all only [gt_iff_lt, ne_eq, mem_Icc, and_imp] diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/CircleParam.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/CircleParam.lean index a4c2fa9cbe..c8bc794d48 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/CircleParam.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/CircleParam.lean @@ -54,7 +54,8 @@ lemma circleParam_closed (z₀ : ℂ) (r : ℝ) (a b : ℝ) (hab : a < b) : simp only [circleParam] have hne : (b : ℂ) - a ≠ 0 := by simp only [sub_ne_zero, Complex.ofReal_inj, ne_eq]; exact ne_of_gt hab - simp_all + simp_all only [ne_eq, sub_self, zero_div, mul_zero, exp_zero, mul_one, not_false_eq_true, + div_self, exp_two_pi_mul_I] lemma circleParam_dist (z₀ : ℂ) (r : ℝ) (hr : 0 ≤ r) (a b : ℝ) (_hab : a < b) (t : ℝ) : @@ -339,10 +340,10 @@ theorem winding_of_S1_curve_eq_degree (z₀ : ℂ) (a b : ℝ) (_hab : a < b) have h2 := h1.const_mul I have h3 : HasDerivAt (fun u => exp (I * (θ u : ℂ))) (exp (I * (θ t : ℂ)) * (I * (Complex.ofReal (deriv θ t)))) t := - ((hasDerivAt_exp _).scomp t h2).congr_deriv (by rw [smul_eq_mul]; ring) + ((hasDerivAt_exp _).scomp t h2).congr_deriv (by rw [smul_eq_mul]; ac_rfl) have h4 := (hasDerivAt_const t z₀).add h3 simp only [zero_add] at h4 - exact h4.congr_deriv (by ring) + exact h4.congr_deriv (by ac_rfl) have h_integrand : ∀ t, (γ t - z₀)⁻¹ * deriv γ t = I * (Complex.ofReal (deriv θ t)) := by @@ -368,8 +369,8 @@ theorem winding_of_S1_curve_eq_degree (z₀ : ℂ) (a b : ℝ) (_hab : a < b) (fun x _ => hasDerivAt_ofReal_comp θ x (hθ_diff x)) h_ofReal_int rw [h_ftc, show (θ b : ℂ) - (θ a : ℂ) = ((θ b - θ a : ℝ) : ℂ) from - by push_cast; ring, - hθ_change]; push_cast; ring + by push_cast; ac_rfl, + hθ_change]; push_cast; ac_rfl have h_S1 : ∀ t, ‖γ t - z₀‖ = 1 := by intro t; simp only [γ, add_sub_cancel_left, mul_comm I]; exact norm_exp_ofReal_mul_I _ have hint_const : ∀ ε > 0, ε < 1 → diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/Integrality.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/Integrality.lean index 240c59bd66..bc646a05f4 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/Integrality.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/Integrality.lean @@ -211,8 +211,10 @@ private lemma exists_partition_free_subinterval exact ⟨by linarith [le_max_right a (t - ε / 2), hs.1], by linarith [min_le_right b (t + ε / 2), hs.2]⟩ · intro x hx - simp_all - · simp_all + simp_all only [mem_Ioo, sub_lt_self_iff, lt_add_iff_pos_right, and_self, not_false_eq_true, + gt_iff_lt, and_imp, max_lt_iff, lt_min_iff] + · simp_all only [mem_Ioo, sub_lt_self_iff, lt_add_iff_pos_right, and_self, not_false_eq_true, + gt_iff_lt, and_imp, max_lt_iff, div_pos_iff_of_pos_left, Nat.ofNat_pos, lt_min_iff] private lemma logDeriv_integrand_bound {γ : ℝ → ℂ} {a b : ℝ} {z₀ : ℂ} {M δ : ℝ} @@ -516,7 +518,7 @@ theorem winding_integrand_bounded_of_uniform_avoidance ≤ ‖(H (t, s) - z₀)⁻¹‖ * ‖deriv (fun t' => H (t', s)) t‖ := norm_mul_le _ _ _ ≤ δ⁻¹ * M := mul_le_mul h_inv_bound (hM_bound t ht s hs) (norm_nonneg _) (le_of_lt (inv_pos.mpr hδ_pos)) - _ = M / δ := by ring + _ = M / δ := by ac_rfl private lemma gFunc_constant_smooth {γ : ℝ → ℂ} {a b : ℝ} {z₀ : ℂ} @@ -630,7 +632,7 @@ private theorem integral_closed_curve_eq_two_pi_int (hγ_avoid b (right_mem_Icc.mpr (le_of_lt hab)))) rw [Complex.exp_eq_one_iff] at hexp obtain ⟨n, hn⟩ := hexp - exact ⟨n, by rw [hn]; ring⟩ + exact ⟨n, by rw [hn]; ac_rfl⟩ /-- The winding number of a smooth closed curve avoiding z₀ is an integer. -/ diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/Invariance.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/Invariance.lean index 1f8864a82c..109362cac8 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/Invariance.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/Invariance.lean @@ -88,7 +88,7 @@ private lemma homotopy_integrand_continuousOn_t have hε'_le : ε' ≤ ε / 2 := min_le_left _ _ have h_avoid_P : ∀ t' ∈ Ioo (t - ε') (t + ε'), t' ∉ P := fun t' ht' => hε_avoid t' ⟨by linarith [ht'.1], by linarith [ht'.2]⟩ - have ht_in : t ∈ Ioo (t - ε') (t + ε') := ⟨by linarith, by linarith⟩ + have ht_in : t ∈ Ioo (t - ε') (t + ε') := ⟨by linarith only [hε'_pos], by linarith only [hε'_pos]⟩ have h_sub_ab : Ioo (t - ε') (t + ε') ⊆ Ioo a b := by intro x hx have h1 := (min_le_right (ε / 2) _).trans (min_le_left (t - a) (b - t)) @@ -99,7 +99,7 @@ private lemma homotopy_integrand_continuousOn_t exact ContinuousWithinAt.mul ((hH_cont.comp (continuous_id.prodMk continuous_const)).continuousAt.sub continuousAt_const |>.inv₀ (sub_ne_zero.mpr (hH_avoid t ht_Icc s hs)) |>.continuousWithinAt) - (((hH_deriv_cont _ _ (by linarith : t - ε' < t + ε') h_avoid_P h_sub_ab).comp + (((hH_deriv_cont _ _ (by linarith only [hε'_pos] : t - ε' < t + ε') h_avoid_P h_sub_ab).comp (continuous_id.prodMk continuous_const).continuousOn (fun t' ht' => ⟨ht', hs⟩) t ht_in).continuousAt (Ioo_mem_nhds ht_in.1 ht_in.2) |>.continuousWithinAt) @@ -125,7 +125,7 @@ private lemma homotopy_integrand_continuousWithinAt_s have hε'_le : ε' ≤ ε / 2 := min_le_left _ _ have h_avoid_P : ∀ t' ∈ Ioo (t - ε') (t + ε'), t' ∉ P := fun t' ht' => hε_avoid t' ⟨by linarith [ht'.1], by linarith [ht'.2]⟩ - have ht_in : t ∈ Ioo (t - ε') (t + ε') := ⟨by linarith, by linarith⟩ + have ht_in : t ∈ Ioo (t - ε') (t + ε') := ⟨by linarith only [hε'_pos], by linarith only [hε'_pos]⟩ have h_sub_ab : Ioo (t - ε') (t + ε') ⊆ Ioo a b := by intro x hx have h1 := (min_le_right (ε / 2) _).trans (min_le_left (t - a) (b - t)) @@ -136,7 +136,7 @@ private lemma homotopy_integrand_continuousWithinAt_s continuousAt_const |>.inv₀ (sub_ne_zero.mpr (hH_avoid t ht_Icc s₀ hs₀)) |>.continuousWithinAt) - (((hH_deriv_cont _ _ (by linarith : t - ε' < t + ε') h_avoid_P h_sub_ab).comp + (((hH_deriv_cont _ _ (by linarith only [hε'_pos] : t - ε' < t + ε') h_avoid_P h_sub_ab).comp (continuous_const.prodMk continuous_id).continuousOn (fun s hs => ⟨ht_in, hs⟩)) s₀ hs₀) @@ -253,7 +253,7 @@ private theorem continuous_integer_valued_constant rw [hm] at hdist ⊢ have h1 : dist (m : ℂ) (n : ℂ) < 1 := hdist rw [Complex.dist_eq, show (m : ℂ) - (n : ℂ) = - ((m - n : ℤ) : ℂ) from by push_cast; ring, + ((m - n : ℤ) : ℂ) from by push_cast; ac_rfl, Complex.norm_intCast, ← Int.cast_abs] at h1 have h2 : |m - n| < 1 := by exact_mod_cast h1 have h3 : m - n = 0 := Int.abs_lt_one_iff.mp h2 @@ -385,7 +385,7 @@ private lemma smooth_winding_integral_continuousOn · apply eventually_of_mem self_mem_nhdsWithin intro s hs have hab' : Icc a b = Icc (min a b) (max a b) := by - simp [min_eq_left hab.le, max_eq_right hab.le] + simp only [min_eq_left hab.le, max_eq_right hab.le] apply (ContinuousOn.mul (ContinuousOn.inv₀ ((hγ_cont.comp (continuous_id.prodMk continuous_const)).sub @@ -528,7 +528,9 @@ theorem generalizedWindingNumber_eq_classical_away have ht' : t ∈ Icc γ.a γ.b := by rw [Set.uIoc_of_le (le_of_lt γ.hab)] at ht exact Ioc_subset_Icc_self ht - simp_all + simp_all only [mem_Icc, ne_eq, and_imp, image_nonempty, nonempty_Icc, mem_image, not_exists, + not_and, not_false_eq_true, implies_true, uIoc_of_le, mem_Ioc, and_true, gt_iff_lt, ↓reduceIte, + deriv_sub_const_fun] private lemma integral_congr_homotopy_endpoint {f : ℂ → ℂ} {γ : ℝ → ℂ} {H : ℝ × ℝ → ℂ} {a b : ℝ} {s : ℝ} diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/MathlibBridge.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/MathlibBridge.lean index ceaf2493c6..4c70afe55e 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/MathlibBridge.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/MathlibBridge.lean @@ -111,7 +111,7 @@ theorem generalizedWindingNumber_circleMap_eq_inv_circleIntegral simp [circleMap, Complex.norm_real, abs_of_pos hR, Complex.norm_exp_ofReal_mul_I] intro heq - simp_all + simp_all only [ne_eq, mem_Icc] -- Apply the classical away theorem have hclass := generalizedWindingNumber_eq_classical_away γ w havoids simp only [γ] at hclass diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/ParametricDiff.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/ParametricDiff.lean index 175611bad7..b3f5b05c0e 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/ParametricDiff.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Homotopy/ParametricDiff.lean @@ -346,7 +346,7 @@ private lemma homotopy_schwarz_product_rule rw [hLHS, hRHS, homotopy_chain_rule_s f H hH t s hf, homotopy_chain_rule_t f H hH t s hf, schwarz_partialDeriv_comm H hH t s] - ring + ac_rfl /-! ### Helpers for `hasDerivAt_homotopy_param` -/ diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/LogDerivFTC.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/LogDerivFTC.lean index c0d03e21b0..d764a9609f 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/LogDerivFTC.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/LogDerivFTC.lean @@ -185,4 +185,12 @@ theorem integral_logDeriv_eq_neg_log_sub {f : ℝ → ℂ} {a b : ℝ} (hab : a ∫ t in a..b, deriv f t / f t = Complex.log (-f b) - Complex.log (-f a) := (ftc_log_neg_on_segment hab hf_cont hf_diff hf_deriv_cont hf_neg_slit).2 +/-- Transport interval integrability and an evaluated integral along a.e. equality. -/ +theorem intervalIntegrable_integral_eq_congr_ae {f g : ℝ → ℂ} {a b : ℝ} {c : ℂ} + (h : IntervalIntegrable f volume a b ∧ ∫ t in a..b, f t = c) + (hfg : ∀ᵐ t ∂volume, t ∈ Ι a b → f t = g t) : + IntervalIntegrable g volume a b ∧ ∫ t in a..b, g t = c := by + refine ⟨h.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr hfg), ?_⟩ + exact (intervalIntegral.integral_congr_ae hfg).symm.trans h.2 + end LogDerivFTC diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/OnCurvePV/Basic.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/OnCurvePV/Basic.lean index 262f0b2485..6bd40bb11d 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/OnCurvePV/Basic.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/OnCurvePV/Basic.lean @@ -13,7 +13,6 @@ import Mathlib.Analysis.Calculus.Deriv.Add import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # On-Curve Principal Value: General Infrastructure diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/AnnulusBounds.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/AnnulusBounds.lean index 58becf25f2..8338a63cbd 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/AnnulusBounds.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/AnnulusBounds.lean @@ -10,7 +10,6 @@ public import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic import LeanPool.LeanModularForms.GeneralizedResidueTheory.PVInfrastructure.RemainderAnalysis import LeanPool.LeanModularForms.GeneralizedResidueTheory.PVInfrastructure.StepBounds import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # PV Infrastructure: Annulus Bounds @@ -171,8 +170,8 @@ lemma remainder_integral_bound_on_annulus have h_far : R < |t - t₀| := by simp only [Icontain, Set.mem_Icc, not_and_or, not_le] at ht_in rcases ht_in with h | h - · rw [abs_of_neg (by linarith)]; linarith - · rw [abs_of_pos (by linarith)]; linarith + · rw [abs_of_neg (by linarith only [hR_pos, h])]; linarith only [h] + · rw [abs_of_pos (by linarith only [hR_pos, h])]; linarith only [h] rw [remainder_annulus_zero_of_far hL hε₁_pos hε₂_pos h_lower h_loc_δ₁ hab t (Set.uIoc_of_le hab.le ▸ ht) h_far, norm_zero] calc ‖∫ t in a..b, @@ -228,13 +227,13 @@ lemma volume_shell_le {t₀ r₁ r₂ : ℝ} have habs : |t - t₀| = t - t₀ := abs_of_nonneg (sub_nonneg.mpr ht) rw [habs] at h_lower h_upper - exact ⟨by linarith, by linarith⟩ + exact ⟨by linarith only [h_lower], by linarith only [h_upper]⟩ · left push Not at ht have habs : |t - t₀| = -(t - t₀) := abs_of_neg (sub_neg.mpr ht) rw [habs] at h_lower h_upper - exact ⟨by linarith, by linarith⟩ + exact ⟨by linarith only [h_upper], by linarith only [h_lower]⟩ calc volume {t : ℝ | r₁ < |t - t₀| ∧ |t - t₀| ≤ r₂} ≤ volume (Set.Ico (t₀ - r₂) (t₀ - r₁) ∪ @@ -249,7 +248,7 @@ lemma volume_shell_le {t₀ r₁ r₂ : ℝ} Real.volume_Ioc]; ring_nf _ = ENNReal.ofReal (2 * (r₂ - r₁)) := by rw [← ENNReal.ofReal_add - (by linarith) (by linarith)]; ring_nf + (by exact sub_nonneg.mpr hr) (by exact sub_nonneg.mpr hr)]; ring_nf /-- If `g` and `x` are within `e` and straddle a threshold `ε`, then `|x - ε| ≤ e`. -/ private lemma abs_sub_threshold_le {g x ε e : ℝ} (h_approx : |g - x| ≤ e) @@ -340,8 +339,8 @@ private lemma volume_abs_eq_null {t₀ r₁ : ℝ} (hr₁_pos : 0 < r₁) : intro t ht; simp only [Set.mem_ofPred_eq] at ht simp only [Set.mem_insert_iff, Set.mem_singleton_iff] rcases (abs_eq hr₁_pos.le).mp ht with h1 | h1 - · right; linarith - · left; linarith + · right; linarith only [h1] + · left; linarith only [h1] exact le_antisymm (le_of_le_of_eq (MeasureTheory.measure_mono h_sub) ((Set.toFinite _).measure_zero volume)) (zero_le) diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/GammaAnalysis.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/GammaAnalysis.lean index aed212b16d..9a3017e496 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/GammaAnalysis.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/GammaAnalysis.lean @@ -43,7 +43,7 @@ private lemma hasDerivAt_remainder_bound obtain ⟨s, hs_mem, hs⟩ := (hγ hε).exists_mem obtain ⟨δ, hδ_pos, hδ_ball⟩ := Metric.mem_nhds_iff.mp hs_mem refine ⟨δ, hδ_pos, fun t _ ht_lt => ?_⟩ - have h_bound := hs t (hδ_ball (by simp [Metric.mem_ball, Real.dist_eq, ht_lt])) + have h_bound := hs t (hδ_ball (by simp only [Metric.mem_ball, Real.dist_eq, ht_lt])) simpa only [Real.norm_eq_abs] using h_bound private lemma norm_real_smul (x : ℝ) (L : ℂ) : ‖x • L‖ = |x| * ‖L‖ := by @@ -80,7 +80,8 @@ lemma integrand_times_t_tendsto_one have h_comp : (fun t => (t - t₀)⁻¹ • (γ t - γ t₀)) = (fun s => s⁻¹ • (γ (t₀ + s) - γ t₀)) ∘ - (fun t => t - t₀) := by ext t; simp [add_sub_cancel] + (fun t => t - t₀) := by ext t; simp only [real_smul, ofReal_inv, ofReal_sub, + Function.comp_apply, add_sub_cancel] rw [h_comp] apply Tendsto.comp hγ_hasderiv apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within @@ -91,10 +92,11 @@ lemma integrand_times_t_tendsto_one simp only [Set.mem_compl_iff, Set.mem_singleton_iff, sub_ne_zero]; exact ht have h_slope' : Tendsto (fun t => (γ t - γ t₀) * (↑(t - t₀) : ℂ)⁻¹) (𝓝[≠] t₀) (𝓝 L) := by simp only [show ∀ t : ℝ, (γ t - γ t₀) * (↑(t - t₀) : ℂ)⁻¹ = - (t - t₀)⁻¹ • (γ t - γ t₀) from fun t => by rw [Algebra.smul_def]; simp [mul_comm]] + (t - t₀)⁻¹ • (γ t - γ t₀) from fun t => by rw [Algebra.smul_def]; simp only [ofReal_sub, + map_inv₀, coe_algebraMap, mul_comm] ] exact h_slope have h_recip := h_slope'.inv₀ hL - simp_all + simp_all only [ne_eq, real_smul, ofReal_inv, ofReal_sub, mul_inv_rev, inv_inv] have h_prod : Tendsto (fun t => (↑(t - t₀) : ℂ) * @@ -102,7 +104,7 @@ lemma integrand_times_t_tendsto_one (𝓝[≠] t₀) (𝓝 (L⁻¹ * L)) := Tendsto.mul h_ratio_tendsto (h_deriv_tendsto.mono_left nhdsWithin_le_nhds) - simp_all + simp_all only [ne_eq, ofReal_sub, not_false_eq_true, inv_mul_cancel₀] /-- Asymptotic control: ‖(γ-γ₀)⁻¹ * γ' - (t-t₀)⁻¹‖ ≤ ε / |t-t₀|. -/ diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/RemainderAnalysis.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/RemainderAnalysis.lean index e122dda4d3..d57556e502 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/RemainderAnalysis.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/RemainderAnalysis.lean @@ -10,7 +10,6 @@ public import Mathlib.Analysis.InnerProductSpace.Basic import LeanPool.LeanModularForms.GeneralizedResidueTheory.PVInfrastructure.GammaAnalysis import Mathlib.Analysis.Calculus.ContDiff.Comp import Mathlib.Analysis.Calculus.ContDiff.RCLike -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # PV Infrastructure: Remainder Analysis @@ -28,7 +27,7 @@ The key result `remainder_bounded_of_C2` shows that the remainder @[expose] public section -open Complex MeasureTheory Set Filter Topology +open Complex Set Filter Topology open scoped Real Interval noncomputable section @@ -93,7 +92,8 @@ lemma quadratic_approx_of_contDiffAt_two use K, δ, hδ_pos, hK_pos intro t ht by_cases ht_eq : t = t₀ - · simp [ht_eq] + · simp only [ht_eq, sub_self, zero_smul, norm_zero, abs_zero, ne_eq, OfNat.ofNat_ne_zero, + not_false_eq_true, zero_pow, mul_zero, Std.le_refl] let f₁ : ℝ → ℂ := γ let f₂ : ℝ → ℂ := fun _ => γ t₀ let f₃ : ℝ → ℂ := fun s => (s - t₀) • L @@ -122,7 +122,8 @@ lemma quadratic_approx_of_contDiffAt_two intro s hs have hs_diff : DifferentiableAt ℝ γ s := h_γ_diff_on s hs have h_diff_f1f2 : DifferentiableAt ℝ (fun s => f₁ s - f₂ s) s := hs_diff.sub (h_f₂_diff s) - have h_eq_sub : h = fun s => (f₁ s - f₂ s) - f₃ s := by ext; simp [h, f₁, f₂, f₃] + have h_eq_sub : h = fun s => (f₁ s - f₂ s) - f₃ s := by ext; simp only [real_smul, ofReal_sub, + h, f₁, f₂, f₃] have step1 : deriv h s = deriv (fun s => (f₁ s - f₂ s) - f₃ s) s := by rw [← h_eq_sub] have step2 : deriv (fun s => (f₁ s - f₂ s) - f₃ s) s = deriv (fun s => f₁ s - f₂ s) s - deriv f₃ s := @@ -277,7 +278,8 @@ lemma remainder_bounded_of_C2 mul_le_mul_of_nonneg_right h (abs_nonneg _) have h_denom_pos : 0 < ‖(γ t - γ t₀) * (↑(t - t₀))‖ := by - simp_all + simp_all only [ne_eq, norm_pos_iff, not_false_eq_true, gt_iff_lt, abs_pos, ge_iff_le, + ofReal_sub, sq_abs, Complex.norm_mul, mul_pos_iff_of_pos_left] have h_sq_pos : 0 < |t - t₀| ^ 2 := sq_pos_of_pos ht_pos have h_d_pos : 0 < (‖L‖ / 2) * |t - t₀| ^ 2 := mul_pos (half_pos hL_norm_pos) h_sq_pos calc ‖(↑(t - t₀) : ℂ) * deriv γ t - diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/SingularAnnulus.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/SingularAnnulus.lean index ecfff9894c..83cde836e7 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/SingularAnnulus.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/SingularAnnulus.lean @@ -11,7 +11,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.PVInfrastructure.Annul import LeanPool.LeanModularForms.GeneralizedResidueTheory.PVInfrastructure.GammaAnalysis import LeanPool.LeanModularForms.GeneralizedResidueTheory.PVInfrastructure.StepBounds import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # PV Infrastructure: Singular Annulus Bounds @@ -76,8 +75,8 @@ private lemma singular_annulus_final_ratio {Kmeas ε₁ ε₂ : ℝ} {L : ℂ} rw [show Kmeas * ε₁ ^ 2 / ‖L‖ ^ 3 * (2 * ‖L‖ / ε₂) = 2 * Kmeas * ε₁ ^ 2 * ‖L‖ / (‖L‖ ^ 3 * ε₂) from by ring, show 4 * Kmeas / ‖L‖ ^ 2 * ε₁ = 4 * Kmeas * ε₁ / ‖L‖ ^ 2 from by ring, - div_le_div_iff₀ (mul_pos (by positivity : (0 : ℝ) < ‖L‖ ^ 3) hε₂_pos) - (by positivity : (0 : ℝ) < ‖L‖ ^ 2)] + div_le_div_iff₀ (mul_pos (by exact pow_pos hL_pos 3 : (0 : ℝ) < ‖L‖ ^ 3) hε₂_pos) + (by exact pow_pos hL_pos 2 : (0 : ℝ) < ‖L‖ ^ 2)] nlinarith only [hKmeas_pos, hL_pos, hε₁_pos, h_ratio, mul_pos hKmeas_pos (pow_pos hL_pos 3), show ε₁ ^ 2 ≤ ε₁ * (2 * ε₂) from by rw [sq]; exact mul_le_mul_of_nonneg_left h_ratio hε₁_pos.le] @@ -125,7 +124,7 @@ private lemma singular_annulus_indicator_diff_zero have hlin_fail : ¬(ε₂ < ‖L‖ * |t - t₀| ∧ ‖L‖ * |t - t₀| ≤ ε₁) := by intro ⟨_, h_le⟩ linarith [mul_le_mul_of_nonneg_left (not_lt.mp hδ) (le_of_lt hL_pos)] - simp [hγ_fail, hlin_fail] + simp only [hγ_fail, ↓reduceIte, hlin_fail, sub_self] /-- The annulus condition `ε₂ < ‖L‖ * |t - t₀| ∧ ‖L‖ * |t - t₀| ≤ ε₁` is equivalent to `c₁ < |t - t₀| ∧ |t - t₀| ≤ c₂` where `c₁ = ε₂/‖L‖` and `c₂ = ε₁/‖L‖`. -/ @@ -448,7 +447,7 @@ private lemma singular_annulus_diff_pointwise_bound · simp only [hγ, and_self, ↓reduceIte, ofReal_sub, hlin, sub_self, norm_zero, ge_iff_le] exact le_of_lt hbound_pos · simp only [hγ, hlin, ↓reduceIte, sub_zero] - have ht_ne : t ≠ t₀ := by intro heq; simp [heq] at hγ; linarith + have ht_ne : t ≠ t₀ := by intro heq; simp [heq] at hγ; linarith only [hε₂_pos, hγ] have ht_pos : 0 < |t - t₀| := abs_pos.mpr (sub_ne_zero.mpr ht_ne) have ht_loc := h_localize t ht hγ.2 @@ -468,7 +467,7 @@ private lemma singular_annulus_diff_pointwise_bound le_of_lt (by calc ε₂ / (2 * ‖L‖) < ε₂ / ‖L‖ := div_lt_div_of_pos_left hε₂_pos - hL_pos (by linarith) + hL_pos (by linarith only [hL_pos]) _ ≤ |t - t₀| := by rw [div_le_iff₀ hL_pos, mul_comm] exact le_of_lt hlin.1) diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/StepBounds.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/StepBounds.lean index bd3a9a309e..6f9b70d212 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/StepBounds.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/StepBounds.lean @@ -54,7 +54,7 @@ private lemma norm_integral_le_const_left {r : ℝ → ℂ} {t₀ a b B C : ℝ} ≤ C * |(t₀ - a) - (t₀ - b)| := intervalIntegral.norm_integral_le_of_norm_le_const hb _ = C * (b - a) := by rw [show (t₀ - a) - (t₀ - b) = b - a by ring, - abs_of_pos (by linarith)] + abs_of_pos (by exact sub_pos.mpr hab)] /-- Norm bound for an integral over a right annulus segment `(t₀+a)..(t₀+b)` where `‖r‖ ≤ C` holds whenever `0 < |t-t₀| ≤ B` and `b ≤ B`. -/ @@ -72,7 +72,7 @@ private lemma norm_integral_le_const_right {r : ℝ → ℂ} {t₀ a b B C : ℝ ≤ C * |(t₀ + b) - (t₀ + a)| := intervalIntegral.norm_integral_le_of_norm_le_const hb _ = C * (b - a) := by rw [show (t₀ + b) - (t₀ + a) = b - a by ring, - abs_of_pos (by linarith)] + abs_of_pos (by exact sub_pos.mpr hab)] /-- O(ε) step bound from bounded remainder. -/ lemma remainder_integral_O_eps {r : ℝ → ℂ} {t₀ ε C : ℝ} @@ -390,7 +390,7 @@ lemma summableSubseqAux_halving {γ : ℝ → ℂ} rw [show (ε n / 2) / 2 = ε n / 4 from by ring] at h_min_le have hε_pos := summableSubseqAux_pos hL hγ_hasderiv hγ_cont_deriv δ₀ hδ₀_pos n - linarith + linarith only [hL, hγ_hasderiv, hγ_cont_deriv, h_min_le, hε_pos] lemma summableSubseqAux_lt_delta {γ : ℝ → ℂ} {t₀ : ℝ} {L : ℂ} (hL : L ≠ 0) @@ -425,7 +425,7 @@ lemma summableSubseqAux_lt_delta {γ : ℝ → ℂ} have h_min_pos : 0 < min (ε m / 2) (δ (m + 1)) := lt_min (by linarith [summableSubseqAux_pos hL hγ_hasderiv hγ_cont_deriv δ₀ hδ₀_pos m]) (hδ_pos (m + 1)) - linarith + linarith only [hL, hγ_hasderiv, hγ_cont_deriv, h_min_le, h_min_pos] lemma summableSubseqAux_error_bound {γ : ℝ → ℂ} {t₀ : ℝ} {L : ℂ} (hL : L ≠ 0) @@ -858,7 +858,7 @@ lemma telescoping_sum_bound {X : Type*} [SeminormedAddCommGroup X] rw [(sub_add_sub_cancel (I (N + d' + 2)) (I (N + d' + 1)) (I N)).symm] have h_step_d' : ‖I (N + d' + 2) - I (N + d' + 1)‖ ≤ K * δ / 2 ^ (N + d' + 1) := by - simp_all + simp_all only [gt_iff_lt, Order.lt_add_one_iff, le_add_iff_nonneg_right, zero_le, imp_self] calc ‖(I (N + d' + 2) - I (N + d' + 1)) + (I (N + d' + 1) - I N)‖ ≤ ‖I (N + d' + 2) - I (N + d' + 1)‖ + ‖I (N + d' + 1) - I N‖ := norm_add_le _ _ @@ -866,7 +866,7 @@ lemma telescoping_sum_bound {X : Type*} [SeminormedAddCommGroup X] (2 * K * δ / 2 ^ N - 2 * K * δ / 2 ^ (N + d' + 1)) := by linarith [h_step_d', ih'] _ = 2 * K * δ / 2 ^ N - K * δ / 2 ^ (N + d' + 1) := by ring _ = 2 * K * δ / 2 ^ N - 2 * K * δ / 2 ^ (N + d' + 2) := by - have h_pow : (2 : ℝ) ^ (N + d' + 2) = 2 * 2 ^ (N + d' + 1) := by rw [pow_succ]; ring + have h_pow : (2 : ℝ) ^ (N + d' + 2) = 2 * 2 ^ (N + d' + 1) := by rw [pow_succ]; ac_rfl field_simp [h_pow]; ring end diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/UniformStepBound.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/UniformStepBound.lean index 664ce2b208..6349068a8e 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/UniformStepBound.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PVInfrastructure/UniformStepBound.lean @@ -13,7 +13,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.PVInfrastructure.Remai import LeanPool.LeanModularForms.GeneralizedResidueTheory.PVInfrastructure.SingularAnnulus import LeanPool.LeanModularForms.GeneralizedResidueTheory.PVInfrastructure.StepBounds import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # PV Infrastructure: Uniform Step Bound @@ -250,7 +249,7 @@ lemma pv_step_bound_ratio_two_uniform by_cases hcond : ε₂ < ‖γ t - γ t₀‖ ∧ ‖γ t - γ t₀‖ ≤ ε₁ - · simp only [ite_eq_left hcond]; ring + · simp only [ite_eq_left hcond]; ac_rfl · simp only [ite_eq_right hcond, sub_zero]) have h_annulus_split : ∫ t in a..b, diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PiecewiseCurveAPI.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PiecewiseCurveAPI.lean index ea5abcb626..fa41bf777b 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/PiecewiseCurveAPI.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/PiecewiseCurveAPI.lean @@ -169,7 +169,7 @@ theorem sortedPartition_tail_nonempty (γ : PiecewiseC1Curve) : have hlen2 : γ.sortedPartition.length ≤ 1 := by rcases List.exists_cons_of_ne_nil (sortedPartition_nonempty γ) with ⟨hd, tl, heq⟩ simp_all - linarith + linarith only [hlen, hlen2] /-- The union of `Icc p.1 p.2` over all `p ∈ consecutivePairs γ` covers `[a, b]`. -/ theorem consecutivePairs_cover (γ : PiecewiseC1Curve) : diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue.lean index 9105caa58b..4c27fc949b 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue.lean @@ -12,7 +12,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.Homotopy.Invariance import Mathlib.Analysis.Complex.RemovableSingularity import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! @@ -292,14 +291,14 @@ lemma integral_singular_term_eq_winding_times_coeff rw [generalizedWindingNumber_eq_classical_away γ s h_avoids] field_simp [h_ne] have h_integrand : ∀ t, c / (γ.toFun t - s) * deriv γ.toFun t = - c * ((γ.toFun t - s)⁻¹ * deriv γ.toFun t) := by intro t; rw [div_eq_mul_inv]; ring + c * ((γ.toFun t - s)⁻¹ * deriv γ.toFun t) := by intro t; rw [div_eq_mul_inv]; ac_rfl calc ∫ t in γ.a..γ.b, c / (γ.toFun t - s) * deriv γ.toFun t = ∫ t in γ.a..γ.b, c * ((γ.toFun t - s)⁻¹ * deriv γ.toFun t) := by apply intervalIntegral.integral_congr; intro t _; exact h_integrand t _ = c * ∫ t in γ.a..γ.b, (γ.toFun t - s)⁻¹ * deriv γ.toFun t := intervalIntegral.integral_smul c (fun t => (γ.toFun t - s)⁻¹ * deriv γ.toFun t) _ = c * (2 * Real.pi * I * generalizedWindingNumber' γ.toFun γ.a γ.b s) := by rw [h_integral] - _ = 2 * Real.pi * I * generalizedWindingNumber' γ.toFun γ.a γ.b s * c := by ring + _ = 2 * Real.pi * I * generalizedWindingNumber' γ.toFun γ.a γ.b s * c := by ac_rfl private lemma differentiableAt_singular_sum (f : ℂ → ℂ) (S0 : Finset ℂ) (w : ℂ) @@ -349,7 +348,8 @@ private lemma continuousAt_g_at_pole fun hx => by rcases hx with ⟨hx1, _⟩ | ⟨hx1, _⟩ <;> exact hx1⟩ · exact Finset.disjoint_filter.mpr fun x _ hxz hx_ne_z => hx_ne_z hxz have hfilter_eq : S0.filter (· = z) = {z} := by - ext x; simp_all + ext x; simp_all only [ne_eq, Finset.mem_filter, Finset.mem_singleton, and_iff_right_iff_imp, + implies_true] have hsingleton : ∑ s ∈ S0.filter (· = z), residueSimplePole f s / (w - s) = residueSimplePole f z / (w - z) := by rw [hfilter_eq, Finset.sum_singleton] rw [hsum_split, hsingleton]; ring @@ -504,7 +504,7 @@ theorem integral_eq_sum_residues_of_avoids holomorphic_closed_integral_zero U hU hU_convex g hg_diff γ hγ_closed hγ_in_U hγ'_bdd, singular_sum_eq_winding_residues f S0 γ hγ_avoids hγ'_bdd, add_zero, Finset.mul_sum] - exact Finset.sum_congr rfl fun _ _ => by ring + exact Finset.sum_congr rfl fun _ _ => by ac_rfl lemma cauchyPrincipalValueIntegrandOn_eq_of_far (S0 : Finset ℂ) (f : ℂ → ℂ) (γ : ℝ → ℂ) (ε : ℝ) (t : ℝ) @@ -656,7 +656,7 @@ theorem pv_integral_simple_pole else 0) * c := by intro ε t; simp only [sub_zero, h_deriv_eq] split_ifs with h - · rw [div_eq_mul_inv]; ring + · rw [div_eq_mul_inv]; ac_rfl · ring have h_integral' : ∀ ε, (∫ t in γ.a..γ.b, if ‖γ.toFun t - z₀‖ > ε diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/Flatness.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/Flatness.lean index 70bb09dc6e..252de94c56 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/Flatness.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/Flatness.lean @@ -12,7 +12,6 @@ import Mathlib.Analysis.Calculus.FDeriv.Extend import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Flatness and Higher-Order Pole Conditions (Definition 3.2) @@ -59,10 +58,12 @@ def tangentDeviation (w L : ℂ) : ℂ := w - orthogonalProjectionComplex w L theorem orthogonalProjectionComplex_zero_left (L : ℂ) : - orthogonalProjectionComplex 0 L = 0 := by simp [orthogonalProjectionComplex] + orthogonalProjectionComplex 0 L = 0 := by simp only [orthogonalProjectionComplex, zero_mul, + zero_re, zero_div, zero_smul] theorem tangentDeviation_zero_left (L : ℂ) : - tangentDeviation 0 L = 0 := by simp [tangentDeviation, orthogonalProjectionComplex_zero_left] + tangentDeviation 0 L = 0 := by simp only [tangentDeviation, + orthogonalProjectionComplex_zero_left, sub_self] theorem tangentDeviation_zero_right (w : ℂ) : tangentDeviation w 0 = w := by @@ -172,7 +173,8 @@ private theorem tangentDeviation_isLittleO_of_remainder (fun t => tangentDeviation (γ t - γ t₀) L) =o[l] fun t => γ t - γ t₀ := by set r := fun t => γ t - γ t₀ - (t - t₀) • L with hr_def have h_eq : ∀ t, tangentDeviation (γ t - γ t₀) L = tangentDeviation (r t) L := fun t => by - rw [show γ t - γ t₀ = (t - t₀) • L + r t from by simp [hr_def], + rw [show γ t - γ t₀ = (t - t₀) • L + r t from by simp only [real_smul, ofReal_sub, hr_def, + add_sub_cancel], tangentDeviation_add, tangentDeviation_real_smul_self _ _ hL, zero_add] have hO : (fun t => tangentDeviation (r t) L) =O[l] r := Asymptotics.isBigO_iff.mpr @@ -185,7 +187,8 @@ private theorem tangentDeviation_isLittleO_of_remainder filter_upwards [hr.def (by positivity : (0 : ℝ) < ‖L‖ / 2)] with t ht have h1 : ‖t - t₀‖ * ‖L‖ = ‖(t - t₀) • L‖ := (norm_smul _ _).symm have h2 : ‖(t - t₀) • L‖ ≤ ‖γ t - γ t₀‖ + ‖r t‖ := - (show (t - t₀) • L = (γ t - γ t₀) - r t by simp [hr_def]) ▸ norm_sub_le _ _ + (show (t - t₀) • L = (γ t - γ t₀) - r t by simp only [real_smul, ofReal_sub, hr_def, + sub_sub_cancel]) ▸ norm_sub_le _ _ rw [div_mul_eq_mul_div, le_div_iff₀ hL_pos] nlinarith only [ht, h1, h2, norm_nonneg (γ t - γ t₀)] exact (ho1.trans_isBigO hO2).congr_left fun t => (h_eq t).symm @@ -399,8 +402,9 @@ theorem satisfiesConditionB_of_simple_poles refine ⟨1, ![c], g, hg, ?_, ?_⟩ · filter_upwards [hf_eq] with z hz rw [hz] - simp [pow_one] - ring + simp only [Finset.univ_unique, Fin.default_eq_zero, Fin.isValue, Matrix.cons_val_fin_one, + Fin.val_eq_zero, zero_add, pow_one, Finset.sum_const, Finset.card_singleton, one_smul] + ac_rfl · simp_all only [mem_Icc, mem_Ioo, ne_eq, Nat.exists_ne_zero, Nat.cast_add, Nat.cast_one, forall_and_index, Matrix.cons_val_fin_one, Fin.val_eq_zero, ge_iff_le, nonpos_iff_eq_zero, one_ne_zero, CharP.cast_eq_zero, diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer.lean index 619ad5e26a..2c726d3091 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer.lean @@ -11,7 +11,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.HomologicalCauchy.Mero import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Generalized Residue Theorem (Theorem 3.3) -- Convex Domain Corollary diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/BoundaryVanishing.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/BoundaryVanishing.lean index 70ac70bc8a..ad808af3b8 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/BoundaryVanishing.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/BoundaryVanishing.lean @@ -11,7 +11,6 @@ import Mathlib.Analysis.Calculus.FDeriv.Extend import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch import Mathlib.MeasureTheory.Integral.DivergenceTheorem /-! @@ -49,7 +48,7 @@ theorem hasDerivAt_zpow_comp_sub (↑n * (γ t - s) ^ (n - 1) * L) t := by have h_comp := (hasDerivAt_zpow n (γ t - s) (Or.inl (sub_ne_zero.mpr hne))).comp t (hγ.sub_const s) - exact h_comp.congr_deriv (by ring) + exact h_comp.congr_deriv (by ac_rfl) /-- ContinuousOn for `t ↦ (γ(t) - s)^n` on a set where `γ(t) ≠ s`. -/ theorem continuousOn_zpow_comp_sub @@ -189,7 +188,7 @@ private lemma direction_of_slope_tendsto filter_upwards [self_mem_nhdsWithin (s := Ioi (0 : ℝ))] with ε (hε : (0 : ℝ) < ε) set w := f ε rcases eq_or_ne w 0 with hw | hw - · simp [hw] + · simp only [hw, norm_zero, ofReal_zero, div_zero, smul_zero] · have h_inv_pos : (0 : ℝ) < ε⁻¹ := inv_pos_of_pos hε have h_inv_ne : (↑(ε⁻¹ : ℝ) : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (ne_of_gt h_inv_pos) @@ -380,7 +379,7 @@ theorem zpow_boundary_diff_tendsto_zero calc ε ^ k * ‖(wR ε / ↑‖wR ε‖) ^ k - (wL ε / ↑‖wL ε‖) ^ k‖ ≤ ε ^ k * (η / 2 * ε ^ (n - 1 : ℕ)) := mul_le_mul_of_nonneg_left h_bnd (zpow_nonneg hε_pos.le k) - _ = η / 2 * (ε ^ k * ε ^ (n - 1 : ℕ)) := by ring + _ = η / 2 * (ε ^ k * ε ^ (n - 1 : ℕ)) := by ac_rfl _ ≤ η / 2 * 1 := mul_le_mul_of_nonneg_left h_pow_le (half_pos hη).le _ = η / 2 := mul_one _ _ < η := half_lt_self hη @@ -483,12 +482,12 @@ private lemma orthogonalProjectionComplex_real_smul_right (c : ℝ) (hc : c ≠ show star L = starRingEnd ℂ L from rfl] rw [show Complex.normSq ((↑c : ℂ) * L) = c ^ 2 * Complex.normSq L from by rw [Complex.normSq_mul, Complex.normSq_ofReal, sq], - show w * (↑c * starRingEnd ℂ L) = ↑c * (w * starRingEnd ℂ L) from by ring, + show w * (↑c * starRingEnd ℂ L) = ↑c * (w * starRingEnd ℂ L) from by ac_rfl, Complex.re_ofReal_mul] set r := (w * starRingEnd ℂ L).re set nS := Complex.normSq L rw [show (↑(c * r / (c ^ 2 * nS)) : ℂ) * ((↑c : ℂ) * L) = - ↑(c * r / (c ^ 2 * nS) * c) * L from by push_cast; ring, + ↑(c * r / (c ^ 2 * nS) * c) * L from by push_cast; ac_rfl, show c * r / (c ^ 2 * nS) * c = r / nS from by rw [sq]; field_simp] lemma tangentDeviation_real_smul_right (c : ℝ) (hc : c ≠ 0) (w L : ℂ) : @@ -603,7 +602,7 @@ lemma re_pos_right_of_slope (fun t ht => (hs_diff t ht).differentiableWithinAt) hcont.continuousWithinAt hs_mem htend_R) have hReLR : 0 < (L_R * starRingEnd ℂ L_R).re := by - simp [Complex.mul_conj, Complex.normSq_pos.mpr hL_R_ne] + simp only [mul_conj, ofReal_re, Complex.normSq_pos.mpr hL_R_ne] have h_slope : Tendsto (slope γ.toFun t₀) (𝓝[>] t₀) (𝓝 L_R) := (hasDerivWithinAt_iff_tendsto_slope' Set.self_notMem_Ioi).mp hderiv refine re_pos_of_slope_sign γ s t₀ hcross L_R _ ?_ @@ -629,7 +628,8 @@ lemma re_pos_left_of_slope (fun t ht => (hs_diff t ht).differentiableWithinAt) hcont.continuousWithinAt hs_mem htend_L) have hReLLneg : (L_L * starRingEnd ℂ (-L_L)).re < 0 := by - simp [map_neg, mul_neg, Complex.mul_conj, Complex.normSq_pos.mpr hL_L_ne] + simp only [map_neg, mul_neg, mul_conj, neg_re, ofReal_re, Left.neg_neg_iff, + Complex.normSq_pos.mpr hL_L_ne] have h_slope : Tendsto (slope γ.toFun t₀) (𝓝[<] t₀) (𝓝 L_L) := (hasDerivWithinAt_iff_tendsto_slope' Set.self_notMem_Iio).mp hderiv refine re_pos_of_slope_sign γ s t₀ hcross (-L_L) _ ?_ @@ -644,9 +644,9 @@ lemma tangentDeviation_scale_eq ‖tangentDeviation (w / (↑‖w‖ : ℂ)) (L / (↑‖L‖ : ℂ))‖ = ‖tangentDeviation w L‖ / ‖w‖ := by rw [show (w / (↑‖w‖ : ℂ) : ℂ) = (‖w‖⁻¹ : ℝ) • w from by - simp [Complex.real_smul, Complex.ofReal_inv, inv_mul_eq_div], + simp only [real_smul, ofReal_inv, inv_mul_eq_div], show (L / (↑‖L‖ : ℂ) : ℂ) = (‖L‖⁻¹ : ℝ) • L from by - simp [Complex.real_smul, Complex.ofReal_inv, inv_mul_eq_div], + simp only [real_smul, ofReal_inv, inv_mul_eq_div], tangentDeviation_real_smul_right _ (inv_ne_zero hL_ne), tangentDeviation_real_smul_left, norm_smul, Real.norm_eq_abs, abs_of_nonneg (inv_nonneg.mpr (norm_nonneg _)), inv_mul_eq_div] diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/CPVExistence.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/CPVExistence.lean index 475b303813..c20ba59576 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/CPVExistence.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/CPVExistence.lean @@ -11,7 +11,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.WindingNumber.Crossing import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch import Mathlib.MeasureTheory.Integral.DominatedConvergence import Mathlib.Tactic.Positivity.Finset @@ -227,7 +226,7 @@ lemma cpv_exists_inv_sub_of_closed_unique rw [Filter.Eventually, mem_nhdsWithin] at h_sp_ev obtain ⟨U, hU_open, h0_mem, hU_sub⟩ := h_sp_ev obtain ⟨r, hr, hr_ball⟩ := Metric.isOpen_iff.mp hU_open 0 h0_mem - exact ⟨min r δ, by positivity, min_le_right _ _, fun ε hε => hU_sub ⟨hr_ball (by + exact ⟨min r δ, by exact lt_min hr hδ, min_le_right _ _, fun ε hε => hU_sub ⟨hr_ball (by simp only [Metric.mem_ball, Real.dist_eq] rw [sub_zero, abs_of_pos hε.1] exact lt_of_lt_of_le hε.2 (min_le_left _ _)), hε.1⟩⟩ diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/CutoffInfrastructure.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/CutoffInfrastructure.lean index 7bc27aa0eb..5258b947e3 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/CutoffInfrastructure.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/CutoffInfrastructure.lean @@ -11,7 +11,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.WindingNumber.Crossing import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Cutoff zpow Infrastructure @@ -91,7 +90,7 @@ private lemma tangentDeviation_scale_neg_eq ‖tangentDeviation (w / (↑‖w‖ : ℂ)) (-L / (↑‖L‖ : ℂ))‖ = ‖tangentDeviation w (-L)‖ / ‖w‖ := by rw [show (w / (↑‖w‖ : ℂ) : ℂ) = (‖w‖⁻¹ : ℝ) • w from by - simp [Complex.real_smul, Complex.ofReal_inv, inv_mul_eq_div], + simp only [real_smul, ofReal_inv, inv_mul_eq_div], show -L / (↑‖L‖ : ℂ) = (‖L‖⁻¹ : ℝ) • (-L) from by rw [Complex.real_smul, Complex.ofReal_inv, inv_mul_eq_div, neg_div], tangentDeviation_real_smul_right _ (inv_ne_zero hL_ne), @@ -138,7 +137,8 @@ private lemma direction_rate_from_flatness_left (div_pos hc_pos (Real.sqrt_pos.mpr two_pos)), hσ_norm, h_re_pos] with ε h_td_bound hε_norm h_re set w := γ.toFun (σ ε) - s - have hw_ne : w ≠ 0 := by intro h; simp [h] at h_re + have hw_ne : w ≠ 0 := by intro h; simp only [h, map_neg, mul_neg, zero_mul, neg_zero, zero_re, + lt_self_iff_false] at h_re have hw_ne' : ‖w‖ ≠ 0 := norm_ne_zero_iff.mpr hw_ne have hε_pos : 0 < ε := by rw [← hε_norm]; exact norm_pos_iff.mpr hw_ne set u := w / (↑‖w‖ : ℂ) @@ -266,7 +266,7 @@ private lemma cutoff_zpow_integral_eq_boundary hγ_diff t ⟨(hσ₁_ge.trans hσ₁_lt.le).trans ht.1.le, ht.2.le⟩ hne) h_int_r rw [hftc_l, hftc_r, hγ_closed] simp only [show (-(m : ℤ) + 1 : ℤ) = 1 - (m : ℤ) from by omega, - show (↑(1 - (m : ℤ)) : ℂ) = 1 - ↑↑m from by push_cast; ring, Int.cast_natCast] + show (↑(1 - (m : ℤ)) : ℂ) = 1 - ↑↑m from by push_cast; ac_rfl, Int.cast_natCast] ring private lemma exit_time_tendsto_right diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/HigherOrderAssembly.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/HigherOrderAssembly.lean index b180e6d8ec..a41bede015 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/HigherOrderAssembly.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/HigherOrderAssembly.lean @@ -15,7 +15,6 @@ import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Higher-Order Cancellation Assembly @@ -90,7 +89,7 @@ private theorem residueAt_eq_zero_of_analyticExpansion (f : ℂ → ℂ) (s : have hf_ci : (∮ z in C(s, r), f z) = (∮ z in C(s, r), g_loc z) := circleIntegral.integral_congr hr_pos.le h_eq_on - simp [hf_ci, hg_ci_zero] + simp only [mul_inv_rev, inv_I, neg_mul, hf_ci, hg_ci_zero, mul_zero] private theorem meromorphicAt_ppMinusRes (f : ℂ → ℂ) (s : ℂ) (hMero_s : MeromorphicAt f s) : MeromorphicAt (fun z => meromorphicPrincipalPart f s z - residueAt f s / (z - s)) s := by @@ -146,7 +145,7 @@ private theorem laurent_coeff_le_poleOrder (f : ℂ → ℂ) (s : ℂ) · simp only [Nat.sub_self, pow_zero, mul_one] · intro k _ hk by_cases hkm : k.val < m_idx.val - · simp [zero_pow (by omega : m_idx.val - k.val ≠ 0)] + · simp only [zero_pow (by omega : m_idx.val - k.val ≠ 0), mul_zero] · push Not at hkm have hk_gt : m_idx < k := lt_of_le_of_ne (Fin.mk_le_mk.mpr hkm) (Ne.symm hk) @@ -173,7 +172,7 @@ private theorem laurent_coeff_le_poleOrder (f : ℂ → ℂ) (s : ℂ) show k.val + 1 + (m_idx.val - k.val) = m_idx.val + 1 from by omega] · push Not at hk_le by_cases ha_k : a_s k = 0 - · simp [ha_k] + · simp only [ha_k, zero_div, zero_mul, mul_zero] · exact absurd (hm_max k ha_k) (not_le.mpr hk_le) private theorem residueAt_ppMinusRes_eq_zero (f : ℂ → ℂ) (s : ℂ) @@ -324,7 +323,7 @@ private theorem assembly_regNF_differentiableWithinAt_pole · have hw_eq : w = z := by by_contra hne exact hw_compl (Finset.mem_coe.mpr (Finset.mem_erase.mpr ⟨hne, hw_S⟩)) - rw [hw_eq]; simp [hz_S] + rw [hw_eq]; simp only [hz_S, sum_erase_eq_sub, ↓reduceDIte] · have hw_ne_z : w ≠ z := fun heq => hw_S (heq ▸ hz_S) have h_fw : f w - meromorphicPrincipalPart f z w = g_corr z hz_S w := hV_eq ⟨hw_V, hw_ne_z⟩ @@ -582,10 +581,10 @@ private theorem cpv_perTerm_crossed_zero_order (S0 : Finset ℂ) (f : ℂ → exact residueAt_eq_zero_of_analyticExpansion f s g_loc hg_loc_an hf_eq_g have h_term_eq_zero : (fun z => meromorphicPrincipalPart f s z - residueAt f s / (z - s)) = fun _ => 0 := by - ext z; simp only [h_pp_zero, h_res_zero]; simp [zero_div] + ext z; simp only [h_pp_zero, h_res_zero]; simp only [zero_div, sub_self] rw [h_term_eq_zero] simp only [cauchyPrincipalValueIntegrandOn, zero_mul, ite_self] - simp [intervalIntegral.integral_zero] + simp only [intervalIntegral.integral_zero, tendsto_const_nhds_iff] /-- When the curve does not cross `s`, the per-term CPV integral of `pp_s - res_s/(z-s)` tends to 0: the term is continuous on the image, has @@ -789,7 +788,8 @@ private theorem assembly_polarHigher_differentiableOn have h_eq_sum : (fun w => ∑ k : Fin N_s, if k.val ≥ 1 then a_s k / (w - s) ^ (k.val + 1) else 0) = ∑ k : Fin N_s, fun w => - if k.val ≥ 1 then a_s k / (w - s) ^ (k.val + 1) else 0 := by ext w; simp [Finset.sum_apply] + if k.val ≥ 1 then a_s k / (w - s) ^ (k.val + 1) else 0 := by ext w; simp only [ge_iff_le, + Finset.sum_apply] rw [h_eq_sum] exact (DifferentiableAt.sum fun k _ => h_each k).differentiableWithinAt @@ -820,11 +820,11 @@ private theorem cpv_polarHigher_tendsto (U : Set ℂ) (S0 : Finset ℂ) by_cases hk : k.val ≥ 1 · have h_eq : (fun z => if k.val ≥ 1 then a_s k / (z - s) ^ (k.val + 1) else 0) = - fun z => a_s k / (z - s) ^ (k.val + 1) := by ext z; simp [hk] + fun z => a_s k / (z - s) ^ (k.val + 1) := by ext z; simp only [ge_iff_le, hk, ↓reduceIte] simp_rw [h_eq]; exact h_polar_term_tendsto k hk · have h_eq : (fun z => if k.val ≥ 1 then a_s k / (z - s) ^ (k.val + 1) else 0) = - fun _ => (0 : ℂ) := by ext z; simp [hk] + fun _ => (0 : ℂ) := by ext z; simp only [ge_iff_le, hk, ↓reduceIte] simp_rw [h_eq, cauchyPrincipalValueIntegrandOn, zero_mul, ite_self, intervalIntegral.integral_zero] exact tendsto_const_nhds) diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/PerTermVanishing.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/PerTermVanishing.lean index 2969e5fe3d..a9e0b20352 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/PerTermVanishing.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/PerTermVanishing.lean @@ -16,7 +16,6 @@ import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Per-Term PV Vanishing and CPV Helpers @@ -372,7 +371,7 @@ private lemma aesm_zpow_on_singleFar ({t | ε < ‖γ.toFun t - s‖} ∩ Icc γ.a γ.b) Set.inter_subset_right (fun t ⟨ht_far, _⟩ => sub_ne_zero.mpr (fun heq => by have : ε < ‖γ.toFun t - s‖ := ht_far - rw [heq, sub_self, norm_zero] at this; linarith)) + rw [heq, sub_self, norm_zero] at this; linarith only [hε, this])) exact (hf_cont.aestronglyMeasurable hSF_meas).mul ((aesm_deriv_on_Icc γ).mono_measure (Measure.restrict_mono Set.inter_subset_right le_rfl)) @@ -445,7 +444,7 @@ private lemma zpow_deriv_norm_bound_of_dist_ge B⁻¹ ^ m * (|Mγ'| + 1) := by refine (norm_mul_le _ _).trans (mul_le_mul ?_ ?_ (norm_nonneg _) (by positivity)) · rw [norm_zpow, zpow_neg, zpow_natCast, inv_pow] - exact inv_anti₀ (by positivity) (pow_le_pow_left₀ hB.le h_far m) + exact inv_anti₀ (by exact pow_pos hB m) (pow_le_pow_left₀ hB.le h_far m) · exact ((hMγ' t ht).trans (le_abs_self _)).trans (le_add_of_nonneg_right one_pos.le) /-- Norm bound for the zpow integrand: if `‖γ(t) - s‖ > ε` then diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/PerTermVanishing/CPVHelpers.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/PerTermVanishing/CPVHelpers.lean index 486cb0e3b4..8179feda03 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/PerTermVanishing/CPVHelpers.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/FlatnessTransfer/PerTermVanishing/CPVHelpers.lean @@ -14,7 +14,6 @@ import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Per-Term PV Vanishing: CPV Helpers and Assembly @@ -399,7 +398,7 @@ lemma residueAt_sub_residueSum_eq_zero mul_ne_zero (mul_ne_zero two_ne_zero (Complex.ofReal_ne_zero.mpr Real.pi_ne_zero)) I_ne_zero set R₀ := ρ / 2 with hR₀_def have hR₀_pos : 0 < R₀ := by positivity - have hR₀_lt_ρ : R₀ < ρ := by linarith + have hR₀_lt_ρ : R₀ < ρ := by linarith only [hR₀_def, hR₀_pos] have hR₀_lt_δ : R₀ < δ := lt_of_lt_of_le hR₀_lt_ρ (min_le_left _ _) have hR₀_lt_rf : R₀ < rf := lt_of_lt_of_le hR₀_lt_ρ (min_le_right _ _) have hR₀_ne : R₀ ≠ 0 := ne_of_gt hR₀_pos @@ -441,7 +440,7 @@ lemma residueAt_sub_residueSum_eq_zero apply sub_ne_zero.mpr; intro heq rw [heq] at hz have h_dist := hδ_sep p (Finset.mem_of_mem_erase hp) (Finset.ne_of_mem_erase hp) - rw [Metric.mem_closedBall] at hz; linarith + rw [Metric.mem_closedBall] at hz; linarith only [hR₀_lt_δ, hr_lt, hz, h_dist] rw [circleIntegral.integral_sub hf_ci hsum_ci, circleIntegral_simple_pole_sum S0 (residueAt f) s hs r hr_pos h_no_pole_on_sphere h_no_pole_in_cb, diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/GeneralizedTheorem.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/GeneralizedTheorem.lean index 1207a72bc3..835f65d58e 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/GeneralizedTheorem.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/GeneralizedTheorem.lean @@ -10,7 +10,6 @@ public import LeanPool.LeanModularForms.GeneralizedResidueTheory.GeneralizedResi import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Residue/GeneralizedTheorem (legacy stub) diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/GeneralizedTheoremBase.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/GeneralizedTheoremBase.lean index a97f629fee..a61fcd0be1 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/GeneralizedTheoremBase.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/GeneralizedTheoremBase.lean @@ -15,7 +15,6 @@ import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Generalized Residue Theorem -- Base Infrastructure @@ -169,7 +168,7 @@ private lemma cpv_cauchy_of_sum_and_regular (S0 : Finset ℂ) (f : ℂ → ℂ) exact multipointPV_diff_tendsto S0 f γ (cpv_crossing_null S0 γ) g_reg hg_decomp hg_reg_cont hS0_sep have h_M_tendsto : Tendsto M (𝓝[>] 0) (𝓝 (L + G)) := by - have h_eq : M = fun ε => S' ε + A ε := by ext ε; simp [M, A, S'] + have h_eq : M = fun ε => S' ε + A ε := by ext ε; simp only [gt_iff_lt, add_sub_cancel, M, S', A] rw [h_eq] exact h_sum_tendsto.add h_A_tendsto exact h_M_tendsto.cauchy_map @@ -402,7 +401,7 @@ private lemma generalizedResidueTheorem'_crossing_formula _ = 2 * Real.pi * I * ∑ s ∈ S0, generalizedWindingNumber' γ.toFun γ.a γ.b s * residueSimplePole f s := by - rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro s _; ring + rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro s _; ac_rfl /-- Generalized residue theorem: CPV equals `2πi · Σ winding · residue` even when γ crosses poles. -/ diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MathlibBridge.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MathlibBridge.lean index 586ed10411..3c9c325e7e 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MathlibBridge.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MathlibBridge.lean @@ -11,7 +11,6 @@ import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Bridge: Project `residueAt` and Mathlib `MeromorphicAt` diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MeromorphicLaurent.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MeromorphicLaurent.lean index a2729c7256..166a96cced 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MeromorphicLaurent.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MeromorphicLaurent.lean @@ -11,7 +11,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.HomologicalCauchy.Mero import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Convex-Domain Contour Vanishing for Meromorphic Functions diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MeromorphicPrincipalPart.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MeromorphicPrincipalPart.lean index 6af33b2866..e27fa52d95 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MeromorphicPrincipalPart.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MeromorphicPrincipalPart.lean @@ -15,7 +15,6 @@ import Mathlib.Analysis.Meromorphic.NormalForm import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Meromorphic Laurent Principal Parts @@ -176,7 +175,7 @@ private theorem taylor_remainder_factored (G : ℂ → ℂ) (s : ℂ) (N : ℕ) have hP_eq : P z = ∑ i ∈ Finset.range N, c i := by rw [hP_def] simp only [c, pG, FormalMultilinearSeries.coeff_ofScalars] - congr 1; ext k; ring + congr 1; ext k; ac_rfl rw [hP_eq] rw [← hG_tail.tsum_eq] rw [← hH_z.tsum_eq, ← tsum_mul_left] @@ -222,7 +221,7 @@ theorem meromorphicAt_sub_principalPart_eventually (f : ℂ → ℂ) (s : ℂ) rw [show (z - s) ^ ((k : ℤ) - (poleOrderNat f s : ℤ)) = (z - s) ^ (-(poleOrderNat f s : ℤ)) * (z - s) ^ (k : ℕ) from by rw [← zpow_natCast (z - s) k, ← zpow_add₀ hne]; congr 1; omega] - ring + ac_rfl have h_taylor : ∃ H : ℂ → ℂ, AnalyticAt ℂ H s ∧ ∀ᶠ z in 𝓝 s, G z - P z = (z - s) ^ N • H z := taylor_remainder_factored G s N hG_an P rfl hP_an @@ -234,7 +233,9 @@ theorem meromorphicAt_sub_principalPart_eventually (f : ℂ → ℂ) (s : ℂ) simp only [smul_eq_mul] at hf_z hH_z ⊢ rw [hf_z, hpp_z]; simp only [h_ord_eq] rw [← mul_sub, hH_z] - simp_all + simp_all only [ne_eq, zpow_neg, zpow_natCast, smul_eq_mul, Int.neg_neg_iff_pos, Int.natCast_pos, + mem_compl_iff, mem_singleton_iff, pow_eq_zero_iff', false_and, not_false_eq_true, + inv_mul_cancel_left₀] · have h_pp : meromorphicPrincipalPart f s = fun _ => 0 := by unfold meromorphicPrincipalPart rw [dite_eq_right (not_and_of_not_right _ h_neg)] @@ -265,7 +266,7 @@ private theorem hasDerivAt_zpow_comp_sub' (hγ : HasDerivAt γ L t) (hne : γ t ≠ s) : HasDerivAt (fun t => (γ t - s) ^ n) (↑n * (γ t - s) ^ (n - 1) * L) t := by have h := (hasDerivAt_zpow n (γ t - s) (Or.inl (sub_ne_zero.mpr hne))).comp t (hγ.sub_const s) - exact h.congr_deriv (by ring) + exact h.congr_deriv (by ac_rfl) /-- FTC for the integral of `(γ(t) - s)^n * γ'(t)` on `[a, b]` when `γ(t) ≠ s` on `[a, b]` and `n ≠ -1`. The primitive is `(γ(t) - s)^{n+1} / (n+1)`. -/ @@ -342,7 +343,7 @@ theorem contourIntegral_const_mul_zpow_eq_zero (s : ℂ) (n : ℤ) (hn : n ≤ - (hγ_avoids : ∀ t ∈ Icc γ.a γ.b, γ.toFun t ≠ s) : ∫ t in γ.a..γ.b, c * (γ.toFun t - s) ^ n * deriv γ.toFun t = 0 := by simp_rw [show ∀ t, c * (γ.toFun t - s) ^ n * deriv γ.toFun t = - c * ((γ.toFun t - s) ^ n * deriv γ.toFun t) from fun t => by ring] + c * ((γ.toFun t - s) ^ n * deriv γ.toFun t) from fun t => by ac_rfl] erw [intervalIntegral.integral_const_mul, contourIntegral_zpow_eq_zero s n hn γ hγ_closed hγ_avoids] simp only [mul_zero] diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MultipointPV.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MultipointPV.lean index eb98ce8c2c..18b7ef2267 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MultipointPV.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MultipointPV.lean @@ -8,7 +8,6 @@ module public import LeanPool.LeanModularForms.GeneralizedResidueTheory.Residue import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch import Mathlib.MeasureTheory.Integral.DominatedConvergence import Mathlib.Tactic.Positivity.Finset @@ -121,7 +120,7 @@ private lemma measurableSet_multipoint_condition {γ : ℝ → ℂ} {a b ε : ext t; simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, Set.mem_sdiff, not_and] constructor · intro ⟨h_le, ht_Icc⟩; exact ⟨ht_Icc, fun h_gt => absurd h_gt (not_lt.mpr h_le)⟩ - · intro ⟨ht_Icc, h_not⟩; simp_all + · intro ⟨ht_Icc, h_not⟩; simp_all only [mem_Icc, and_self, not_true_eq_false, imp_false, not_lt] rw [h_eq']; exact isClosed_Icc.measurableSet.diff h_compl_meas private lemma measurableSet_multipoint_goodset {γ : ℝ → ℂ} {a b ε : ℝ} (S : Finset ℂ) @@ -223,7 +222,7 @@ private theorem isClosed_Icc.measurableSet] with t ht simp only [Set.piecewise, Set.mem_inter_iff, Set.mem_ofPred_eq, gt_iff_lt] - simp_all + simp_all only [mem_Icc, and_self, and_true] private lemma aEStronglyMeasurable_singularSum_on_goodset {γ : ℝ → ℂ} {a b ε : ℝ} @@ -446,7 +445,7 @@ lemma intervalIntegrable_cauchyPrincipalValueIntegrandOn {S0 : Finset ℂ} {f : · exact le_trans (hMf _ (Set.mem_image_of_mem _ ht)) (le_abs_self _) · exact le_trans (hMγ' t ht) (le_abs_self _) · exact norm_nonneg _ - · positivity + · exact abs_nonneg Mf _ ≤ |Mf| * |Mγ'| + 1 := by linarith only [] let M := |Mf| * |Mγ'| + 1 have h_meas : diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MultipointPV/DominatedConvergence.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MultipointPV/DominatedConvergence.lean index 1b68945b9c..bba552b071 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MultipointPV/DominatedConvergence.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/MultipointPV/DominatedConvergence.lean @@ -9,7 +9,6 @@ public import LeanPool.LeanModularForms.GeneralizedResidueTheory.Residue import LeanPool.LeanModularForms.GeneralizedResidueTheory.Residue.MultipointPV import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch import Mathlib.Tactic.Positivity.Finset /-! @@ -59,7 +58,7 @@ private lemma γt_not_mem_S0_of_all_far {S0 : Finset ℂ} {γ : ℝ → ℂ} {t (hε : 0 < ε) (hall : ∀ s ∈ S0, ε < ‖γ t - s‖) : γ t ∉ (S0 : Set ℂ) := by intro h_in; simp only [Finset.mem_coe] at h_in - have := hall (γ t) h_in; simp only [sub_self, norm_zero] at this; linarith + have := hall (γ t) h_in; simp only [sub_self, norm_zero] at this; linarith only [hε, this] private lemma residue_sum_ifs_eq_mul_deriv {S0 : Finset ℂ} {f : ℂ → ℂ} {γ : ℝ → ℂ} {t : ℝ} {ε : ℝ} (hall : ∀ s ∈ S0, ε < ‖γ t - s‖) : @@ -149,7 +148,8 @@ private lemma pointwise_ae_limit_off_crossing (S0 : Finset ℂ) (f g_reg : ℂ f (γ.toFun t) * deriv γ.toFun t := by simp only [cauchyPrincipalValueIntegrandOn]; rw [ite_eq_right]; push Not; exact hall_far rw [hM_eval, residue_sum_ifs_eq_mul_deriv hall_far, ← sub_mul] - simp_all + simp_all only [ne_eq, mem_Icc, SetLike.mem_coe, not_false_eq_true, norm_pos_iff, + add_sub_cancel_right] _ = 0 := h_crossing_null /-! ## Dominated Convergence: Norm Bounds -/ @@ -238,7 +238,7 @@ private lemma norm_A_int_bound_some_near (S0 : Finset ℂ) (f : ℂ → ℂ) (γ then residueSimplePole f s / (γ.toFun t - s) * deriv γ.toFun t else 0) = (∑ s ∈ S0, if ‖γ.toFun t - s‖ > ε then residueSimplePole f s / (γ.toFun t - s) else 0) * deriv γ.toFun t := by - rw [Finset.sum_mul]; simp_all + rw [Finset.sum_mul]; simp_all only [mem_Icc, and_imp, ne_eq, gt_iff_lt, ite_mul, zero_mul] rw [h_factor] let singularBound := 2 * (S0.card : ℝ) * Mc / δ have h_sum_bound : ‖∑ s ∈ S0, if ‖γ.toFun t - s‖ > ε @@ -348,7 +348,7 @@ private lemma pvIntegrand_intervalIntegrable_of_nonempty (S0 : Finset ℂ) (f g_ have h_bound : ∀ t ∈ Icc γ.a γ.b, ‖cauchyPrincipalValueIntegrandOn S0 f γ.toFun ε t‖ ≤ Mb := by intro t ht; simp only [cauchyPrincipalValueIntegrandOn]; split_ifs with h - · simp only [norm_zero]; linarith + · simp only [norm_zero]; exact le_of_lt hMb_pos · push Not at h have hγt_notin : γ.toFun t ∉ (S0 : Set ℂ) := by intro hmem; simp only [Finset.mem_coe] at hmem @@ -425,7 +425,9 @@ private lemma A_eq_integral_A_int (S0 : Finset ℂ) (f g_reg : ℂ → ℂ) (γ intro S; induction S using Finset.induction_on with | empty => intro _; simp only [Finset.sum_empty]; exact intervalIntegrable_const | insert s' S'' hs'' ih => - intro h_all; simp_all + intro h_all; simp_all only [ne_eq, SetLike.mem_coe, gt_iff_lt, Finset.mem_insert, or_true, + implies_true, forall_const, forall_eq_or_imp, not_false_eq_true, Finset.sum_insert, + IntervalIntegrable.add] exact this S0 hS_int rw [h_sum_eq, ← intervalIntegral.integral_sub hM_int hSum_int] diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/SectorCurve.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/SectorCurve.lean index d9a35406b1..0f225538e3 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/SectorCurve.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/SectorCurve.lean @@ -73,7 +73,8 @@ def sectorCurve (r : ℝ) (α : ℝ) (t : ℝ) : ℂ := /-- The sector curve at t=0 is 0. -/ theorem sectorCurve_zero (r : ℝ) (α : ℝ) : - sectorCurve r α 0 = 0 := by simp [sectorCurve] + sectorCurve r α 0 = 0 := by simp only [sectorCurve, zero_le_one, ↓reduceIte, zero_mul, + ofReal_zero] /-- The sector curve at t=3 is 0. -/ theorem sectorCurve_three (r : ℝ) (α : ℝ) : @@ -98,13 +99,14 @@ theorem sectorCurve_two (r : ℝ) (α : ℝ) : /-- Segment 1: for t in [0,1], the sector curve is `t * r`. -/ theorem sectorCurve_seg1 (r : ℝ) (α : ℝ) (t : ℝ) (ht : t ∈ Icc 0 1) : - sectorCurve r α t = ↑(t * r) := by simp [sectorCurve, ht.2] + sectorCurve r α t = ↑(t * r) := by simp only [sectorCurve, ht.2, ↓reduceIte, ofReal_mul] /-- Segment 2: for t in [1,2], the sector curve is `r * exp(i*(t-1)*alpha)`. -/ theorem sectorCurve_seg2 (r : ℝ) (α : ℝ) (t : ℝ) (ht : t ∈ Icc 1 2) : sectorCurve r α t = ↑r * exp (I * ↑((t - 1) * α)) := by rcases eq_or_lt_of_le ht.1 with rfl | h1 - · simp [sectorCurve, Complex.exp_zero] + · simp only [sectorCurve, Std.le_refl, ↓reduceIte, one_mul, sub_self, zero_mul, ofReal_zero, + mul_zero, exp_zero, mul_one] · simp only [sectorCurve, ite_eq_right (not_le.mpr h1), ite_eq_left ht.2] /-- Segment 3: for t in [2,3], the sector curve is `(3-t)*r * exp(i*alpha)`. -/ @@ -194,7 +196,7 @@ theorem deriv_sectorCurve_seg2 (r : ℝ) (α : ℝ) (t : ℝ) (ht : t ∈ Ioo 1 (↑r * (I * ↑α * exp (I * ↑((t - 1) * α)))) t := by have := (hasDerivAt_const t (↑r : ℂ)).mul h_exp exact this.congr_deriv (by ring) - rw [h_full.deriv]; ring + rw [h_full.deriv]; ac_rfl /-- Derivative on segment 3 (t in (2,3)): `deriv (sectorCurve r alpha) t = -r * exp(I * alpha)`. -/ @@ -215,7 +217,7 @@ theorem deriv_sectorCurve_seg3 (r : ℝ) (α : ℝ) (t : ℝ) (ht : t ∈ Ioo 2 have h_full : HasDerivAt (fun s => ↑((3 - s) * r) * exp (I * ↑α)) (↑(-r) * exp (I * ↑α)) t := h_inner.mul_const _ - rw [h_full.deriv]; push_cast; ring + rw [h_full.deriv]; push_cast; ac_rfl /-! ### PV integrand analysis -/ @@ -303,7 +305,7 @@ theorem log_cancellation (r : ℝ) (hr : 0 < r) (ε : ℝ) (hε : 0 < ε) (hεr have h2c : ∫ t in (2 : ℝ)..(3 - ε / r), (-(↑((3 - t)⁻¹)) : ℂ) = ↑(Real.log (ε / r)) := by have : ∀ t : ℝ, (-(↑((3 - t)⁻¹) : ℂ)) = (↑((-((3 - t)⁻¹)) : ℝ)) := by - intro t; push_cast; ring + intro t; push_cast; ac_rfl simp_rw [this, intervalIntegral.integral_ofReal, h2] rw [h1c, h2c, ← Complex.ofReal_add, neg_add_cancel, Complex.ofReal_zero] @@ -363,7 +365,7 @@ private theorem pv_cutoff_F_integrable_delta_1 (r : ℝ) (hr : 0 < r) (α : ℝ) · exact pv_integrand_seg1 r hr α t ⟨lt_trans hδ htδ, ht1⟩ · rw [sectorCurve_norm_seg1 r hr α t ⟨le_of_lt (lt_trans hδ htδ), le_of_lt ht1⟩] calc ε = δ * r := by rw [hδ_def]; field_simp - _ < t * r := by nlinarith + _ < t * r := by nlinarith only [hr, htδ] have h_g_Ioo : IntegrableOn (fun t : ℝ => (↑(t⁻¹) : ℂ)) (Ioo δ 1) volume := (intervalIntegrable_iff.mp hcont.intervalIntegrable).mono_set (by rw [Set.uIoc_of_le hδ1.le]; exact Ioo_subset_Ioc_self) @@ -390,7 +392,7 @@ private theorem pv_cutoff_F_integrable_1_2 (r : ℝ) (hr : 0 < r) (α : ℝ) (ε field_simp · rw [sectorCurve_seg2 r α t ⟨le_of_lt ht1, le_of_lt ht2⟩] simp only [norm_mul, Complex.norm_exp_I_mul_ofReal, mul_one] - rw [Complex.norm_of_nonneg (le_of_lt hr)]; linarith + rw [Complex.norm_of_nonneg (le_of_lt hr)]; exact hεr have h_const_Ioo : IntegrableOn (fun (_ : ℝ) => I * (↑α : ℂ)) (Ioo (1 : ℝ) 2) volume := (intervalIntegrable_iff.mp (intervalIntegrable_const : IntervalIntegrable (fun _ => I * (↑α : ℂ)) volume 1 2)).mono_set @@ -420,12 +422,12 @@ private theorem pv_cutoff_F_integrable_2_3delta (r : ℝ) (hr : 0 < r) (α : ℝ deriv_sectorCurve_seg3 r α t ⟨ht2, h3⟩] have : (r : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (ne_of_gt hr) have : exp (I * ↑α) ≠ 0 := Complex.exp_ne_zero _ - have : (3 - t : ℝ) ≠ 0 := by linarith + have : (3 - t : ℝ) ≠ 0 := by exact ne_of_gt (sub_pos_of_lt h3) push_cast; field_simp · have h3 : t < 3 := by linarith rw [sectorCurve_norm_seg3' r hr α t ⟨le_of_lt ht2, le_of_lt h3⟩] calc ε = δ * r := by rw [hδ_def]; field_simp - _ < (3 - t) * r := by nlinarith + _ < (3 - t) * r := by nlinarith only [hr, ht3δ] have hcont : ContinuousOn (fun t : ℝ => -(↑((3 - t)⁻¹) : ℂ)) (Set.uIcc 2 (3 - δ)) := by rw [Set.uIcc_of_le h3δ.le] intro t ht @@ -513,7 +515,7 @@ private theorem pv_cutoff_integral_seg1_eq_inv (r : ℝ) (hr : 0 < r) (α : ℝ) push_cast; field_simp · rw [sectorCurve_norm_seg1 r hr α t ⟨le_of_lt (lt_trans hδ htδ), le_of_lt ht1⟩] calc ε = δ * r := by rw [hδ_def]; field_simp - _ < t * r := by nlinarith + _ < t * r := by nlinarith only [hr, htδ] apply intervalIntegral.integral_congr_ae filter_upwards [(Filter.eventuallyEqSet_iff.mp Ioo_ae_eq_Ioc)] with t ht rw [Set.uIoc_of_le (le_of_lt hδ1)] @@ -536,7 +538,7 @@ private theorem pv_cutoff_integral_seg2_eq_Ialpha (r : ℝ) (hr : 0 < r) (α : field_simp · rw [sectorCurve_seg2 r α t ⟨le_of_lt ht1, le_of_lt ht2⟩] simp only [norm_mul, Complex.norm_exp_I_mul_ofReal, mul_one] - rw [Complex.norm_of_nonneg (le_of_lt hr)]; linarith + rw [Complex.norm_of_nonneg (le_of_lt hr)]; exact hεr have h_ae : ∀ᵐ t, t ∈ Ι 1 2 → F t = I * ↑α := by filter_upwards [(Filter.eventuallyEqSet_iff.mp Ioo_ae_eq_Ioc)] with t ht rw [Set.uIoc_of_le (by norm_num : (1 : ℝ) ≤ 2)] @@ -565,12 +567,12 @@ private theorem pv_cutoff_integral_seg3_eq_neg_inv (r : ℝ) (hr : 0 < r) (α : deriv_sectorCurve_seg3 r α t ⟨ht2, h3⟩] have : (r : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (ne_of_gt hr) have : exp (I * ↑α) ≠ 0 := Complex.exp_ne_zero _ - have : (3 - t : ℝ) ≠ 0 := by linarith + have : (3 - t : ℝ) ≠ 0 := by exact ne_of_gt (sub_pos_of_lt h3) push_cast; field_simp · have h3 : t < 3 := by linarith rw [sectorCurve_norm_seg3' r hr α t ⟨le_of_lt ht2, le_of_lt h3⟩] calc ε = δ * r := by rw [hδ_def]; field_simp - _ < (3 - t) * r := by nlinarith + _ < (3 - t) * r := by nlinarith only [hr, ht3δ] apply intervalIntegral.integral_congr_ae filter_upwards [(Filter.eventuallyEqSet_iff.mp Ioo_ae_eq_Ioc)] with t ht rw [Set.uIoc_of_le (le_of_lt h3δ)] diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/SectorCurveLemma.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/SectorCurveLemma.lean index 5ed07b1985..fb90966c50 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/SectorCurveLemma.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/Residue/SectorCurveLemma.lean @@ -15,7 +15,6 @@ import Mathlib.Analysis.SpecialFunctions.ExpDeriv import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch import Mathlib.MeasureTheory.Integral.DivergenceTheorem import Mathlib.MeasureTheory.Integral.DominatedConvergence @@ -151,7 +150,7 @@ private theorem sectorCurve_mem_ball (r : ℝ) (hr : 0 < r) (α : ℝ) : rcases le_or_gt t 1 with h1 | h1 · rw [sectorCurve_seg1 r α t ⟨ht0, h1⟩, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (mul_nonneg ht0 hr.le)] - nlinarith + nlinarith only [hr, h1] · rcases le_or_gt t 2 with h2 | h2 · rw [sectorCurve_seg2 r α t ⟨le_of_lt h1, h2⟩, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hr, @@ -159,9 +158,9 @@ private theorem sectorCurve_mem_ball (r : ℝ) (hr : 0 < r) (α : ℝ) : linarith · rw [sectorCurve_seg3 r α t ⟨le_of_lt h2, ht3⟩, norm_mul, Complex.norm_real, Real.norm_eq_abs, - abs_of_nonneg (mul_nonneg (by linarith) hr.le), + abs_of_nonneg (mul_nonneg (by exact sub_nonneg.mpr ht3) hr.le), norm_exp_I, mul_one] - nlinarith + nlinarith only [hr, h2] private theorem φ_sectorCurve_integrableOn_01 (r : ℝ) (hr : 0 < r) (α : ℝ) (g : ℂ → ℂ) (hg : AnalyticOnNhd ℂ g (Metric.ball 0 (↑r + 1))) : @@ -301,12 +300,13 @@ private theorem sectorCurve_zero_set_finite (r : ℝ) (hr : 0 < r) (α : ℝ) : simp [(mul_eq_zero.mp h0).resolve_right hr.ne'] · rcases le_or_gt t 2 with h2 | h2 · exfalso; rw [sectorCurve_seg2 r α t ⟨le_of_lt h1, h2⟩] at h0 - simp_all + simp_all only [ofReal_mul, ofReal_sub, ofReal_one, mul_eq_zero, ofReal_eq_zero, exp_ne_zero, + or_false, lt_self_iff_false] · rw [sectorCurve_seg3 r α t ⟨le_of_lt h2, ht3⟩] at h0 simp only [mul_eq_zero, Complex.ofReal_eq_zero] at h0 exact h0.elim (fun h => by rcases h with h | h - · simp [show t = 3 from by linarith] + · simp [show t = 3 from by linarith only [ht3, h] ] · exact absurd h hr.ne') (fun h => absurd h (Complex.exp_ne_zero _)) private theorem cauchyPV_g_intervalIntegrable (r : ℝ) (hr : 0 < r) (α : ℝ) @@ -367,7 +367,7 @@ private theorem cauchyPV_inv_integrableOn_δ1 (r : ℝ) (hr : 0 < r) (α : ℝ) · rw [sectorCurve_norm_seg1 r hr α t ⟨le_of_lt (lt_trans hδ htδ), le_of_lt ht1⟩] have hδr : δ * r = ε := div_mul_cancel₀ ε (ne_of_gt hr) calc ε = δ * r := hδr.symm - _ < t * r := by nlinarith + _ < t * r := by nlinarith only [hr, htδ] have h1 : ∀ᵐ t ∂(volume.restrict (Ioo δ 1)), (fun t : ℝ => (↑(t⁻¹) : ℂ)) t = cauchyPrincipalValueIntegrand' (fun z => z⁻¹) (sectorCurve r α) 0 ε t := @@ -426,10 +426,10 @@ private theorem cauchyPV_inv_integrableOn_2_3δ (r : ℝ) (hr : 0 < r) (α : ℝ have : exp (I * ↑α) ≠ 0 := Complex.exp_ne_zero _ have : (3 - t : ℝ) ≠ 0 := by linarith push_cast; field_simp - · rw [sectorCurve_norm_seg3' r hr α t ⟨le_of_lt ht2, by linarith⟩] + · rw [sectorCurve_norm_seg3' r hr α t ⟨le_of_lt ht2, by linarith only [hδ, ht3δ]⟩] have hδr : δ * r = ε := div_mul_cancel₀ ε (ne_of_gt hr) calc ε = δ * r := hδr.symm - _ < (3 - t) * r := by nlinarith + _ < (3 - t) * r := by nlinarith only [hr, ht3δ] have h1 : ∀ᵐ t ∂(volume.restrict (Ioo (2 : ℝ) (3 - δ))), (fun t : ℝ => -(↑((3 - t)⁻¹) : ℂ)) t = cauchyPrincipalValueIntegrand' (fun z => z⁻¹) (sectorCurve r α) 0 ε t := @@ -532,7 +532,7 @@ theorem cauchyPV_sectorCurve_simplePole (r : ℝ) (hr : 0 < r) (α : ℝ) have h_tendsto : Tendsto (fun ε => ∫ t in (0 : ℝ)..3, cauchyPrincipalValueIntegrand' (fun z => c / z + g z) (sectorCurve r α) 0 ε t) (𝓝[>] 0) (𝓝 (I * ↑α * c)) := by - rw [show I * ↑α * c = c * (I * ↑α) + 0 from by ring] + rw [show I * ↑α * c = c * (I * ↑α) + 0 from by ac_rfl] exact ((hL_inv.const_mul c).add (cauchyPV_g_tendsto_zero r hr α g hg)).congr' ((cauchyPV_simplePole_integral_split r hr α c g hg).mono (fun _ h => h.symm)) exact ⟨⟨_, h_tendsto⟩, h_tendsto.limUnder_eq⟩ @@ -719,7 +719,7 @@ private theorem zpow_primitive_hasDerivAt (r : ℝ) (hr : 0 < r) (α : ℝ) (n : HasDerivAt F (f t) t := by intro m γ F f t ⟨ht, ht_not⟩ have hm_ne : (m : ℂ) ≠ 0 := by - have : m ≠ 0 := by simp [m]; omega + have : m ≠ 0 := by simp only [ne_eq, m]; omega exact_mod_cast this have ht_not' : t ∉ ({1, 2} : Set ℝ) := fun h => ht_not ⟨h, ht⟩ have hγ_ne := sectorCurve_ne_zero_of_Icc_δ r hr α δ hδ_pos @@ -728,8 +728,8 @@ private theorem zpow_primitive_hasDerivAt (r : ℝ) (hr : 0 < r) (α : ℝ) (n : (((m : ℂ) * (γ t) ^ (m - 1)) • deriv γ t) t := (hasDerivAt_zpow m (γ t) (Or.inl hγ_ne)).comp t (sectorCurve_differentiableAt_off_knots r α t - ⟨lt_trans hδ_pos ht.1, lt_of_lt_of_le ht.2 (by linarith)⟩ ht_not').hasDerivAt - have hm_sub : m - 1 = -(↑n : ℤ) := by simp [m] + ⟨lt_trans hδ_pos ht.1, lt_of_lt_of_le ht.2 (by linarith only [hδ_pos])⟩ ht_not').hasDerivAt + have hm_sub : m - 1 = -(↑n : ℤ) := by simp only [sub_sub_cancel_left, m] change HasDerivAt F ((γ t) ^ (-(↑n : ℤ)) * deriv γ t) t refine (h_zpow.div_const (m : ℂ)).congr_deriv ?_ rw [smul_eq_mul, mul_assoc, mul_div_cancel_left₀ _ hm_ne, hm_sub] @@ -749,7 +749,7 @@ private theorem zpow_ftc_vanishes (r : ℝ) (_hr : 0 < r) (α : ℝ) (n : ℕ) ( simp only [show 3 - (3 - δ) = δ from by ring] at this; exact this simp only [F, hγ_δ, hγ_3δ, mul_zpow] rw [show (exp (I * ↑α)) ^ m = exp (I * ↑((1 - (↑n : ℤ)) * α)) from by - rw [← Complex.exp_int_mul]; congr 1; push_cast [m]; ring, h_exp_one, mul_one, sub_self] + rw [← Complex.exp_int_mul]; congr 1; push_cast [m]; ac_rfl, h_exp_one, mul_one, sub_self] private theorem angle_condition_exp_eq_one (n : ℕ) (hn : 2 ≤ n) (α : ℝ) (k : ℤ) (hk : (↑(n - 1) : ℤ) * α = k * (2 * Real.pi)) : @@ -758,10 +758,10 @@ private theorem angle_condition_exp_eq_one (n : ℕ) (hn : 2 ≤ n) (α : ℝ) obtain ⟨j, hj⟩ := h; rw [hj]; exact Complex.exp_int_mul_two_pi_mul_I j exact ⟨-k, by have h1 : ((1 - (↑n : ℤ)) * α : ℝ) = ((-k : ℤ) : ℝ) * (2 * Real.pi) := by - push_cast [Nat.cast_sub (by omega : 1 ≤ n)] at hk ⊢; linarith + push_cast [Nat.cast_sub (by omega : 1 ≤ n)] at hk ⊢; linarith only [hk] rw [show (↑((1 - (↑n : ℤ)) * α) : ℂ) = ↑(((-k : ℤ) : ℝ) * (2 * Real.pi)) from congrArg _ h1] - push_cast; ring⟩ + push_cast; ac_rfl⟩ private theorem pv_cutoff_integral_eq_mid (r : ℝ) (hr : 0 < r) (α : ℝ) (n : ℕ) (ε : ℝ) (hε_pos : 0 < ε) (hε_lt_r : ε < r) : @@ -790,7 +790,7 @@ private theorem pv_cutoff_integral_eq_mid (r : ℝ) (hr : 0 < r) (α : ℝ) (n : rw [ite_eq_right (not_lt.mpr (h_norm_le_0δ t ht))] have hg_zero_right : ∀ t ∈ Set.uIcc (3 - δ) 3, g t = 0 := fun t ht => by simp only [g, sub_zero] - rw [Set.uIcc_of_le (by linarith : 3 - δ ≤ 3)] at ht + rw [Set.uIcc_of_le (by linarith only [hδ_pos] : 3 - δ ≤ 3)] at ht rw [ite_eq_right (not_lt.mpr (h_norm_le_3δ3 t ht))] have hg_eq_f_mid : ∀ᵐ x ∂volume, x ∈ Ioc δ (3 - δ) → g x = f x := by rw [ae_iff] @@ -811,9 +811,9 @@ private theorem pv_cutoff_integral_eq_mid (r : ℝ) (hr : 0 < r) (α : ℝ) (n : hg_zero_right t (Set.uIoc_subset_uIcc ht))) have h_mid : ∫ t in δ..(3 - δ), g t = ∫ t in δ..(3 - δ), f t := intervalIntegral.integral_congr_ae (by - rw [Set.uIoc_of_le (by linarith : δ ≤ 3 - δ)]; exact hg_eq_f_mid) + rw [Set.uIoc_of_le (by linarith only [hδ_pos, hδ_lt_1] : δ ≤ 3 - δ)]; exact hg_eq_f_mid) have hg_eq_f_mid' : g =ᵐ[volume.restrict (Set.uIoc δ (3 - δ))] f := by - rw [Set.uIoc_of_le (by linarith : δ ≤ 3 - δ), Filter.EventuallyEq, + rw [Set.uIoc_of_le (by linarith only [hδ_pos, hδ_lt_1] : δ ≤ 3 - δ), Filter.EventuallyEq, ae_restrict_iff' measurableSet_Ioc]; exact hg_eq_f_mid have hg_0δ : IntervalIntegrable g volume 0 δ := (intervalIntegrable_const (c := (0 : ℂ))).congr_ae diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber.lean index 2049ec509b..8b24594b20 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber.lean @@ -11,7 +11,6 @@ public import LeanPool.LeanModularForms.GeneralizedResidueTheory.WindingNumber.D import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Winding Number Theory diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/CrossingAnalysis.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/CrossingAnalysis.lean index 1f663affa3..d338395951 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/CrossingAnalysis.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/CrossingAnalysis.lean @@ -14,7 +14,6 @@ import Mathlib.Analysis.SpecialFunctions.ExpDeriv import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus /-! @@ -56,7 +55,7 @@ valid even when `a = 0`. -/ private lemma inner_div_norm_complex (a b : ℂ) : inner (𝕜 := ℝ) a b / ‖a‖ = inner (𝕜 := ℝ) (a / ↑‖a‖) b := by have ha : a / ↑‖a‖ = (‖a‖⁻¹ : ℝ) • a := by - simp only [div_eq_mul_inv, Complex.real_smul, Complex.ofReal_inv]; ring + simp only [div_eq_mul_inv, Complex.real_smul, Complex.ofReal_inv]; ac_rfl rw [ha]; erw [real_inner_smul_left]; ring /-- Polar form: a nonzero complex number divided by its norm equals `exp(arg · I)`. -/ @@ -228,7 +227,7 @@ lemma piecewiseC1Immersion_norm_strictMono_near_crossing have hLR_inner : ‖L_R‖ = inner (𝕜 := ℝ) (L_R / ↑‖L_R‖) L_R := by have hsmul : L_R / ↑‖L_R‖ = (‖L_R‖⁻¹ : ℝ) • L_R := by - simp only [div_eq_mul_inv, Complex.real_smul, Complex.ofReal_inv]; ring + simp only [div_eq_mul_inv, Complex.real_smul, Complex.ofReal_inv]; ac_rfl rw [hsmul]; erw [real_inner_smul_left]; rw [real_inner_self_eq_norm_sq] field_simp rw [hLR_inner] @@ -758,7 +757,7 @@ private lemma crossing_sigma_tendsto_t₀ exact absurd (show σ ε ∈ (∅ : Set ℝ) from hK_ne ▸ ⟨hε_in, hball⟩) (Set.notMem_empty _) simp only [Metric.mem_ball, Real.dist_eq] at hσ_ball - linarith + linarith only [hδ, hσ_ball] /-- Direction convergence: as ε → 0, the ratio (γ(σ₁(ε))-z₀)/(γ(σ₂(ε))-z₀) (where σ₁(ε), σ₂(ε) are the boundary times from `exists_cutoff_boundary_times`) @@ -861,7 +860,7 @@ lemma crossing_ratio_tendsto rw [← hL_L_eq_LR] have hne : (‖L_L‖ : ℂ) ≠ 0 := by exact_mod_cast ne_of_gt hL_L_pos have hratio : (-L_L / ↑‖L_L‖) / (L_L / ↑‖L_L‖) = -1 := by field_simp [hne, hL_L_ne] - rw [hratio, show -(I * ↑Real.pi) = -(↑Real.pi * I) by ring, + rw [hratio, show -(I * ↑Real.pi) = -(↑Real.pi * I) by ac_rfl, Complex.exp_neg, Complex.exp_pi_mul_I] norm_num rw [← halg] diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Decomposition.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Decomposition.lean index af0b1bd7ba..6c17fcaf25 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Decomposition.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Decomposition.lean @@ -13,7 +13,6 @@ import Mathlib.Analysis.Calculus.Deriv.Add import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Winding Number: H-W Decomposition Theorems diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Defs.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Defs.lean index 198366d5f7..dd4c17b9e6 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Defs.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Defs.lean @@ -81,7 +81,7 @@ theorem singleton_mem_Ioo (t₀ : ℝ) (a b : ℝ) theorem singleton_at_crossing (γ : PiecewiseC1Immersion) (t₀ : ℝ) (z₀ : ℂ) (hcross : γ.toFun t₀ = z₀) : ∀ t ∈ ({t₀} : Finset ℝ), γ.toFun t = z₀ := by - simp_all [Finset.mem_singleton] + simp_all only [Finset.mem_singleton, implies_true] /-- A single smooth crossing contributes 1/2 to the winding number. -/ theorem windingNumber_smooth_crossing diff --git a/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Proposition22.lean b/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Proposition22.lean index 66a185a333..e95a504933 100644 --- a/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Proposition22.lean +++ b/LeanPool/LeanModularForms/GeneralizedResidueTheory/WindingNumber/Proposition22.lean @@ -15,7 +15,6 @@ import Mathlib.Analysis.Calculus.Deriv.MeanValue import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init -import Mathlib.MeasureTheory.Covering.Besicovitch /-! # Proposition 2.2: Finite Crossings and Isolated Crossing Intervals @@ -101,7 +100,7 @@ theorem PiecewiseC1Immersion.eventually_ne_at_smooth_crossing private lemma eventually_conj_deriv_re_pos (γ : PiecewiseC1Immersion) {L : ℂ} (hL_ne : L ≠ 0) {l : Filter ℝ} (hL_tendsto : Tendsto (deriv γ.toFun) l (𝓝 L)) : ∀ᶠ t in l, (starRingEnd ℂ L * deriv γ.toFun t).re > 0 := by - have hL_sq_pos : (0 : ℝ) < ‖L‖ ^ 2 := by positivity + have hL_sq_pos : (0 : ℝ) < ‖L‖ ^ 2 := by exact pow_pos (norm_pos_iff.mpr hL_ne) 2 have h_lim_val : (starRingEnd ℂ L * L).re = ‖L‖ ^ 2 := by rw [Complex.conj_mul' L, sq, ← Complex.ofReal_mul, Complex.ofReal_re, sq] refine (Tendsto.eventually ?_ (Ioi_mem_nhds hL_sq_pos)) @@ -154,7 +153,7 @@ theorem PiecewiseC1Immersion.eventually_ne_left_of_partition exact ⟨q, hq_lt_p, fun t ht hγt => by have hht : h t = 0 := by simp only [hh_def, hγt, sub_self, mul_zero, Complex.zero_re] have : h t < h p := hh_mono (Ioo_subset_Icc_self ht) (right_mem_Icc.mpr hq_lt_p.le) ht.2 - linarith⟩ + linarith only [hh_p, hht, this]⟩ /-- At a partition point p with p < b, the right-sided derivative limit is nonzero, so γ(t) ≠ γ(p) for t sufficiently close to p from the right. -/ @@ -202,7 +201,7 @@ theorem PiecewiseC1Immersion.eventually_ne_right_of_partition exact ⟨r, hr_gt_p, fun t ht hγt => by have hht : h t = 0 := by simp only [hh_def, hγt, sub_self, mul_zero, Complex.zero_re] have : h p < h t := hh_mono (left_mem_Icc.mpr hr_gt_p.le) (Ioo_subset_Icc_self ht) ht.1 - linarith⟩ + linarith only [hh_p, hht, this]⟩ /-! ### Crossings are isolated -/ @@ -224,7 +223,7 @@ theorem PiecewiseC1Immersion.crossing_isolated_nhds (eventually_nhdsWithin_of_forall (fun t (ht : t < t₀) => ht)) intro t ht; right simp only [mem_Icc, not_and_or, not_le] - left; linarith + left; linarith only [hap, ht] · by_cases hpb : t₀ < γ.b · exact (γ.eventually_ne_right_of_partition z₀ t₀ hpart ht₀.1 hpb hcross).mono (fun t ht => Or.inl ht) @@ -233,7 +232,7 @@ theorem PiecewiseC1Immersion.crossing_isolated_nhds (eventually_nhdsWithin_of_forall (fun t (ht : t₀ < t) => ht)) intro t ht; right simp only [mem_Icc, not_and_or, not_le] - right; linarith + right; linarith only [hpb, ht] · exact (γ.eventually_ne_at_smooth_crossing z₀ t₀ ht₀ hcross hpart).mono (fun t ht => Or.inl ht) @@ -253,7 +252,7 @@ theorem PiecewiseC1Immersion.crossing_not_accPt theorem crossing_set_isClosed (γ : PiecewiseC1Immersion) (z₀ : ℂ) : IsClosed {t ∈ Icc γ.a γ.b | γ.toFun t = z₀} := by have : {t ∈ Icc γ.a γ.b | γ.toFun t = z₀} = Icc γ.a γ.b ∩ γ.toFun ⁻¹' {z₀} := by - ext t; simp_all + ext t; simp_all only [mem_Icc, mem_ofPred_eq, mem_inter_iff, mem_preimage, mem_singleton_iff] rw [this] exact γ.continuous_toFun.preimage_isClosed_of_isClosed isClosed_Icc isClosed_singleton diff --git a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Associativity.lean b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Associativity.lean index d7ee7350d9..fa1b1a40ba 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Associativity.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Associativity.lean @@ -103,7 +103,7 @@ private lemma coset_shift_fwd (q a b a' b' g₁ g₂ g_D n₁ n₂ : G) subst ha' hb' apply leftCoset_eq_of_not_disjoint; rw [@not_disjoint_iff] refine ⟨q⁻¹ * a * n₁ * g₂ * (g₂⁻¹ * n₁⁻¹ * g₂ * b * n₂ * g₁), - ⟨1, P.H.one_mem, by simp [smul_eq_mul]⟩, ?_⟩ + ⟨1, P.H.one_mem, by simp only [smul_eq_mul, mul_one]⟩, ?_⟩ have hmem : a * g₂ * (b * g₁) ∈ ({q * g_D} : Set G) * ↑P.H := by rw [← hcond]; exact ⟨_, rfl, 1, P.H.one_mem, by group⟩ obtain ⟨_, h_eq, h₀, hh₀, hprod⟩ := hmem @@ -188,12 +188,14 @@ lemma heckeMultiplicity_uniform (g₂ g₁ : P.Δ) (D : HeckeCoset P) have hi₁₂ : i₁ = i₂ := by rw [@Quotient.eq'', QuotientGroup.leftRel_apply] at hi exact decompQuot_eq_of_conjAct_rel P g₂ i₁ i₂ - (by convert hi using 1; ext; simp [Subgroup.coe_mul]) + (by convert hi using 1; ext; simp only [Subgroup.coe_mul, InvMemClass.coe_inv, mul_inv_rev, + inv_inv, mul_mul_inv_mul_cancel]) subst hi₁₂ have hj₁₂ : j₁ = j₂ := by rw [@Quotient.eq'', QuotientGroup.leftRel_apply] at hj exact decompQuot_eq_of_conjAct_rel P g₁ j₁ j₂ - (by convert hj using 1; ext; simp [Subgroup.coe_mul]; group) + (by convert hj using 1; ext; simp only [Subgroup.coe_mul, InvMemClass.coe_inv, mul_inv_rev, + inv_inv]; group) subst hj₁₂; rfl · intro ⟨⟨i', j'⟩, (hcond'_tgt : _ = _)⟩ let i₀ : decompQuot P g₂ := @@ -218,7 +220,8 @@ lemma heckeMultiplicity_uniform (g₂ g₁ : P.Δ) (D : HeckeCoset P) QuotientGroup.leftRel_apply] have h := Quotient.out_eq' i₀ rw [@Quotient.eq'', QuotientGroup.leftRel_apply] at h - convert h using 1; ext; simp [Subgroup.coe_mul]; group + convert h using 1; ext; simp only [Subgroup.coe_mul, InvMemClass.coe_inv, mul_inv_rev, + inv_inv]; group have h_n₀_mi : (n₀ : G) = (m_i : G)⁻¹ := by have hn₀_spec := (QuotientGroup.mk_out_eq_mul ((ConjAct.toConjAct g₂' • P.H).subgroupOf P.H) @@ -250,7 +253,8 @@ lemma heckeMultiplicity_uniform (g₂ g₁ : P.Δ) (D : HeckeCoset P) QuotientGroup.leftRel_apply] have h_j₀ := Quotient.out_eq' j₀ rw [@Quotient.eq'', QuotientGroup.leftRel_apply] at h_j₀ - convert h_j₀ using 1; ext; simp [Subgroup.coe_mul]; group; rfl⟩ + convert h_j₀ using 1; ext; simp only [Subgroup.coe_mul, InvMemClass.coe_inv, mul_inv_rev, + inv_inv]; group; rfl⟩ private lemma iter_mem_smulOrbit_mulMap (g₂ g₁ : P.Δ) (β : P.Δ) (i : decompQuot P g₂) (j : decompQuot P g₁) : @@ -526,9 +530,9 @@ private lemma smul_assoc_key (g₁ g₂ : P.Δ) (β₀ : P.Δ) : ∑ j ∈ smulOrbit P g₂ β₀, if x₀ ∈ smulOrbit P g₁ (HeckeLeftCoset.rep j) then 1 else 0 := by rw [← Finsupp.sum_finsetSum_index - (h_zero := fun a => by simp) + (h_zero := fun a => by simp only [ite_self]) (h_add := fun a b₁ b₂ => by split_ifs <;> simp [*])] - simp_all + simp_all only [ite_self, sum_single_index, Finset.sum_boole] rw [h_rhs] by_cases h_ex : ∃ D₀ ∈ (m P g₂ g₁).support, x₀ ∈ smulOrbit P (HeckeCoset.rep D₀) β₀ · obtain ⟨D₀, hD₀, hx₀⟩ := h_ex @@ -573,9 +577,11 @@ private lemma smul_assoc_singles (D₁ D₂ : HeckeCoset P) (a₁ a₂ : ℤ) Finsupp.single i (b * b₂)) = ∑ i ∈ smulOrbit P (HeckeCoset.rep D) (HeckeLeftCoset.rep m₀), Finsupp.single i (b * c₀) := by - simp_all + simp_all only [single_mul, single_zero, mul_zero, Finset.sum_const_zero, sum_single_index, + implies_true] simp_rw [hsi] - rw [Finsupp.sum_single_index (by simp [zero_mul, Finsupp.single_zero, Finset.sum_const_zero])] + rw [Finsupp.sum_single_index (by simp only [single_mul, zero_mul, single_zero, + Finset.sum_const_zero, sum_fun_zero])] apply Finsupp.ext; intro x₀ simp only [Finsupp.sum_apply, Finsupp.finsetSum_apply, Finsupp.single_apply] simp_rw [Finset.sum_ite_eq'] @@ -637,7 +643,8 @@ private lemma smul_assoc_singles (D₁ D₂ : HeckeCoset P) (a₁ a₂ : ℤ) rw [← Finsupp.sum_finsetSum_index (h_zero := fun a => by simp) (h_add := fun a b₁ b₂ => by split_ifs <;> simp [*])] - simp_all + simp_all only [single_mul, single_zero, mul_zero, Finset.sum_const_zero, sum_single_index, + implies_true, ite_self, Finset.sum_boole] rwa [h_rhs2] at key_pt /-- The module action satisfies the scalar tower property `(x * y) • z = y • (x • z)`, diff --git a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Basic.lean b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Basic.lean index bd6078c579..a9ca779863 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Basic.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Basic.lean @@ -60,7 +60,8 @@ lemma conjAct_smul_elt_eq (h : H) : /-- A left coset contained in another left coset is equal to it. -/ lemma leftCoset_eq_of_subset (a b : G) (h : {a} * (H : Set G) ⊆ {b} * H) : {a} * (H : Set G) = {b} * H := by - have ha : a ∈ {a} * (H : Set G) := by rw [Set.mem_mul]; use a; simp + have ha : a ∈ {a} * (H : Set G) := by rw [Set.mem_mul]; use a; simp only [mem_singleton_iff, + SetLike.mem_coe, mul_eq_left, exists_eq_right, one_mem, and_self] have hb := h ha; rw [Set.mem_mul] at hb obtain ⟨b', hb', y, hy, hb_eq⟩ := hb; simp only [mem_singleton_iff] at hb' rw [← hb_eq, hb', ← Set.singleton_mul_singleton, mul_assoc, @@ -274,7 +275,7 @@ lemma inter_mul_conjAct_eq_conjAct (g : G) : Subset.antisymm (le_trans (Set.inter_mul_subset (s₁ := (H : Set G)) (s₂ := (ConjAct.toConjAct g • H)) (t := (ConjAct.toConjAct g • H))) - (by simp [conjAct_mul_self_eq_self])) + (by simp only [conjAct_mul_self_eq_self, inter_subset_right])) (subset_mul_right _ ⟨Subgroup.one_mem H, Subgroup.one_mem (ConjAct.toConjAct g • H)⟩) /-- Right multiplication by a singleton is cancellative. -/ @@ -300,7 +301,8 @@ lemma DoubleCoset.doubleCoset_eq_iUnion_leftCosets (g : G) : rw [conjAct_smul_coe_eq] at *; simp_rw [← mul_assoc] at h2; rw [h2] have : (Subgroup.map H.subtype ((ConjAct.toConjAct g • H).subgroupOf H)).subgroupOf H = - (ConjAct.toConjAct g • H).subgroupOf H := by simp + (ConjAct.toConjAct g • H).subgroupOf H := by simp only [subgroupOf_map_subtype, + inf_subgroupOf_right] rw [this] have h1 : ∀ (i : H ⧸ (ConjAct.toConjAct g • H).subgroupOf H), ((i.out) : G) • ((H : Set G) ∩ ({g} * ↑H * {g⁻¹})) * @@ -355,7 +357,7 @@ lemma doubleCoset_mul_eq_iUnion_doubleCoset (g h : G) : lemma DoubleCoset.doubleCoset_one_mul (h : G) : DoubleCoset.doubleCoset h (H : Set G) H = ⋃ (_ : H ⧸ (ConjAct.toConjAct h • H).subgroupOf H), - DoubleCoset.doubleCoset h H H := by simp [Set.iUnion_const] + DoubleCoset.doubleCoset h H H := by simp only [iUnion_const] /-- The Hecke ring type: formal `Z`-linear combinations of double cosets `HeckeCoset P`. Changed from `def` to `abbrev` for transparency in instance resolution (Lean 4.29+). -/ diff --git a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Commutativity.lean b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Commutativity.lean index 97585c8d59..f5317b13f3 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Commutativity.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Commutativity.lean @@ -57,10 +57,10 @@ def bar (g : G) : G := (ι.toFun g).unop lemma bar_mul (a b : G) : ι.bar (a * b) = ι.bar b * ι.bar a := by simp only [bar, map_mul, unop_mul] /-- The anti-involution fixes the identity. -/ -lemma bar_one : ι.bar 1 = 1 := by simp [bar] +lemma bar_one : ι.bar 1 = 1 := by simp only [bar, map_one, unop_one] /-- The anti-involution commutes with inversion. -/ -lemma bar_inv (g : G) : ι.bar g⁻¹ = (ι.bar g)⁻¹ := by simp [bar] +lemma bar_inv (g : G) : ι.bar g⁻¹ = (ι.bar g)⁻¹ := by simp only [bar, map_inv, unop_inv] /-- The anti-involution is injective. -/ lemma bar_injective : Function.Injective ι.bar := by @@ -211,7 +211,7 @@ private lemma decompQuot_eq_of_conj_mem (g₁ : P.Δ) rw [@Quotient.eq'', QuotientGroup.leftRel_apply, Subgroup.mem_subgroupOf, Subgroup.mem_pointwise_smul_iff_inv_smul_mem, ConjAct.smul_def] simp only [map_inv, ConjAct.ofConjAct_toConjAct, inv_inv] - convert hconj_H' using 1; simp [Subgroup.coe_mul]; group + convert hconj_H' using 1; simp only [coe_mul, InvMemClass.coe_inv, mul_left_inj]; group private lemma conj_kernel_mem_of_stabilizer_mem (a₁ a₂ : P.H) (g₂ : G) diff --git a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Degree.lean b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Degree.lean index df63098f6f..c49d97aec9 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Degree.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Degree.lean @@ -66,7 +66,7 @@ noncomputable def HeckeCosetDeg (D : HeckeCoset P) : ℤ := simp only [HeckeCosetDeg]; have := subsingleton_decompQuot_T_one P have : Unique (decompQuot P (HeckeCoset.one P).rep) := uniqueOfSubsingleton (one_in_decompQuot_T_one P).some - simp [Fintype.card_unique] + simp only [Fintype.card_unique, Nat.cast_one] /-- Every double coset has positive degree. -/ lemma HeckeCoset_deg_pos (D : HeckeCoset P) : 0 < HeckeCosetDeg P D := by @@ -108,7 +108,7 @@ lemma smulOrbit_card (g : P.Δ) (β : P.Δ) : /-- The cardinality of a smul orbit cast to `ℤ` equals `HeckeCosetDeg`. -/ lemma smulOrbit_card_intCast (D : HeckeCoset P) (β : P.Δ) : ((smulOrbit P (HeckeCoset.rep D) β).card : ℤ) = HeckeCosetDeg P D := by - simp [smulOrbit_card, HeckeCosetDeg] + simp only [smulOrbit_card, HeckeCosetDeg] end SmulOrbitCard @@ -140,7 +140,7 @@ lemma coeffSum_single_smul_single (D : HeckeCoset P) (m₀ : HeckeLeftCoset P) ( a * HeckeCosetDeg P D * b := by rw [T_single_smul_HeckeLeftCoset_single, coeffSum_finset_sum] simp only [coeffSum_single, Finset.sum_const, Int.nsmul_eq_mul, - smulOrbit_card_intCast P D (HeckeLeftCoset.rep m₀)]; ring + smulOrbit_card_intCast P D (HeckeLeftCoset.rep m₀)]; ac_rfl end CoeffSum @@ -170,7 +170,7 @@ lemma deg_fun_add (f g : 𝕋 P ℤ) : lemma deg_fun_eq_coeffSum_smul_one (f : 𝕋 P ℤ) : degFun P f = coeffSum P (f • (1 : HeckeModule P ℤ)) := by induction f using Finsupp.induction_linear with - | zero => simp [zero_smul_HeckeModule] + | zero => simp only [deg_fun_zero, zero_smul_HeckeModule, map_zero] | add f g ihf ihg => rw [deg_fun_add, ihf, ihg, smul_add_left, coeffSum_add] | single D a => rw [deg_fun_T_single, one_eq_HeckeLeftCoset_single, coeffSum_single_smul_single, mul_one] @@ -179,12 +179,12 @@ lemma deg_fun_eq_coeffSum_smul_one (f : 𝕋 P ℤ) : lemma coeffSum_smul_eq (f : 𝕋 P ℤ) (m : HeckeModule P ℤ) : coeffSum P (f • m) = degFun P f * coeffSum P m := by induction f using Finsupp.induction_linear with - | zero => simp [zero_smul_HeckeModule] + | zero => simp only [zero_smul_HeckeModule, map_zero, deg_fun_zero, zero_mul] | add f₁ f₂ ih₁ ih₂ => rw [smul_add_left, coeffSum_add, ih₁, ih₂, deg_fun_add]; ring | single D a => induction m using Finsupp.induction_linear with - | zero => simp [smul_zero_HeckeModule] + | zero => simp only [smul_zero_HeckeModule, map_zero, deg_fun_T_single, mul_zero] | add m₁ m₂ ih₁ ih₂ => rw [smul_add_right, coeffSum_add, ih₁, ih₂, coeffSum_add, deg_fun_T_single]; ring @@ -197,7 +197,7 @@ lemma deg_fun_mul (f g : 𝕋 P ℤ) : have h := (instIsScalarTower P).smul_assoc g f (1 : HeckeModule P ℤ) simp only [smul_def] at h rw [deg_fun_eq_coeffSum_smul_one P (f * g), h, coeffSum_smul_eq, - ← deg_fun_eq_coeffSum_smul_one P f]; ring + ← deg_fun_eq_coeffSum_smul_one P f]; ac_rfl /-- The degree ring homomorphism `deg : 𝕋 P ℤ →+* ℤ`, sending each double coset to the number of left cosets it contains (Shimura Proposition 3.3). -/ @@ -228,7 +228,8 @@ lemma deg_add (f g : 𝕋 P ℤ) : deg P (f + g) = deg P f + deg P g := (deg P).map_add f g /-- The degree of an integer cast is the integer itself. -/ -lemma deg_intCast (n : ℤ) : deg P (n : 𝕋 P ℤ) = n := by simp [deg, degFun, HeckeCoset_deg_T_one] +lemma deg_intCast (n : ℤ) : deg P (n : 𝕋 P ℤ) = n := by simp only [deg, intCast_eq, RingHom.coe_mk, + MonoidHom.coe_mk, OneHom.coe_mk, degFun, HeckeCoset_deg_T_one, mul_one, sum_single_index] end API diff --git a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Module.lean b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Module.lean index 43a544ef4f..c8661f3901 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Module.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Module.lean @@ -131,7 +131,7 @@ lemma single_smul_single (t : HeckeCoset P) (m : HeckeLeftCoset P) (a b : Z) : (∑ i ∈ smulOrbit P (HeckeCoset.rep t) (HeckeLeftCoset.rep m), Finsupp.single i (a * b : Z) : (HeckeLeftCoset P) →₀ Z) := by rw [smul_eq_sum] - simp [mul_zero, single_zero, Finset.sum_const_zero, sum_single_index, zero_mul] + simp only [single_mul, single_zero, mul_zero, Finset.sum_const_zero, sum_single_index, zero_mul] /-- Every finsupp is a sum of its basis elements. -/ lemma single_basis {α : Type*} (t : Finsupp α Z) : @@ -180,9 +180,9 @@ lemma smul_add_right (T : 𝕋 P Z) (m₁ m₂ : HeckeModule P Z) : Finsupp.single i (b * c)) := by intro D b exact Finsupp.sum_add_index' - (fun m => by simp [mul_zero, Finsupp.single_zero, Finset.sum_const_zero]) + (fun m => by simp only [mul_zero, single_zero, Finset.sum_const_zero]) (fun m c₁ c₂ => by simp only [← Finset.sum_add_distrib, mul_add, Finsupp.single_add]) - simp_all + simp_all only [single_mul, sum_add] /-- The smul orbits of distinct double cosets acting on the same left coset are disjoint. -/ lemma smulOrbit_disjoint_of_ne (g₁ g₂ : P.Δ) (β : P.Δ) diff --git a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Multiplication.lean b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Multiplication.lean index 983136864b..7b7bdb6081 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Multiplication.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Multiplication.lean @@ -98,7 +98,8 @@ lemma decompQuot_coset_diff (g : P.Δ) simp_rw [← Set.singleton_mul_singleton] at h have := conjAct_mem_of_leftCoset_eq P.H P.Δ g i.out j.out h rw [← @QuotientGroup.leftRel_apply, ← @Quotient.eq''] at this - simp_all + simp_all only [ne_eq, mul_singleton, image_singleton, singleton_mul, image_mul_left, mul_inv_rev, + Quotient.out_eq, not_true_eq_false] /-- Two left cosets that are not disjoint must be equal. -/ lemma leftCoset_eq_of_not_disjoint (f g : G) diff --git a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Ring.lean b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Ring.lean index 26f42bee4f..3217bcfa9e 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Ring.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/AbstractHeckeRing/Ring.lean @@ -199,7 +199,9 @@ lemma m_support (g₁ g₂ : P.Δ) : /-- The multiplicity `heckeMultiplicity` is nonneg since it is a natural number cast to `ℤ`. -/ lemma heckeMultiplicity_nonneg (g₁ g₂ d : P.Δ) : - 0 ≤ heckeMultiplicity P g₁ g₂ d := by simp [heckeMultiplicity] + 0 ≤ heckeMultiplicity P g₁ g₂ d := by simp only [heckeMultiplicity, mul_singleton, + image_singleton, singleton_mul, image_mul_left, mul_inv_rev, Nat.card_eq_fintype_card, + Fintype.card_ofFinset, mem_ofPred_eq, Nat.cast_nonneg] /-- Extensionality for Hecke ring elements. -/ @[ext] lemma ext_𝕋 {f g : 𝕋 P ℤ} diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GL2/CongruenceIndex.lean b/LeanPool/LeanModularForms/HeckeRIngs/GL2/CongruenceIndex.lean index 054a62fb7a..168ecc7375 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GL2/CongruenceIndex.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GL2/CongruenceIndex.lean @@ -44,7 +44,7 @@ private lemma ZMod_inv_mul_cancel (p : ℕ) (hp : Nat.Prime p) (a : ℤ) private lemma SL2_entry_mul (A B : SL(2, ℤ)) (i j : Fin 2) : (A * B).1 i j = A.1 i 0 * B.1 0 j + A.1 i 1 * B.1 1 j := by - change (A.1 * B.1) i j = _; simp [Matrix.mul_apply, Fin.sum_univ_two] + change (A.1 * B.1) i j = _; simp only [Matrix.mul_apply, Fin.sum_univ_two, Fin.isValue] private lemma TjS_inv_10 (j : ℤ) : ((T ^ j * S)⁻¹).1 1 0 = -1 := by simp [coe_T_zpow, coe_S, Matrix.SpecialLinearGroup.coe_inv, adjugate_fin_two_of] @@ -54,14 +54,16 @@ private lemma TjS_inv_11 (j : ℤ) : ((T ^ j * S)⁻¹).1 1 1 = j := by private lemma TjS_00 (j : ℤ) : (T ^ j * S).1 0 0 = j := by simp [coe_T_zpow, coe_S] -private lemma TjS_10 (j : ℤ) : (T ^ j * S).1 1 0 = 1 := by simp [coe_S] +private lemma TjS_10 (j : ℤ) : (T ^ j * S).1 1 0 = 1 := by simp only [Fin.isValue, + T_pow_mul_apply_one, coe_S, Int.reduceNeg, of_apply, cons_val', cons_val_zero, cons_val_fin_one, + cons_val_one] private lemma TjS_inv_mul_10 (j : ℤ) (σ : SL(2, ℤ)) : ((T ^ j * S)⁻¹ * σ).1 1 0 = j * σ.1 1 0 - σ.1 0 0 := by rw [SL2_entry_mul, TjS_inv_10, TjS_inv_11]; ring private lemma rep_diff_10 (i j : ℤ) : - ((T ^ j * S)⁻¹ * (T ^ i * S)).1 1 0 = j - i := by rw [TjS_inv_mul_10, TjS_10, TjS_00]; ring + ((T ^ j * S)⁻¹ * (T ^ i * S)).1 1 0 = j - i := by rw [TjS_inv_mul_10, TjS_10, TjS_00]; ac_rfl section BaseCase @@ -135,7 +137,8 @@ omit hp in private lemma lowerTriRep_mem_Gamma0 (k : ℕ) (_hk : 0 < k) (c : Fin p) : (lowerTriRep p k c : SL(2, ℤ)) ∈ Gamma0 (p ^ k) := by rw [Gamma0_mem, show (lowerTriRep p k c) 1 0 = (c : ℤ) * (p : ℤ) ^ k from by - simp [lowerTriRep], ZMod.intCast_zmod_eq_zero_iff_dvd] + simp only [lowerTriRep, Fin.isValue, of_apply, cons_val', cons_val_zero, cons_val_fin_one, + cons_val_one], ZMod.intCast_zmod_eq_zero_iff_dvd] exact_mod_cast dvd_mul_left (p ^ k : ℕ) (c.val) omit hp in @@ -144,7 +147,8 @@ private lemma lowerTriRep_diff_entry (k : ℕ) (c₁ c₂ : Fin p) : ((c₂ : ℤ) - (c₁ : ℤ)) * (p : ℤ) ^ k := by change (Matrix.adjugate (!![1, 0; (c₁ : ℤ) * (p : ℤ) ^ k, 1]) * !![1, 0; (c₂ : ℤ) * (p : ℤ) ^ k, 1]) 1 0 = _ - simp [Matrix.adjugate_fin_two, Matrix.mul_apply] + simp only [adjugate_fin_two, Fin.isValue, of_apply, cons_val', cons_val_one, cons_val_fin_one, + cons_val_zero, neg_zero, Matrix.mul_apply, Fin.sum_univ_two, mul_one, one_mul] ring omit hp in @@ -152,7 +156,8 @@ private lemma lowerTriRep_inv_mul_10 (k : ℕ) (c : Fin p) (σ : SL(2, ℤ)) : ((lowerTriRep p k c)⁻¹ * σ).1 1 0 = σ.1 1 0 - (c : ℤ) * (p : ℤ) ^ k * σ.1 0 0 := by change (Matrix.adjugate (!![1, 0; (c : ℤ) * (p : ℤ) ^ k, 1]) * σ.val) 1 0 = _ - simp [Matrix.adjugate_fin_two, Matrix.mul_apply] + simp only [adjugate_fin_two, Fin.isValue, of_apply, cons_val', cons_val_one, cons_val_fin_one, + cons_val_zero, neg_zero, Matrix.mul_apply, Fin.sum_univ_two, neg_mul, one_mul] ring private noncomputable def relindexRep (k : ℕ) (hk : 0 < k) (c : Fin p) : diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GL2/Degree.lean b/LeanPool/LeanModularForms/HeckeRIngs/GL2/Degree.lean index 700f5b3774..7a573c9060 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GL2/Degree.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GL2/Degree.lean @@ -70,7 +70,8 @@ private lemma deg_T_ad_of_pos' (a d : ℕ) (ha : 0 < a) (hd : 0 < d) (hdvd : a deg (GLPair 2) (TAd a d) = HeckeCosetDeg (GLPair 2) (TDiag ![a, d]) := by unfold deg; rw [T_ad_of_pos a d ha hd hdvd] - unfold TElem; simp + unfold TElem; simp only [Nat.succ_eq_add_one, Nat.reduceAdd, RingHom.coe_mk, MonoidHom.coe_mk, + OneHom.coe_mk, deg_fun_T_single, one_mul] include hp in /-- Non-scalar case: `deg(TAd(pⁱ, p^{k-i})) = p^{k-2i-1}(p+1)` when `2i < k`. -/ @@ -163,11 +164,11 @@ theorem deg_T_sum (m : ℕ+) : | one => intro hn rw [show (⟨1, hn⟩ : ℕ+) = (1 : ℕ+) from rfl, deg_T_sum_one] - simp + simp only [PNat.val_ofNat, ArithmeticFunction.sigma_one, Nat.cast_one] | @prime_pow p k hp hk => intro hn rw [deg_T_sum_prime_pow p hp k]; simp only [ArithmeticFunction.sigma_one_apply] - simp_all + simp_all only [PNat.mk_coe, Nat.sum_divisors_prime_pow, Nat.cast_sum, Nat.cast_pow] | @coprime a b ha hb hcop iha ihb => intro hn rw [show TSum ⟨a * b, hn⟩ = TSum ⟨a, by omega⟩ * TSum ⟨b, by omega⟩ from diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GL2/HeckeAction.lean b/LeanPool/LeanModularForms/HeckeRIngs/GL2/HeckeAction.lean index 6316824118..484a175ed4 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GL2/HeckeAction.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GL2/HeckeAction.lean @@ -137,7 +137,8 @@ lemma heckeSlash_smul (k : ℤ) (D : HeckeCoset (GLPair 2)) (c : ℂ) (f : ℍ change ((c • f) ∣[k] glMap _) _ = (c • (f ∣[k] glMap _)) _ have hA : 0 < (glMap (tRep D i)).det.val := cosetRep_delta_transpose_det_pos ⟨i.out, SetLike.coe_mem _⟩ (HeckeCoset.rep D) - rw [ModularForm.smul_slash]; simp [sigma_eq_refl_of_pos_det hA] + rw [ModularForm.smul_slash]; simp only [sigma_eq_refl_of_pos_det hA, + ContinuousAlgEquiv.refl_apply, Pi.smul_apply, smul_eq_mul] section SlashInvariance @@ -177,7 +178,8 @@ private lemma leftMulQuot_injective (D : HeckeCoset (GLPair 2)) (σ : (GLPair 2) (HeckeCoset.rep D : GL _ ℚ) ∈ (GLPair 2).H := by have := h_K rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, ConjAct.smul_def] at this - simp_all + simp_all only [Subgroup.coe_mul, InvMemClass.coe_inv, _root_.mul_inv_rev, + mul_inv_mul_mul_cancel, ConjAct.ofConjAct_inv, ConjAct.ofConjAct_toConjAct, inv_inv] exact decompQuot_coset_diff (GLPair 2) (HeckeCoset.rep D) i₁ i₂ hne (leftCoset_eq_of_not_disjoint (GLPair 2).H _ _ (by rw [Set.not_disjoint_iff] diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GL2/HeckeModularForm.lean b/LeanPool/LeanModularForms/HeckeRIngs/GL2/HeckeModularForm.lean index 2e727c8ad8..881fe6c630 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GL2/HeckeModularForm.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GL2/HeckeModularForm.lean @@ -270,7 +270,8 @@ noncomputable def heckeSlashExt (k : ℤ) (T : HeckeAlgebra 2) (f : ℍ → ℂ) /-- The extended action on a single double coset recovers `heckeSlash`. -/ lemma heckeSlashExt_single (k : ℤ) (D : HeckeCoset (GLPair 2)) (f : ℍ → ℂ) : heckeSlashExt k (Finsupp.single D 1) f = heckeSlash k D f := by - simp [heckeSlashExt, Finsupp.sum_single_index] + simp only [heckeSlashExt, zsmul_eq_mul, Int.cast_zero, zero_mul, Finsupp.sum_single_index, + Int.cast_one, one_mul] /-- Multiplicativity of the Hecke slash for Γ-invariant functions: `T(D₁)(T(D₂)(f)) = (T(D₂) * T(D₁))(f)` where `f` is any Γ-invariant function. @@ -283,7 +284,7 @@ private theorem heckeSlash_comp (k : ℤ) (D₁ D₂ : HeckeCoset (GLPair 2)) (f TSingle (GLPair 2) ℤ D₁ 1) f = (m (GLPair 2) (HeckeCoset.rep D₂) (HeckeCoset.rep D₁)).sum (fun D c => c • heckeSlash k D f) from by - unfold heckeSlashExt; rw [mul_singleton_𝕋]; simp] + unfold heckeSlashExt; rw [mul_singleton_𝕋]; simp only [one_smul, zsmul_eq_mul] ] have h_comm : m (GLPair 2) (HeckeCoset.rep D₂) (HeckeCoset.rep D₁) = m (GLPair 2) (HeckeCoset.rep D₁) (HeckeCoset.rep D₂) := by rw [← @T_single_one_mul_T_single_one _ _ (GLPair 2) D₂ D₁, diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GL2/MultiplicationTable.lean b/LeanPool/LeanModularForms/HeckeRIngs/GL2/MultiplicationTable.lean index 389dd5283b..d9dcf0472d 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GL2/MultiplicationTable.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GL2/MultiplicationTable.lean @@ -212,13 +212,13 @@ private lemma first_invariant_dvd_p_of_product (S : Matrix.SpecialLinearGroup (F ite_false, ite_true, mul_zero, zero_mul, add_zero, Matrix.cons_val_fin_one]; norm_num have h_cop : IsCoprime (S_ℤ 0 0) (S_ℤ 1 0) := ⟨S.val 1 1, -(S.val 0 1), by - have := S.prop; rw [Matrix.det_fin_two] at this; linarith⟩ + have := S.prop; rw [Matrix.det_fin_two] at this; linarith only [this]⟩ have h1 : (a 0 : ℤ) ∣ S_ℤ 0 0 := h_M00 ▸ h_dvd_entry 0 0 have h2 : (a 0 : ℤ) ∣ (p : ℤ) * S_ℤ 1 0 := h_M10 ▸ h_dvd_entry 1 0 exact_mod_cast (by obtain ⟨u, v, huv⟩ := h_cop; obtain ⟨t, ht⟩ := h1 exact ⟨u * t, v, by - rw [show u * t * ↑(a 0) = u * (↑(a 0) * t) from by ring, ← ht]; exact huv⟩ + rw [show u * t * ↑(a 0) = u * (↑(a 0) * t) from by ac_rfl, ← ht]; exact huv⟩ : IsCoprime (↑(a 0) : ℤ) (S_ℤ 1 0)).dvd_of_dvd_mul_right h2 private lemma mulSupport_pp_det_eq (k : ℕ) (a : Fin 2 → ℕ) (ha_pos : ∀ i, 0 < a i) @@ -305,7 +305,7 @@ private lemma mulSupport_pp_case_split (k : ℕ) (_hk : 0 < k) (a : Fin 2 → · simp only [Fin.mk_one, Fin.isValue, Nat.succ_eq_add_one, Nat.reduceAdd, Matrix.cons_val_one, Matrix.cons_val_fin_one] have h1 : p * a 1 = p ^ (k + 1) := by rwa [ha0_p] at h_det_prod - exact Nat.eq_of_mul_eq_mul_left hp.pos (by rw [h1, pow_succ]; ring) + exact Nat.eq_of_mul_eq_mul_left hp.pos (by rw [h1, pow_succ]; ac_rfl) include hp in private lemma mulSupport_pp_subset (k : ℕ) (_hk : 0 < k) (A : HeckeCoset (GLPair 2)) @@ -342,13 +342,17 @@ private lemma mulSupport_pp_subset (k : ℕ) (_hk : 0 < k) (A : HeckeCoset (GLPa exact SLnZ_to_GLnQ_det SL_i₀) (by rw [hD1_eq, Units.val_mul, Units.val_mul, Matrix.det_mul, Matrix.det_mul, SLnZ_to_GLnQ_det, SLnZ_to_GLnQ_det, diagMat_det 2 (![1, p]) - (by intro ⟨i, hi⟩; interval_cases i <;> simp [hp.pos])]; simp [Fin.prod_univ_two]) + (by intro ⟨i, hi⟩; interval_cases i <;> simp [hp.pos])]; simp only [Fin.prod_univ_two, + Fin.isValue, Matrix.cons_val_zero, Nat.cast_one, Matrix.cons_val_one, + Matrix.cons_val_fin_one, one_mul, mul_one]) (by rw [show (↑j₀.out : GL _ ℚ) = (SL_j₀ : GL (Fin 2) ℚ) from hSL_j₀.symm] exact SLnZ_to_GLnQ_det SL_j₀) (by rw [hD2_eq, Units.val_mul, Units.val_mul, Matrix.det_mul, Matrix.det_mul, SLnZ_to_GLnQ_det, SLnZ_to_GLnQ_det, diagMat_det 2 (![1, p ^ k]) (by intro ⟨i, - hi⟩; interval_cases i <;> simp [pow_pos hp.pos k])]; simp [Fin.prod_univ_two]) + hi⟩; interval_cases i <;> simp [pow_pos hp.pos k])]; simp only [Fin.prod_univ_two, + Fin.isValue, Matrix.cons_val_zero, Nat.cast_one, Matrix.cons_val_one, + Matrix.cons_val_fin_one, Nat.cast_pow, one_mul, mul_one]) SL_La SL_Ra h_prod_eq have h_dvd := mulSupport_pp_dvd_p p hp k _hk a ha_pos hdiv (HeckeCoset.rep D1) (HeckeCoset.rep D2) (↑i₀.out) (↑j₀.out) SL_L₁ SL_R₁ SL_L₂ SL_R₂ SL_La SL_Ra SL_i₀ @@ -397,7 +401,7 @@ private lemma heckeMultiplicity_deg_sum_eq (D1 D2 D_out1 D_out2 : HeckeCoset (GL (HeckeRing.m (GLPair 2) (HeckeCoset.rep D1) (HeckeCoset.rep D2)) = HeckeCosetDeg (GLPair 2) D1 * HeckeCosetDeg (GLPair 2) D2 := by rw [← HeckeRing.T_single_one_mul_T_single_one, HeckeRing.deg_mul, - HeckeRing.deg_T_single, HeckeRing.deg_T_single]; ring + HeckeRing.deg_T_single, HeckeRing.deg_T_single]; ac_rfl have h2 : HeckeRing.deg (GLPair 2) (HeckeRing.m (GLPair 2) (HeckeCoset.rep D1) (HeckeCoset.rep D2)) = HeckeRing.heckeMultiplicity (GLPair 2) (HeckeCoset.rep D1) (HeckeCoset.rep D2) @@ -417,7 +421,7 @@ private lemma heckeMultiplicity_deg_sum_eq (D1 D2 D_out1 D_out2 : HeckeCoset (GL exact Finset.sum_subset hsub (by intro A _ hA; rw [Finsupp.notMem_support_iff.mp hA]; simp) |>.trans (Finset.sum_pair h_ne) - linarith + linarith only [h1, h2] include hp in private lemma heckeMultiplicity_values (k : ℕ) (hk : 0 < k) : @@ -519,12 +523,12 @@ private lemma heckeMultiplicity_values (k : ℕ) (hk : 0 < k) : have key : (p : ℤ) ^ (k - 2) * ((p : ℤ) + 1) ≠ 0 := by positivity have := mul_right_cancel₀ key (show (m1 * (p : ℤ) ^ 2 + m2) * ((p : ℤ) ^ (k - 2) * ((p : ℤ) + 1)) = - ((p : ℤ) * ((p : ℤ) + 1)) * ((p : ℤ) ^ (k - 2) * ((p : ℤ) + 1)) by nlinarith) - linarith + ((p : ℤ) * ((p : ℤ) + 1)) * ((p : ℤ) ^ (k - 2) * ((p : ℤ) + 1)) by nlinarith only [h]) + exact this have h_m1_eq : m1 = 1 := by have h_le : m1 * (p : ℤ) ^ 2 ≤ (p : ℤ) ^ 2 + p := by linarith [h_eq, hm2_nn] - nlinarith [show (p : ℤ) ^ 2 ≥ 4 by nlinarith] - exact ⟨h_m1_eq, by rw [h_m1_eq] at h_eq; linarith⟩ + nlinarith [show (p : ℤ) ^ 2 ≥ 4 by nlinarith only [hp2] ] + exact ⟨h_m1_eq, by rw [h_m1_eq] at h_eq; linarith only [h_eq]⟩ /-- Theorem 3.24(5): `T(p) · T(1, pᵏ) = T(1, p^{k+1}) + m · T(p, pᵏ)` -/ theorem T_sum_prime_mul_T_ad (k : ℕ) (hk : 0 < k) : @@ -606,7 +610,9 @@ private lemma T_pp_comm_T_ad_one_p : TPp p * TAd 1 p = TAd 1 p * TPp p := by rw [T_ad_of_pos 1 p Nat.one_pos hp.pos (one_dvd _)] exact T_pp_comm_T_elem p hp _ (fun i => by fin_cases i <;> first | exact Nat.one_pos | exact hp.pos) - (fun i hi => by (have : i = 0 := by omega); subst this; simp) + (fun i hi => by (have : i = 0 := by omega); subst this; simp only [Nat.succ_eq_add_one, + Nat.reduceAdd, Fin.zero_eta, Fin.isValue, Matrix.cons_val_zero, zero_add, Fin.mk_one, + Matrix.cons_val_one, Matrix.cons_val_fin_one, isUnit_iff_eq_one, IsUnit.dvd]) /-- `TSum(p^0) = 1`. -/ private lemma T_sum_ppow_zero : TSum ⟨p ^ 0, pow_pos hp.pos 0⟩ = 1 := by @@ -726,16 +732,12 @@ private lemma T_pp_comm_T_sum_ppow (k : ℕ) : TPp p * TSum ⟨p ^ k, pow_pos hp private lemma T_pp_pow_comm_T_sum_ppow (i k : ℕ) : TPp p ^ i * TSum ⟨p ^ k, pow_pos hp.pos k⟩ = TSum ⟨p ^ k, pow_pos hp.pos k⟩ * TPp p ^ i := by - induction i with - | zero => simp - | succ i ih => rw [pow_succ', HA_mul_assoc, ih, ← HA_mul_assoc, T_pp_comm_T_sum_ppow p hp k, - HA_mul_assoc, ← pow_succ'] + exact (show Commute (TPp p) (TSum ⟨p ^ k, pow_pos hp.pos k⟩) from + T_pp_comm_T_sum_ppow p hp k).pow_left i private lemma T_sum_p_comm_T_pp_pow (i : ℕ) : TSum ⟨p, hp.pos⟩ * TPp p ^ i = TPp p ^ i * TSum ⟨p, hp.pos⟩ := by - rw [show TSum ⟨p, hp.pos⟩ = - TSum ⟨p ^ 1, pow_pos hp.pos 1⟩ from by congr 1; exact (Subtype.ext (pow_one p)).symm] - exact (T_pp_pow_comm_T_sum_ppow p hp i 1).symm + simpa only [pow_one] using (T_pp_pow_comm_T_sum_ppow p hp i 1).symm private lemma T_sum_p_comm_T_pp_pow_T_sum (i k : ℕ) : TSum ⟨p, hp.pos⟩ * (TPp p ^ i * TSum ⟨p ^ k, pow_pos hp.pos k⟩) = @@ -899,7 +901,8 @@ section CoprimeMultiplicativity open Finset in /-- `∏ i, (![a, d]) i (![a, d]) = a * d`. -/ private lemma prod_mk2 (a d : ℕ) : - ∏ i, (![a, d]) i = a * d := by simp [Fin.prod_univ_two] + ∏ i, (![a, d]) i = a * d := by simp only [Nat.succ_eq_add_one, Nat.reduceAdd, Fin.prod_univ_two, + Fin.isValue, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_fin_one] /-- Coprime factoring: `T(a,da) T(b,db) = T(ab,da*db)` when `a*da` and `b*db` are coprime. -/ lemma T_ad_mul_of_coprime (a b da db : ℕ) @@ -951,7 +954,8 @@ lemma mul_injOn_coprime_divisors (m n : ℕ) (hcop : Nat.Coprime m n) : have haeq : a₁ = a₂ := Nat.dvd_antisymm (hcop₁₂.dvd_of_dvd_mul_right (heq ▸ dvd_mul_right a₁ b₁)) (hcop₂₁.dvd_of_dvd_mul_right (heq ▸ dvd_mul_right a₂ b₂)) - have ha_pos : 0 < a₁ := Nat.pos_of_ne_zero fun h => by simp [h] at h₁ + have ha_pos : 0 < a₁ := Nat.pos_of_ne_zero fun h => by simp only [h, zero_dvd_iff, ne_eq, + and_not_self, false_and] at h₁ exact Prod.ext haeq (Nat.eq_of_mul_eq_mul_left ha_pos (haeq ▸ heq)) /-- Theorem 3.24(3a): coprime multiplicativity `T(m) T(n) = T(mn)` when `gcd(m,n) = 1`. -/ @@ -1082,13 +1086,13 @@ private lemma T_sum_mul_peel_prime_summand_rhs (q : ℕ) (hq : q.Prime) (a b : (Nat.Prime.coprime_pow_of_not_dvd hq hq_ndvd_quot).symm)] rfl] congr 1 - have hrs_eq : r + s = a + b := by subst hr; subst hs; simp [min_def, max_def]; split <;> ring + have hrs_eq : r + s = a + b := by subst hr; subst hs; simp only [min_def, max_def]; split <;> ring rw [hrs_eq, show q ^ i * d' * (q ^ i * d') = q ^ (2 * i) * (d' * d') from by ring, show q ^ a * ↑m' * (q ^ b * ↑n') = q ^ (a + b) * (↑m' * ↑n') from by ring, show q ^ (a + b) = q ^ (a + b - 2 * i) * q ^ (2 * i) from by rw [← pow_add]; congr 1; omega, show q ^ (a + b - 2 * i) * q ^ (2 * i) * (↑m' * ↑n') = - q ^ (2 * i) * (q ^ (a + b - 2 * i) * (↑m' * ↑n')) from by ring, + q ^ (2 * i) * (q ^ (a + b - 2 * i) * (↑m' * ↑n')) from by ac_rfl, show q ^ (2 * i) * (d' * d') = q ^ (2 * i) * (d' * d') from rfl, Nat.mul_div_mul_left _ _ (pow_pos hq.pos (2 * i)), Nat.mul_div_assoc _ (Nat.mul_dvd_mul @@ -1106,9 +1110,10 @@ private lemma T_sum_mul_peel_prime_summand (q : ℕ) (hq : q.Prime) (a b : ℕ) have hd'_dvd : d' ∣ Nat.gcd (m' : ℕ) n' := (Nat.mem_divisors.mp hd').1 have hqd' : ¬ q ∣ d' := fun h => hqm (dvd_trans h (dvd_trans hd'_dvd (Nat.gcd_dvd_left _ _))) have hcop_qi_d' : Nat.Coprime (q ^ i) d' := (Nat.Prime.coprime_pow_of_not_dvd hq hqd').symm - have hd'_pos : 0 < d' := Nat.pos_of_ne_zero fun h => by simp [h] at hd'_dvd + have hd'_pos : 0 < d' := Nat.pos_of_ne_zero fun h => by simp only [h, zero_dvd_iff, + Nat.gcd_eq_zero_iff, PNat.ne_zero, and_self] at hd'_dvd rw [mul_smul_comm, smul_smul, - show (↑(q ^ i) : ℤ) * ↑d' = ↑(q ^ i * d') from by push_cast; ring] + show (↑(q ^ i) : ℤ) * ↑d' = ↑(q ^ i * d') from by push_cast; ac_rfl] congr 1 rw [T_pp_pow_eq_T_ad q hq i, show TAd (q ^ i) (q ^ i) * TSum ⟨q ^ (r + s - 2 * i), pow_pos hq.pos _⟩ * @@ -1176,7 +1181,7 @@ private lemma T_sum_mul_peel_prime_aux (q : ℕ) (hq : q.Prime) (a b : ℕ) (_ha rw [Nat.sum_divisors_prime_pow hq] apply Finset.sum_congr rfl; intro i hi; rw [Finset.mem_range] at hi rw [Finset.smul_sum]; apply Finset.sum_congr rfl; intro d' hd' - rw [show (↑q : ℤ) ^ i = (↑(q ^ i) : ℤ) from by push_cast; ring] + rw [show (↑q : ℤ) ^ i = (↑(q ^ i) : ℤ) from by push_cast; ac_rfl] exact T_sum_mul_peel_prime_summand q hq a b m' n' hqm hqn r s hr_def hs_def i hi d' hd' /-- Theorem 3.24(3): `T(m) · T(n) = Σ_{d∣gcd(m,n)} d · T(d,d) · T(mn/d²)`. diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GLn/Basic.lean b/LeanPool/LeanModularForms/HeckeRIngs/GLn/Basic.lean index 13a7f4a321..0278d1154d 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GLn/Basic.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GLn/Basic.lean @@ -70,31 +70,35 @@ def HasIntEntries (g : GL (Fin n) ℚ) : Prop := lemma SLnZ_subgroup_hasIntEntries {g : GL (Fin n) ℚ} (hg : g ∈ SLnZSubgroup n) : HasIntEntries n g := by obtain ⟨σ, rfl⟩ := hg - exact ⟨σ.val, by simp [mapGL_coe_matrix, algebraMap_int_eq]⟩ + exact ⟨σ.val, by simp only [mapGL_coe_matrix, algebraMap_int_eq, map_apply_coe, + RingHom.mapMatrix_apply, Int.coe_castRingHom]⟩ /-- The identity matrix has integer entries. -/ @[simp] lemma hasIntEntries_one : HasIntEntries n (1 : GL (Fin n) ℚ) := - ⟨1, by ext i j; simp [Matrix.map_apply, Matrix.one_apply]⟩ + ⟨1, by ext i j; simp only [Units.val_one, Matrix.one_apply, map_apply, Int.cast_ite, Int.cast_one, + Int.cast_zero]⟩ /-- Product of integer-entry matrices has integer entries. -/ lemma HasIntEntries.mul {a b : GL (Fin n) ℚ} (ha : HasIntEntries n a) (hb : HasIntEntries n b) : HasIntEntries n (a * b) := by obtain ⟨A, hA⟩ := ha obtain ⟨B, hB⟩ := hb - exact ⟨A * B, by ext i j; simp [hA, hB, Matrix.mul_apply, Matrix.map_apply]⟩ + exact ⟨A * B, by ext i j; simp only [Units.val_mul, hA, hB, Matrix.mul_apply, map_apply, + Int.cast_sum, Int.cast_mul]⟩ /-- `det (A.map Int.cast) = ↑(det A)` for integer matrices cast to `ℚ`. -/ lemma det_intMat_cast (A : Matrix (Fin n) (Fin n) ℤ) : (A.map (Int.cast : ℤ → ℚ)).det = (A.det : ℚ) := by rw [show A.map (Int.cast : ℤ → ℚ) = (Int.castRingHom ℚ).mapMatrix A from - by ext i j; simp [RingHom.mapMatrix_apply, Matrix.map_apply], + by ext i j; simp only [map_apply, RingHom.mapMatrix_apply, Int.coe_castRingHom], ← RingHom.map_det, Int.coe_castRingHom] /-- `(A.map cast) * (B.map cast) = (A * B).map cast` for integer matrices cast to `ℚ`. -/ private lemma intMat_map_mul (A B : Matrix (Fin n) (Fin n) ℤ) : (A.map (Int.cast : ℤ → ℚ)) * (B.map (Int.cast : ℤ → ℚ)) = - (A * B).map (Int.cast : ℤ → ℚ) := by ext i j; simp [Matrix.mul_apply, Matrix.map_apply] + (A * B).map (Int.cast : ℤ → ℚ) := by ext i j; simp only [Matrix.mul_apply, map_apply, + Int.cast_sum, Int.cast_mul] /-- The submonoid of `GL_n(ℚ)` consisting of invertible matrices with integer entries and positive determinant. This is Shimura's `Δ`. -/ @@ -113,8 +117,10 @@ section Pair lemma SLnZ_le_posDetInt : (SLnZSubgroup n).toSubmonoid ≤ posDetIntSubmonoid n := by intro g hg; rw [Subgroup.mem_toSubmonoid, MonoidHom.mem_range] at hg obtain ⟨A, rfl⟩ := hg - exact ⟨⟨A.val, by simp [mapGL_coe_matrix, algebraMap_int_eq]⟩, - by simp [det_intMat_cast, A.prop]⟩ + exact ⟨⟨A.val, by simp only [mapGL_coe_matrix, algebraMap_int_eq, map_apply_coe, + RingHom.mapMatrix_apply, Int.coe_castRingHom]⟩, + by simp only [mapGL_coe_matrix, algebraMap_int_eq, map_apply_coe, RingHom.mapMatrix_apply, + Int.coe_castRingHom, det_intMat_cast, A.prop, Int.cast_one, zero_lt_one]⟩ /-! ### Helper lemmas for the commensurator proof (Shimura Lemma 3.10) -/ @@ -171,7 +177,7 @@ private lemma det_entrywise_div_eq_one (d : ℤ) (P : Matrix (Fin n) (Fin n) ℤ rw [← det_intMat_cast, show (Matrix.of fun i j => P i j / d).map (Int.cast : ℤ → ℚ) = (d : ℚ)⁻¹ • (P.map (Int.cast : ℤ → ℚ)) from by ext i j; simp only [Matrix.map_apply, Matrix.smul_apply, smul_eq_mul, Matrix.of_apply] - rw [Int.cast_div (hdvd i j) (Int.cast_ne_zero.mpr hd)]; ring, + rw [Int.cast_div (hdvd i j) (Int.cast_ne_zero.mpr hd)]; ac_rfl, det_smul, Fintype.card_fin, det_intMat_cast, hdet, inv_pow] exact inv_mul_cancel₀ (pow_ne_zero n hdQ) diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GLn/CoprimeMul.lean b/LeanPool/LeanModularForms/HeckeRIngs/GLn/CoprimeMul.lean index f25c24ace2..2aecd1e4a8 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GLn/CoprimeMul.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GLn/CoprimeMul.lean @@ -62,13 +62,13 @@ lemma DivChain_mul (a b : Fin n → ℕ) (ha : DivChain n a) (hb : DivChain n b) ext i j; simp only [Matrix.mul_apply, Matrix.diagonal_apply] by_cases hij : i = j · subst hij; rw [Finset.sum_eq_single i] - · simp - · intro b' _ hb'; simp [hb'] + · simp only [↓reduceIte, Nat.cast_mul] + · intro b' _ hb'; simp only [hb', ↓reduceIte, mul_zero] · intro h; exact absurd (Finset.mem_univ i) h · simp only [hij, ↓reduceIte]; apply Finset.sum_eq_zero; intro k _ by_cases hik : i = k - · subst hik; simp [hij] - · simp [hik] + · subst hik; simp only [↓reduceIte, hij, mul_zero] + · simp only [hik, ↓reduceIte, mul_ite, zero_mul, mul_zero, ite_self] variable [NeZero n] @@ -308,19 +308,19 @@ private lemma slTransvec_CRT (d d' : ℕ) (hcop : Nat.Coprime d d') refine ⟨slTransvec n i j hij (c * d * Nat.gcdA d d'), slTransvec n i j hij (c * d' * Nat.gcdB d d'), ?_, ?_, ?_⟩ · rw [slTransvec_mul]; congr 1; linear_combination c * hbez - · exact slTransvec_congMod n d i j hij _ ⟨c * Nat.gcdA d d', by ring⟩ - · exact slTransvec_congMod n d' i j hij _ ⟨c * Nat.gcdB d d', by ring⟩ + · exact slTransvec_congMod n d i j hij _ ⟨c * Nat.gcdA d d', by ac_rfl⟩ + · exact slTransvec_congMod n d' i j hij _ ⟨c * Nat.gcdB d d', by ac_rfl⟩ omit [NeZero n] in private lemma congMod_one (d : ℕ) : congMod n d 1 := - fun i j => by simp [SpecialLinearGroup.coe_one, Matrix.one_apply] + fun i j => by simp only [coe_one, Matrix.one_apply, sub_self, dvd_zero] omit [NeZero n] in private lemma congMod_mul (d : ℕ) (a b : SpecialLinearGroup (Fin n) ℤ) (ha : congMod n d a) (hb : congMod n d b) : congMod n d (a * b) := by intro i j; simp only [SpecialLinearGroup.coe_mul, Matrix.mul_apply] have h1 : ∑ k : Fin n, (if i = k then (1 : ℤ) else 0) * b.1 k j = b.1 i j := by - simp [Finset.mem_univ] + simp only [ite_mul, one_mul, zero_mul, Finset.sum_ite_eq, Finset.mem_univ, ↓reduceIte] have h2 : ∑ k, (a.1 i k - if i = k then 1 else 0) * b.1 k j = (∑ k, a.1 i k * b.1 k j) - b.1 i j := by rw [← h1, ← Finset.sum_sub_distrib]; congr 1; ext k; ring @@ -469,10 +469,10 @@ lemma conjugate_congruent_mem_SLnZ (a : Fin n → ℕ) (ha : ∀ i, 0 < a i) (_h simp only [Units.val_mul, hτ_val, hM_val, diagMat_val _ _ ha] have h_mul_map : ∀ (A B : Matrix (Fin n) (Fin n) ℤ), (A * B).map (Int.cast : ℤ → ℚ) = A.map Int.cast * B.map Int.cast := by - intro A B; ext i j; simp [Matrix.mul_apply, Matrix.map_apply] + intro A B; ext i j; simp only [map_apply, Matrix.mul_apply, Int.cast_sum, Int.cast_mul] have h_diag_map : (Matrix.diagonal (fun i => (a i : ℤ))).map (Int.cast : ℤ → ℚ) = Matrix.diagonal (fun i => (a i : ℚ)) := by - ext i j; simp [Matrix.map_apply, Matrix.diagonal_apply] + ext i j; simp only [map_apply, diagonal_apply, Int.cast_ite, Int.cast_natCast, Int.cast_zero] rw [← h_diag_map, ← h_mul_map, ← h_mul_map, h_int_eq] exact eq_mul_inv_iff_mul_eq.mpr h_Q_eq.symm @@ -516,10 +516,10 @@ lemma inv_conjugate_congruent_mem_SLnZ (b : Fin n → ℕ) (hb : ∀ i, 0 < b i) simp only [Units.val_mul, hτ_val, hN_val, diagMat_val _ _ hb] have h_mul_map : ∀ (A B : Matrix (Fin n) (Fin n) ℤ), (A * B).map (Int.cast : ℤ → ℚ) = A.map Int.cast * B.map Int.cast := by - intro A B; ext i j; simp [Matrix.mul_apply, Matrix.map_apply] + intro A B; ext i j; simp only [map_apply, Matrix.mul_apply, Int.cast_sum, Int.cast_mul] have h_diag_map : (Matrix.diagonal (fun i => (b i : ℤ))).map (Int.cast : ℤ → ℚ) = Matrix.diagonal (fun i => (b i : ℚ)) := by - ext i j; simp [Matrix.map_apply, Matrix.diagonal_apply] + ext i j; simp only [map_apply, diagonal_apply, Int.cast_ite, Int.cast_natCast, Int.cast_zero] rw [← h_diag_map, ← h_mul_map, ← h_mul_map, h_int_eq] calc mapGL ℚ ⟨N, hN_det⟩ = (diagMat n b)⁻¹ * (diagMat n b * mapGL ℚ ⟨N, hN_det⟩) := by rw [inv_mul_cancel_left] @@ -538,9 +538,9 @@ lemma doubleCoset_mul_coprime_mem (a b : Fin n → ℕ) obtain ⟨τ₁, τ₂, hτ, hτ₁, hτ₂⟩ := SLnZ_CRT_decomposition n (∏ i, a i) (∏ i, b i) (Finset.prod_pos (fun i _ => ha_pos i)) (Finset.prod_pos (fun i _ => hb_pos i)) hcop τ obtain ⟨σ₁, hσ₁⟩ := conjugate_congruent_mem_SLnZ n a ha_pos ha τ₁ - (fun i j => by convert hτ₁ i j using 1; simp) + (fun i j => by convert hτ₁ i j using 1; simp only [Nat.cast_prod]) obtain ⟨σ₂, hσ₂⟩ := inv_conjugate_congruent_mem_SLnZ n b hb_pos hb τ₂ - (fun i j => by convert hτ₂ i j using 1; simp) + (fun i j => by convert hτ₂ i j using 1; simp only [Nat.cast_prod]) rw [DoubleCoset.mem_doubleCoset] refine ⟨(σ₁ : GL (Fin n) ℚ), coe_mem_SLnZ n σ₁, (σ₂ : GL (Fin n) ℚ), coe_mem_SLnZ n σ₂, ?_⟩ @@ -615,7 +615,7 @@ private lemma GLnQ_mem_SLnZ_of_coprime_scaling (C : GL (Fin n) ℚ) have hst_Q : (s : ℚ) * (pa : ℚ) + (t : ℚ) * (pb : ℚ) = 1 := by exact_mod_cast hst have := congr_arg (· * (↑C : Matrix (Fin n) (Fin n) ℚ) i j) hst_Q simp only [add_mul, one_mul] at this; linarith only [this] - rw [h1, hza, hzb]; push_cast; ring + rw [h1, hza, hzb]; push_cast; ac_rfl set N : Matrix (Fin n) (Fin n) ℤ := Matrix.of fun i j => (h_int i j).choose have hN_eq : ∀ i j, (↑C : Matrix (Fin n) (Fin n) ℚ) i j = ((N i j : ℤ) : ℚ) := fun i j => (h_int i j).choose_spec @@ -653,9 +653,9 @@ private lemma diagConj_scaling (a : Fin n → ℕ) (ha : ∀ i, 0 < a i) rw [this, h_entry] have hai_ne_int : (a i : ℤ) ≠ 0 := ne_of_gt (Int.natCast_pos.mpr (ha i)) rw [show ((∏ k, (a k : ℤ)) / (a i : ℤ) * σ.val i j * (a j : ℤ) : ℤ) = - (∏ k, (a k : ℤ)) / (a i : ℤ) * ((σ.val i j : ℤ) * (a j : ℤ)) from by ring] + (∏ k, (a k : ℤ)) / (a i : ℤ) * ((σ.val i j : ℤ) * (a j : ℤ)) from by ac_rfl] push_cast [Int.cast_div h_dvd (show ((a i : ℤ) : ℚ) ≠ 0 from Int.cast_ne_zero.mpr hai_ne_int)] - ring + ac_rfl omit [NeZero n] in private lemma diagSandwich_scaling (b : Fin n → ℕ) (hb : ∀ i, 0 < b i) @@ -695,10 +695,10 @@ private lemma diagSandwich_scaling (b : Fin n → ℕ) (hb : ∀ i, 0 < b i) have hbq_ne_int : (b q : ℤ) ≠ 0 := Int.natCast_ne_zero.mpr (hb q).ne' refine ⟨(∏ k, (b k : ℤ)) / (b q : ℤ) * (b p : ℤ) * G.val p q, ?_⟩ have h_div_eq : (∏ k, (b k : ℚ)) * ((b p : ℚ) * ↑(G.val p q) * ((b q : ℚ)⁻¹)) = - (∏ k, (b k : ℚ)) / (b q : ℚ) * ((b p : ℚ) * ↑(G.val p q)) := by rw [div_eq_mul_inv]; ring + (∏ k, (b k : ℚ)) / (b q : ℚ) * ((b p : ℚ) * ↑(G.val p q)) := by rw [div_eq_mul_inv]; ac_rfl rw [h_div_eq] push_cast [Int.cast_div h_dvd (show ((b q : ℤ) : ℚ) ≠ 0 from Int.cast_ne_zero.mpr hbq_ne_int)] - ring + ac_rfl rw [h_C_entry, Finset.mul_sum]; simp_rw [Finset.mul_sum, mul_assoc] refine ⟨∑ p, ∑ q, (F.val i p) * (h_D_scale p q).choose * (E.val q j), ?_⟩ push_cast; apply Finset.sum_congr rfl; intro p _; apply Finset.sum_congr rfl; intro q _ @@ -707,7 +707,7 @@ private lemma diagSandwich_scaling (b : Fin n → ℕ) (hb : ∀ i, 0 < b i) Int.coe_castRingHom, algebraMap_int_eq, Matrix.map_apply] set z := (h_D_scale p q).choose have h1 : (∏ k, (b k : ℚ)) * ((↑(F.val i p) : ℚ) * (D_mat p q * (↑(E.val q j) : ℚ))) = - (↑(F.val i p) : ℚ) * ((∏ k, (b k : ℚ)) * D_mat p q) * (↑(E.val q j) : ℚ) := by ring + (↑(F.val i p) : ℚ) * ((∏ k, (b k : ℚ)) * D_mat p q) * (↑(E.val q j) : ℚ) := by ac_rfl rw [h1, hDpq] omit [NeZero n] in @@ -725,8 +725,8 @@ private lemma coprime_coupling_mem_H (a b : Fin n → ℕ) RingHom.mapMatrix_apply, algebraMap_int_eq, Int.coe_castRingHom] rw [show (σ.val.map (Int.cast : ℤ → ℚ)).det = 1 from by rw [show σ.val.map (Int.cast : ℤ → ℚ) = (Int.castRingHom ℚ).mapMatrix σ.val from by - ext i j; simp [RingHom.mapMatrix_apply, Matrix.map_apply], - ← RingHom.map_det]; simp [σ.prop]] + ext i j; simp only [map_apply, RingHom.mapMatrix_apply, Int.coe_castRingHom], + ← RingHom.map_det]; simp only [σ.prop, eq_intCast, Int.cast_one] ] rw [mul_one, ← Matrix.det_mul, ← Units.val_mul, inv_mul_cancel, Units.val_one, Matrix.det_one] have h_scale_a : ∀ i j, ∃ z : ℤ, (↑(∏ i, a i) : ℚ) * (↑C : Matrix (Fin n) (Fin n) ℚ) i j = z := by diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GLn/CosetDecomposition.lean b/LeanPool/LeanModularForms/HeckeRIngs/GLn/CosetDecomposition.lean index 89655d1739..d8ea61f984 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GLn/CosetDecomposition.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GLn/CosetDecomposition.lean @@ -47,12 +47,12 @@ private lemma det_upper_tri {k : ℕ} {M : Matrix (Fin k) (Fin k) ℤ} M.det = ∏ i, M i i := by simp only [det_apply] rw [Finset.sum_eq_single_of_mem 1 (Finset.mem_univ 1)] - · simp + · simp only [Equiv.Perm.sign_one, Equiv.Perm.coe_one, id_eq, one_smul] · intro σ _ hσ have hne : ∃ i, σ i ≠ i := by by_contra hc; push Not at hc - exact hσ (Equiv.Perm.ext (fun i => by simp [hc i])) - suffices hprod : ∏ i, M (σ i) i = 0 by simp [hprod] + exact hσ (Equiv.Perm.ext (fun i => by simp only [hc i, Equiv.Perm.coe_one, id_eq])) + suffices hprod : ∏ i, M (σ i) i = 0 by simp only [hprod, smul_zero] set S := Finset.univ.filter (fun i : Fin k => σ i ≠ i) have hS : S.Nonempty := by obtain ⟨i, hi⟩ := hne @@ -91,12 +91,14 @@ def upperTriMat (a : Fin n → ℕ) (hdiv : DivChain n a) (B : UpperTriRep n a h @[simp] lemma upperTriMat_apply_lt (a : Fin n → ℕ) (hdiv : DivChain n a) (B : UpperTriRep n a hdiv) {i j : Fin n} (h : i < j) : - upperTriMat n a hdiv B i j = (a i : ℤ) * (B ⟨(i, j), h⟩ : ℕ) := by simp [upperTriMat, h] + upperTriMat n a hdiv B i j = (a i : ℤ) * (B ⟨(i, j), h⟩ : ℕ) := by simp only [upperTriMat, h, + ↓reduceDIte] @[simp] lemma upperTriMat_apply_diag (a : Fin n → ℕ) (hdiv : DivChain n a) (B : UpperTriRep n a hdiv) (i : Fin n) : - upperTriMat n a hdiv B i i = (a i : ℤ) := by simp [upperTriMat] + upperTriMat n a hdiv B i i = (a i : ℤ) := by simp only [upperTriMat, lt_self_iff_false, + ↓reduceDIte, ↓reduceIte] lemma upperTriMat_apply_gt (a : Fin n → ℕ) (hdiv : DivChain n a) (B : UpperTriRep n a hdiv) {i j : Fin n} (h : j < i) : @@ -105,7 +107,7 @@ lemma upperTriMat_apply_gt (a : Fin n → ℕ) (hdiv : DivChain n a) (B : UpperT lemma upperTriMat_det (a : Fin n → ℕ) (hdiv : DivChain n a) (B : UpperTriRep n a hdiv) : (upperTriMat n a hdiv B).det = ∏ i, (a i : ℤ) := by rw [det_upper_tri (fun i j h => upperTriMat_apply_gt n a hdiv B h)] - congr 1; ext i; simp + congr 1; ext i; simp only [upperTriMat_apply_diag] lemma upperTriMat_det_pos (a : Fin n → ℕ) (hpos : ∀ i, 0 < a i) (hdiv : DivChain n a) (B : UpperTriRep n a hdiv) : @@ -163,7 +165,7 @@ def unipMat (a : Fin n → ℕ) (hdiv : DivChain n a) (B : UpperTriRep n a hdiv) lemma unipMat_det (a : Fin n → ℕ) (hdiv : DivChain n a) (B : UpperTriRep n a hdiv) : (unipMat n a hdiv B).det = 1 := by rw [det_upper_tri (fun i j h => by simp [unipMat, not_lt.mpr (le_of_lt h), ne_of_gt h])] - simp [unipMat] + simp only [unipMat, lt_self_iff_false, ↓reduceDIte, ↓reduceIte, Finset.prod_const_one] /-- Each upper-triangular representative lies in `Γ · diag(a) · Γ`. -/ theorem upperTriGL_mem_doubleCoset (a : Fin n → ℕ) (hpos : ∀ i, 0 < a i) @@ -190,7 +192,8 @@ theorem upperTriGL_mem_doubleCoset (a : Fin n → ℕ) (hpos : ∀ i, 0 < a i) simp only [upperTriMat, unipMat] split_ifs <;> push_cast <;> ring · intro k _ hk - simp [Ne.symm hk] + simp only [Ne.symm hk, ↓reduceIte, map_apply_coe, RingHom.mapMatrix_apply, Int.coe_castRingHom, + map_apply, zero_mul] · intro h; exact absurd (Finset.mem_univ i) h /-- For `k ≠ j` and columns `< j` already identity-like, the product `σ i k * M₂ k j` @@ -226,9 +229,12 @@ private lemma coset_sum_eq {a : Fin n → ℕ} {hdiv : DivChain n a} rw [Finset.sum_eq_single_of_mem i (Finset.mem_erase.mpr ⟨Fin.ne_of_lt hij, Finset.mem_univ i⟩)] · rw [h_sum_rest i (Fin.ne_of_lt hij)]; simp [hij] - · simp_all + · simp_all only [Fin.val_fin_lt, ne_eq, and_true, Finset.mem_erase, Finset.mem_univ, + not_false_eq_true, ↓reduceIte, implies_true] · simp only [hij, ite_false] - apply Finset.sum_eq_zero; simp_all + apply Finset.sum_eq_zero; simp_all only [Fin.val_fin_lt, ne_eq, and_false, ↓reduceIte, + mul_eq_zero, not_lt, Finset.mem_erase, Finset.mem_univ, and_true, not_false_eq_true, + implies_true] /-- When `i < j`, the entry `σ i j` must be zero: the bounded difference of `B₁` and `B₂` cannot absorb a nonzero integer multiple of `a_j / a_i`. -/ @@ -275,7 +281,8 @@ theorem upperTriMat_distinct_cosets (a : Fin n → ℕ) have hmat : upperTriMat n a hdiv B₁ = σ.val * upperTriMat n a hdiv B₂ := by have h := congr_arg Units.val heq have hσ_val : (↑(mapGL ℚ σ) : Matrix _ _ ℚ) = σ.val.map (Int.cast) := by - simp [mapGL_coe_matrix, algebraMap_int_eq, RingHom.mapMatrix_apply] + simp only [mapGL_coe_matrix, algebraMap_int_eq, map_apply_coe, RingHom.mapMatrix_apply, + Int.coe_castRingHom] simp only [Units.val_mul, upperTriGL_val, hσ_val] at h ext i j have hij := congr_fun (congr_fun h i) j @@ -295,7 +302,8 @@ theorem upperTriMat_distinct_cosets (a : Fin n → ℕ) intro j hj i rcases Nat.lt_succ_iff_lt_or_eq.mp hj with hlt | hjeq · exact ih j hlt i - · have h_eq : M₁ i j = ∑ k : Fin n, σ.val i k * M₂ k j := by rw [hmat]; simp [Matrix.mul_apply] + · have h_eq : M₁ i j = ∑ k : Fin n, σ.val i k * M₂ k j := by rw [hmat]; simp only [ + Matrix.mul_apply] have ih' : ∀ (k : Fin n), k.val < j.val → ∀ (i : Fin n), σ.val i k = if i = k then 1 else 0 := fun k hk => ih k (hjeq ▸ hk) @@ -307,12 +315,12 @@ theorem upperTriMat_distinct_cosets (a : Fin n → ℕ) (by simp only [hij, ↓reduceIte] at h_eq; exact h_eq) · simp only [lt_irrefl, ↓reduceIte, M₁, upperTriMat_apply_diag] at h_eq ⊢ have h_ai_ne : (a i : ℤ) ≠ 0 := by exact_mod_cast (hpos i).ne' - exact mul_right_cancel₀ h_ai_ne (by linarith) + exact mul_right_cancel₀ h_ai_ne (by linarith only [h_eq]) · rw [ite_eq_right (Fin.ne_of_gt hij)] simp only [show ¬(i < j) from not_lt.mpr (le_of_lt hij), ↓reduceIte, M₁, upperTriMat_apply_gt _ _ _ _ hij] at h_eq have : (a j : ℤ) ≠ 0 := by exact_mod_cast (hpos j).ne' - exact (mul_eq_zero.mp (by linarith)).resolve_right this + exact (mul_eq_zero.mp (by linarith only [h_eq])).resolve_right this /-- The number of upper-triangular representatives equals `∏_{i fin_cases j <;> simp only [τ, τ_mat, Matrix.of_apply, Matrix.cons_val', Fin.isValue] <;> - push_cast <;> (try rw [hcQ]) <;> (try rw [ha1]) <;> ring + push_cast <;> (try rw [hcQ]) <;> (try rw [ha1]) <;> ac_rfl private lemma Gamma0_of_conj_diagMat_mem (a : Fin 2 → ℕ) (ha : ∀ i, 0 < a i) (k : ℕ) (h_ratio : a 1 / a 0 = p ^ k) (h_dvd_a : a 0 ∣ a 1) (σ : SL(2, ℤ)) @@ -397,7 +400,7 @@ private lemma Gamma0_of_conj_diagMat_mem (a : Fin 2 → ℕ) (ha : ∀ i, 0 < a Matrix.map_apply] at this exact this have h_σ₁₀ : (σ.1 1 0 : ℚ) = ↑(p ^ k) * (τ.1 1 0 : ℚ) := by - rw [ha1] at h_entry; field_simp at h_entry ⊢; linarith + rw [ha1] at h_entry; field_simp at h_entry ⊢; linarith only [h_entry] exact ⟨τ.1 1 0, by exact_mod_cast h_σ₁₀⟩ private lemma conjDiag_relIndex_eq_Gamma0_index diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GLn/DiagonalCosets.lean b/LeanPool/LeanModularForms/HeckeRIngs/GLn/DiagonalCosets.lean index 606b2824b8..a57e989085 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GLn/DiagonalCosets.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GLn/DiagonalCosets.lean @@ -67,7 +67,8 @@ noncomputable def diagMat (a : Fin n → ℕ) : GL (Fin n) ℚ := lemma diagMat_hasIntEntries (a : Fin n → ℕ) (ha : ∀ i, 0 < a i) : HasIntEntries n (diagMat n a) := ⟨Matrix.diagonal (fun i => (a i : ℤ)), - by ext i j; simp [ha, Matrix.diagonal_apply, Matrix.map_apply]⟩ + by ext i j; simp only [ha, implies_true, diagMat_val, diagonal_apply, map_apply, Int.cast_ite, + Int.cast_natCast, Int.cast_zero]⟩ lemma diagMat_det_pos (a : Fin n → ℕ) (ha : ∀ i, 0 < a i) : 0 < (↑(diagMat n a) : Matrix (Fin n) (Fin n) ℚ).det := by @@ -80,11 +81,12 @@ lemma diagMat_mem_posDetInt (a : Fin n → ℕ) (ha : ∀ i, 0 < a i) : lemma diagMat_det (a : Fin n → ℕ) (ha : ∀ i, 0 < a i) : (↑(diagMat n a) : Matrix (Fin n) (Fin n) ℚ).det = ∏ i, (a i : ℚ) := by - simp [ha, Matrix.det_diagonal] + rw [diagMat_val n a ha, Matrix.det_diagonal] lemma diagMat_one : diagMat n (fun _ => 1) = 1 := by simp only [diagMat, dite_eq_left (fun _ => Nat.one_pos)] - apply Units.ext; ext i j; simp [Matrix.one_apply] + apply Units.ext; ext i j; simp only [Nat.cast_one, diagonal_one, + GeneralLinearGroup.val_mkOfDetNeZero, Matrix.one_apply, Units.val_one] end Diagonal @@ -146,16 +148,8 @@ noncomputable def TElem (a : Fin n → ℕ) : HeckeAlgebra n := lemma T_diag_rep_mem_doubleCoset (a : Fin n → ℕ) (ha : ∀ i, 0 < a i) : (HeckeCoset.rep (TDiag a) : GL (Fin n) ℚ) ∈ DoubleCoset.doubleCoset (diagMat n a : GL (Fin n) ℚ) (GLPair n).H (GLPair n).H := by - have h1 := HeckeCoset.rep_mem (TDiag a) - rw [HeckeCoset.toSet_eq_rep] at h1 - have h2 : (⟦HeckeCoset.rep (TDiag a)⟧ : HeckeCoset (GLPair n)) = TDiag a := Quotient.out_eq _ - simp only [TDiag] at h2 - have h3 : DoubleCoset.doubleCoset (HeckeCoset.rep (TDiag a) : GL (Fin n) ℚ) - (GLPair n).H (GLPair n).H = - DoubleCoset.doubleCoset (↑(diagMatDelta n a) : GL (Fin n) ℚ) - (GLPair n).H (GLPair n).H := - (HeckeCoset.eq_iff _ _).mp h2 - rw [h3] at h1; rwa [diagMat_delta_val n a ha] at h1 + simpa only [TDiag, HeckeCoset.toSet_mk, diagMat_delta_val n a ha] using + HeckeCoset.rep_mem (TDiag a) /-- Decompose the TDiag representative as L * diagMat * R with L, R in H. -/ lemma T_diag_rep_decompose (a : Fin n → ℕ) (ha : ∀ i, 0 < a i) : @@ -173,12 +167,9 @@ lemma T_diag_eq_iff (a b : Fin n → ℕ) (ha : ∀ i, 0 < a i) (hb : ∀ i, 0 < TDiag a = TDiag b ↔ DoubleCoset.doubleCoset (diagMat n a : GL (Fin n) ℚ) (SLnZSubgroup n) (SLnZSubgroup n) = DoubleCoset.doubleCoset (diagMat n b : GL (Fin n) ℚ) (SLnZSubgroup n) (SLnZSubgroup n) := by - constructor - · intro h; have := congr_arg HeckeCoset.toSet h - simp only [TDiag, HeckeCoset.toSet_mk, diagMat_delta_val n a ha, - diagMat_delta_val n b hb] at this; exact this - · intro h; simp only [TDiag]; rw [HeckeCoset.eq_iff] - simp only [diagMat_delta_val n a ha, diagMat_delta_val n b hb]; exact h + have h := HeckeCoset.eq_iff (diagMatDelta n a) (diagMatDelta n b) + rw [diagMat_delta_val n a ha, diagMat_delta_val n b hb] at h + exact h end TDiag @@ -221,12 +212,7 @@ section SmithNormalForm private lemma mulVecLin_injective_of_det_ne_zero (A : Matrix (Fin n) (Fin n) ℤ) (hdet : A.det ≠ 0) : Function.Injective A.mulVecLin := by - rw [← LinearMap.ker_eq_bot, Matrix.ker_mulVecLin_eq_bot_iff] - intro v hv - have h1 : A.adjugate *ᵥ (A *ᵥ v) = A.det • v := - by rw [mulVec_mulVec, adjugate_mul, smul_mulVec, one_mulVec] - rw [hv, mulVec_zero] at h1; ext i - have := congr_fun h1.symm i; simp_all + exact Matrix.mulVec_injective_of_det_ne_zero hdet private lemma finrank_range_mulVecLin (A : Matrix (Fin n) (Fin n) ℤ) (hdet : A.det ≠ 0) : Module.finrank ℤ (LinearMap.range A.mulVecLin) = Module.finrank ℤ (Fin n → ℤ) := @@ -249,11 +235,13 @@ private lemma sign_correct_unit_transform (A : Matrix (Fin n) (Fin n) ℤ) (d : · exfalso; nlinarith [hLQ_one] · exfalso; nlinarith [hLQ_one] · have hn : 0 < n := by - by_contra h; push Not at h; interval_cases n; simp [Matrix.det_isEmpty] at hLd + by_contra h; push Not at h; interval_cases n; simp only [det_isEmpty, Int.reduceNeg, + reduceCtorEq] at hLd have : NeZero n := ⟨by omega⟩ set flip : Matrix (Fin n) (Fin n) ℤ := Matrix.diagonal (Function.update 1 0 (-1)) have hflip_det : flip.det = -1 := by - rw [Matrix.det_diagonal, Finset.prod_update_of_mem (Finset.mem_univ 0)]; simp + rw [Matrix.det_diagonal, Finset.prod_update_of_mem (Finset.mem_univ 0)]; simp only [ + Int.reduceNeg, Pi.one_apply, Finset.prod_const_one, mul_one] have hflip_sq : flip * flip = 1 := by rw [Matrix.diagonal_mul_diagonal]; ext i j simp only [Matrix.diagonal_apply, Matrix.one_apply] @@ -294,9 +282,9 @@ theorem exists_diagonal_of_posdet (A : Matrix (Fin n) (Fin n) ℤ) (hdet : 0 < A set Q_mat : Matrix (Fin n) (Fin n) ℤ := Matrix.of (fun k j => r j k) with hQ_def have hmat_eq : A * Q_mat = P_mat * Matrix.diagonal a := by ext k j; simp only [Matrix.mul_apply, hQ_def, hP_def, Matrix.of_apply, Matrix.diagonal_apply] - conv_lhs => rw [show ∑ l, A k l * r j l = (A *ᵥ r j) k from by simp [mulVec, dotProduct]] + conv_lhs => rw [show ∑ l, A k l * r j l = (A *ᵥ r j) k from by simp only [mulVec, dotProduct] ] rw [hkey j]; simp only [Pi.smul_apply, smul_eq_mul] - simp [Finset.sum_ite_eq', Finset.mem_univ, mul_comm] + simp only [mul_comm, ite_mul, zero_mul, Finset.sum_ite_eq', Finset.mem_univ, ↓reduceIte] have hP_eq : P_mat = e.toMatrix b' := by ext k j; change b' j k = e.toMatrix b' k j; rw [e.toMatrix_apply, Pi.basisFun_repr] have hP_unit : IsUnit P_mat.det := hP_eq ▸ e.isUnit_det b' @@ -337,7 +325,7 @@ theorem exists_diagonal_of_posdet (A : Matrix (Fin n) (Fin n) ℤ) (hdet : 0 < A set d := fun i => |a i| with hd_def have hd_pos : ∀ i, 0 < d i := fun i => abs_pos.mpr (ha_ne i) set sv := fun i => if (0 : ℤ) < a i then (1 : ℤ) else -1 with hsv_def - have hsv_sq : ∀ i, sv i * sv i = 1 := fun i => by simp only [hsv_def]; split_ifs <;> ring + have hsv_sq : ∀ i, sv i * sv i = 1 := fun i => by simp only [hsv_def]; split_ifs <;> ac_rfl have hsv_mul_d : ∀ i, sv i * d i = a i := by intro i; simp only [hsv_def, hd_def]; rcases lt_trichotomy (a i) 0 with h | h | h · rw [ite_eq_right (not_lt.mpr h.le), abs_of_neg h]; ring @@ -346,7 +334,7 @@ theorem exists_diagonal_of_posdet (A : Matrix (Fin n) (Fin n) ℤ) (hdet : 0 < A have h_sd : Matrix.diagonal a = Matrix.diagonal sv * Matrix.diagonal d := by rw [Matrix.diagonal_mul_diagonal]; congr 1; ext i; exact (hsv_mul_d i).symm have hss : Matrix.diagonal sv * Matrix.diagonal sv = 1 := by - simp_all + simp only [Matrix.diagonal_mul_diagonal, hsv_sq, Matrix.diagonal_one] have hs_det_unit : IsUnit (Matrix.diagonal sv).det := by rw [Matrix.det_diagonal]; exact IsUnit.of_mul_eq_one _ (by rw [← Finset.prod_mul_distrib]; exact Finset.prod_eq_one (fun i _ => hsv_sq i)) @@ -389,13 +377,14 @@ private lemma gcd_2x2_det_L (a b : ℤ) (ha : 0 < a) : _ = a.gcdA b * a + a.gcdB b * b := by rw [Int.ediv_mul_cancel (Int.gcd_dvd_left a b), Int.ediv_mul_cancel (Int.gcd_dvd_right a b)] - _ = a * a.gcdA b + b * a.gcdB b := by ring + _ = a * a.gcdA b + b * a.gcdB b := by ac_rfl _ = ↑(a.gcd b) := (Int.gcd_eq_gcd_ab a b).symm private lemma gcd_2x2_det_R (a b : ℤ) : let g : ℤ := ↑(a.gcd b); let t := a.gcdB b; let q := b / g (!![(1 : ℤ), -(t * q); 1, 1 - t * q] : Matrix (Fin 2) (Fin 2) ℤ).det = 1 := by - simp [det_fin_two] + simp only [det_fin_two, Fin.isValue, of_apply, cons_val', cons_val_zero, cons_val_fin_one, + cons_val_one, one_mul, mul_one, sub_neg_eq_add, sub_add_cancel] private lemma gcd_2x2_mul (a b : ℤ) : let g : ℤ := ↑(a.gcd b); let s := a.gcdA b; let t := a.gcdB b @@ -422,7 +411,7 @@ private lemma gcd_2x2_mul (a b : ℤ) : _ = s * a + t * b := by rw [hpg, hqg] _ = g := hbez linarith only [this] - have : (1 - (s * p + t * q)) * (t * q * g) = t * q * ((1 - (s * p + t * q)) * g) := by ring + have : (1 - (s * p + t * q)) * (t * q * g) = t * q * ((1 - (s * p + t * q)) * g) := by ac_rfl linarith only [h2, mul_eq_zero_of_right (t * q) h2] · rw [← hpg, ← hqg]; ring · rw [← hpg, ← hqg]; ring @@ -434,20 +423,23 @@ private noncomputable def genEquiv (k : ℕ) (j : Fin (k + 2)) (_hj : j.val ≠ private lemma diagonal_submatrix_genEquiv (k : ℕ) (j : Fin (k + 2)) (hj : j.val ≠ 0) (d : Fin (k + 2) → ℤ) : (Matrix.diagonal (d ∘ (genEquiv k j hj).symm)).submatrix (genEquiv k j hj) (genEquiv k j hj) = Matrix.diagonal d := by - ext i m; simp [submatrix_apply, diagonal_apply] + ext i m; simp only [submatrix_apply, diagonal_apply, EmbeddingLike.apply_eq_iff_eq, + Function.comp_apply, Equiv.symm_apply_apply] private lemma genEquiv_zero (k : ℕ) (j : Fin (k + 2)) (hj : j.val ≠ 0) : genEquiv k j hj ⟨0, by omega⟩ = Sum.inl ⟨0, by omega⟩ := by simp only [genEquiv, Equiv.trans_apply] - rw [Equiv.swap_apply_of_ne_of_ne (by intro h; simp at h) (fun h => hj (by rw [← h]))] + rw [Equiv.swap_apply_of_ne_of_ne (by intro h; simp only [Fin.zero_eta, Fin.mk_one, + zero_ne_one] at h) (fun h => hj (by rw [← h]))] show finEquivSum k ⟨0, by omega⟩ = _ - unfold finEquivSum; simp [Equiv.trans_apply, Fin.castOrderIso]; rfl + unfold finEquivSum; simp only [Fin.castOrderIso, Fin.zero_eta, Equiv.trans_apply, Equiv.coe_fn_mk, + Fin.cast_zero, Fin.isValue]; rfl private lemma genEquiv_j (k : ℕ) (j : Fin (k + 2)) (hj : j.val ≠ 0) : genEquiv k j hj j = Sum.inl ⟨1, by omega⟩ := by simp only [genEquiv, Equiv.trans_apply, Equiv.swap_apply_right] change finEquivSum k ⟨1, by omega⟩ = _; unfold finEquivSum - simp [Equiv.trans_apply, Fin.castOrderIso]; rfl + simp only [Fin.castOrderIso, Fin.mk_one, Equiv.trans_apply, Equiv.coe_fn_mk, Fin.isValue]; rfl private lemma genEquiv_symm_inl0 (k : ℕ) (j : Fin (k + 2)) (hj : j.val ≠ 0) : (genEquiv k j hj).symm (Sum.inl (0 : Fin 2)) = (0 : Fin (k + 2)) := by @@ -553,23 +545,25 @@ private lemma gcd_step_general (k : ℕ) (d : Fin (k + 2) → ℤ) (hd : ∀ i, private lemma dvd_diag_of_SL_transform (m : ℕ) (d d' : Fin m → ℤ) (c : ℤ) (hc : ∀ i, c ∣ d i) (L R : Matrix (Fin m) (Fin m) ℤ) (heq : L * Matrix.diagonal d * R = Matrix.diagonal d') : ∀ i, c ∣ d' i := by - intro i; rw [show d' i = (Matrix.diagonal d') i i from by simp, ← heq, mul_apply] + intro i; rw [show d' i = (Matrix.diagonal d') i i from by simp only [ + diagonal_apply_eq], ← heq, mul_apply] apply Finset.dvd_sum; intro k _; rw [mul_apply]; apply dvd_mul_of_dvd_left apply Finset.dvd_sum; intro l _; simp only [diagonal_apply]; split_ifs with h · subst h; exact dvd_mul_of_dvd_right (hc l) _ - · simp + · simp only [mul_zero, dvd_zero] private noncomputable def fin1Sum (k : ℕ) : Fin (k + 1) ≃ Fin 1 ⊕ Fin k := (Fin.castOrderIso (show k + 1 = 1 + k by omega)).toEquiv.trans finSumFinEquiv.symm private lemma fin1Sum_zero (k : ℕ) : fin1Sum k (0 : Fin (k + 1)) = Sum.inl (0 : Fin 1) := by - unfold fin1Sum; simp [Equiv.trans_apply, Fin.castOrderIso]; rfl + unfold fin1Sum; simp only [Fin.castOrderIso, Equiv.trans_apply, Equiv.coe_fn_mk, Fin.cast_zero, + Fin.isValue]; rfl private lemma fin1Sum_succ (k : ℕ) (i : Fin k) : fin1Sum k ⟨i.val + 1, by omega⟩ = Sum.inr i := by unfold fin1Sum; simp only [Equiv.trans_apply, Fin.castOrderIso]; rw [Equiv.symm_apply_eq] simp only [finSumFinEquiv, Fin.addCases, Equiv.coe_fn_mk, Fin.cast_mk, Order.lt_one_iff, - Fin.val_eq_zero_iff, eq_rec_constant, Sum.elim_inr]; ext; simp; omega + Fin.val_eq_zero_iff, eq_rec_constant, Sum.elim_inr]; ext; simp only [Fin.val_natAdd]; omega private lemma fin1Sum_symm_inl (k : ℕ) : (fin1Sum k).symm (Sum.inl (0 : Fin 1)) = (0 : Fin (k + 1)) := by @@ -581,7 +575,8 @@ private lemma fin1Sum_symm_inr (k : ℕ) (i : Fin k) : private lemma diagonal_submatrix_fin1Sum (k : ℕ) (d : Fin (k + 1) → ℤ) : (Matrix.diagonal (d ∘ (fin1Sum k).symm)).submatrix (fin1Sum k) (fin1Sum k) = - Matrix.diagonal d := by ext i m; simp [submatrix_apply, diagonal_apply] + Matrix.diagonal d := by ext i m; simp only [submatrix_apply, diagonal_apply, + EmbeddingLike.apply_eq_iff_eq, Function.comp_apply, Equiv.symm_apply_apply] private lemma make_first_divide_all (k : ℕ) (d : Fin (k + 2) → ℤ) (hd : ∀ i, 0 < d i) : ∃ (d' : Fin (k + 2) → ℤ) (_ : ∀ i, 0 < d' i) (_ : ∀ j, d' (0 : Fin (k + 2)) ∣ d' j), @@ -643,7 +638,8 @@ private lemma slSuccEmbed_mul_diagonal (k : ℕ) (d : Fin (k + 2) → ℤ) have h_decomp : Matrix.diagonal (d ∘ e.symm) = fromBlocks (Matrix.diagonal (fun _ : Fin 1 => d 0)) 0 0 (Matrix.diagonal (fun i : Fin (k + 1) => d ⟨i.val + 1, by omega⟩)) := by - simp_all + simp_all only [Fin.isValue, fromBlocks_diagonal, diagonal_eq_diagonal_iff, Function.comp_apply, + Sum.forall, Sum.elim_inl, Fin.forall_fin_one, Sum.elim_inr, implies_true, and_self] rw [h_decomp, fromBlocks_multiply]; simp only [Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, Matrix.one_mul] rw [fromBlocks_multiply]; simp only [Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, @@ -653,10 +649,15 @@ private lemma slSuccEmbed_mul_diagonal (k : ℕ) (d : Fin (k + 2) → ℤ) have h_out_decomp : Matrix.diagonal (d_out ∘ e.symm) = fromBlocks (Matrix.diagonal (fun _ : Fin 1 => d 0)) 0 0 (Matrix.diagonal d'_tail) := by ext (i | i) (j | j) - · fin_cases i; fin_cases j; simp [fromBlocks, Function.comp, d_out, he_inl] - · simp [fromBlocks] - · simp [fromBlocks] - · simp [fromBlocks, diagonal_apply, Function.comp, d_out, he_inr] + · fin_cases i; fin_cases j; simp only [Fin.zero_eta, Fin.isValue, diagonal_apply_eq, + Function.comp, he_inl, ↓reduceIte, fromBlocks, of_apply, Sum.elim_inl, d_out] + · simp only [ne_eq, reduceCtorEq, not_false_eq_true, diagonal_apply_ne, fromBlocks, of_apply, + Sum.elim_inl, Sum.elim_inr, Matrix.zero_apply] + · simp only [ne_eq, reduceCtorEq, not_false_eq_true, diagonal_apply_ne, fromBlocks, of_apply, + Sum.elim_inr, Sum.elim_inl, Matrix.zero_apply] + · simp only [diagonal_apply, Sum.inr.injEq, Function.comp, he_inr, Fin.mk_eq_zero, + Nat.add_eq_zero_iff, Fin.val_eq_zero_iff, one_ne_zero, and_false, ↓reduceIte, + add_tsub_cancel_right, Fin.eta, fromBlocks, of_apply, Sum.elim_inr, d_out] rw [h_out_decomp, hmul] private lemma exists_divchain_of_posdiag (d : Fin n → ℤ) (hd : ∀ i, 0 < d i) : @@ -763,7 +764,7 @@ private lemma double_coset_eq_of_SLnZ_equiv (α : (GLPair n).Δ) (A : Matrix (Fi have h_map_mul : ∀ (X Y : Matrix (Fin n) (Fin n) ℤ), X.map (Int.cast : ℤ → ℚ) * Y.map (Int.cast : ℤ → ℚ) = (X * Y).map (Int.cast : ℤ → ℚ) := fun X Y => by - ext i j; simp [Matrix.mul_apply, Matrix.map_apply] + ext i j; simp only [Matrix.mul_apply, map_apply, Int.cast_sum, Int.cast_mul] apply Units.ext; change (diag_GL : Matrix (Fin n) (Fin n) ℚ) = (((L : GL (Fin n) ℚ) * ↑α * (R : GL (Fin n) ℚ) : GL (Fin n) ℚ) : Matrix (Fin n) (Fin n) ℚ) simp only [Units.val_mul, mapGL_coe_matrix, algebraMap_int_eq, hA]; symm @@ -800,7 +801,8 @@ theorem exists_diagonal_representative (α : (GLPair n).Δ) : DoubleCoset.doubleCoset (↑(diagMatDelta n a) : GL (Fin n) ℚ) (SLnZSubgroup n) (SLnZSubgroup n) rw [diagMat_delta_val n a hd_pos_nat, double_coset_eq_of_SLnZ_equiv n α A hA d hd_pos L R hLR] - congr 1; apply GeneralLinearGroup.ext; simp_all + congr 1; apply GeneralLinearGroup.ext; simp_all only [Int.toNat_natCast, Int.cast_zero, + diagonal_map, Int.cast_natCast, GeneralLinearGroup.val_mkOfDetNeZero, implies_true, diagMat_val] omit [NeZero n] in private lemma divChain_prod_dvd_of_injective {a : Fin n → ℕ} (hda : DivChain n a) @@ -850,9 +852,11 @@ private lemma partialProd_eq_of_SLnZ_equiv {a b : Fin n → ℕ} (ha : ∀ i, 0 simp only [diagMat_val n d hd_pos, diagMat_val n c hc_pos, Matrix.diagonal_apply, Units.val_mul, Matrix.mul_apply, show ∀ i j, (↑(mapGL ℚ P) : Matrix _ _ ℚ) i j = ↑(P.val i j) from fun i j => by - simp [mapGL_coe_matrix, algebraMap_int_eq, Matrix.map_apply], + simp only [mapGL_coe_matrix, algebraMap_int_eq, map_apply_coe, RingHom.mapMatrix_apply, + Int.coe_castRingHom, map_apply], show ∀ i j, (↑(mapGL ℚ Q) : Matrix _ _ ℚ) i j = ↑(Q.val i j) from fun i j => by - simp [mapGL_coe_matrix, algebraMap_int_eq, Matrix.map_apply]] at h + simp only [mapGL_coe_matrix, algebraMap_int_eq, map_apply_coe, RingHom.mapMatrix_apply, + Int.coe_castRingHom, map_apply] ] at h simp only [Matrix.diagonal_apply, Matrix.mul_apply]; exact_mod_cast h have he_inj : Function.Injective e := fun i j h => Fin.ext (Fin.mk.inj h) have hprod_d : ∏ j : Fin k, (d (e j) : ℤ) = @@ -878,7 +882,7 @@ private lemma partialProd_eq_of_SLnZ_equiv {a b : Fin n → ℕ} (ha : ∀ i, 0 · simp only [Function.not_injective_iff] at hg; obtain ⟨j₁, j₂, hgeq, hjne⟩ := hg have : det (P_ℤ.submatrix e g) = 0 := Matrix.det_zero_of_column_eq hjne (fun i => by simp only [Matrix.submatrix_apply, hgeq]) - simp [this] + simp only [this, mul_zero, dvd_zero] /-- The elementary divisors are uniquely determined by the double coset. -/ theorem diagonal_representative_unique (a b : Fin n → ℕ) (ha : ∀ i, 0 < a i) diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GLn/PolynomialRing.lean b/LeanPool/LeanModularForms/HeckeRIngs/GLn/PolynomialRing.lean index ee9fd8ba86..002ae7504b 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GLn/PolynomialRing.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GLn/PolynomialRing.lean @@ -78,7 +78,7 @@ lemma divChain_T_gen (k : Fin n) : by_cases h1 : i < n - 1 - (k : ℕ) · by_cases h2 : i + 1 < n - 1 - (k : ℕ) <;> simp [h1, h2] · have h2 : ¬ (i + 1 < n - 1 - (k : ℕ)) := by omega - simp [h1, h2] + simp only [h1, ↓reduceIte, h2, dvd_refl] variable [NeZero n] diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GLn/SLnTransvection.lean b/LeanPool/LeanModularForms/HeckeRIngs/GLn/SLnTransvection.lean index c3a0db429d..4727df61b6 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GLn/SLnTransvection.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GLn/SLnTransvection.lean @@ -37,7 +37,8 @@ private lemma slTransvecG_mul {m : ℕ} (i j : Fin m) (hij : i ≠ j) (a b : ℤ private lemma slTransvecG_zero {m : ℕ} (i j : Fin m) (hij : i ≠ j) : slTransvecG i j hij 0 = 1 := - Subtype.ext (by simp [slTransvecG, Matrix.transvection_zero]) + Subtype.ext (by simp only [slTransvecG, Matrix.transvection_zero, + Matrix.SpecialLinearGroup.coe_one]) private lemma slTransvecG_mul_entry {m : ℕ} (i j : Fin m) (hij : i ≠ j) (c : ℤ) (σ : Matrix.SpecialLinearGroup (Fin m) ℤ) (a b : Fin m) : @@ -47,8 +48,10 @@ private lemma slTransvecG_mul_entry {m : ℕ} (i j : Fin m) (hij : i ≠ j) (c : exact (Matrix.SpecialLinearGroup.coe_mul (slTransvecG i j hij c) σ).trans rfl rw [hcoe] split_ifs with hai - · subst hai; simp [Matrix.transvection, Matrix.add_mul] - · simp [Matrix.transvection, Matrix.add_mul, hai] + · subst hai; simp only [Matrix.transvection, Matrix.add_mul, one_mul, Matrix.add_apply, + Matrix.single_mul_apply_same] + · simp only [Matrix.transvection, Matrix.add_mul, one_mul, Matrix.add_apply, ne_eq, hai, + not_false_eq_true, Matrix.single_mul_apply_of_ne, add_zero] private lemma slTransvecG_mul_right_entry {m : ℕ} (i j : Fin m) (hij : i ≠ j) (c : ℤ) (σ : Matrix.SpecialLinearGroup (Fin m) ℤ) @@ -58,8 +61,10 @@ private lemma slTransvecG_mul_right_entry {m : ℕ} exact (Matrix.SpecialLinearGroup.coe_mul σ (slTransvecG i j hij c)).trans rfl rw [hcoe] split_ifs with hbj - · subst hbj; simp [Matrix.transvection, Matrix.mul_add, mul_comm] - · simp [Matrix.transvection, Matrix.mul_add, hbj] + · subst hbj; simp only [Matrix.transvection, Matrix.mul_add, mul_one, Matrix.add_apply, + Matrix.mul_single_apply_same, mul_comm] + · simp only [Matrix.transvection, Matrix.mul_add, mul_one, Matrix.add_apply, ne_eq, hbj, + not_false_eq_true, Matrix.mul_single_apply_of_ne, add_zero] private lemma isTransvec_append {m : ℕ} (L₁ L₂ : List (Matrix.SpecialLinearGroup (Fin m) ℤ)) (h₁ : ∀ E ∈ L₁, IsTransvec E) (h₂ : ∀ E ∈ L₂, IsTransvec E) : @@ -76,8 +81,10 @@ private lemma slTransvecG_col0 {m : ℕ} (i j : Fin (m + 1)) (hij : i ≠ j) (c have : (slTransvecG i j hij c * σ).1 = Matrix.transvection i j c * σ.1 := by exact (Matrix.SpecialLinearGroup.coe_mul (slTransvecG i j hij c) σ).trans rfl rw [this]; split_ifs with hai - · subst hai; simp [Matrix.transvection, Matrix.add_mul] - · simp [Matrix.transvection, Matrix.add_mul, hai] + · subst hai; simp only [Matrix.transvection, Matrix.add_mul, one_mul, Matrix.add_apply, + Matrix.single_mul_apply_same] + · simp only [Matrix.transvection, Matrix.add_mul, one_mul, Matrix.add_apply, ne_eq, hai, + not_false_eq_true, Matrix.single_mul_apply_of_ne, add_zero] private lemma col0_ne_zero {m : ℕ} (σ : Matrix.SpecialLinearGroup (Fin (m + 1)) ℤ) : ∃ i, σ.1 i 0 ≠ 0 := by @@ -214,7 +221,8 @@ private lemma blockLift_col0 {m : ℕ} (i j : Fin m) (hij : i ≠ j) (c : ℤ) (τ : Matrix.SpecialLinearGroup (Fin (m + 1)) ℤ) (hcol : ∀ k : Fin (m + 1), k ≠ 0 → τ.1 k 0 = 0) (a : Fin (m + 1)) : (blockLift i j hij c * τ).1 a 0 = τ.1 a 0 := by - rw [blockLift_entry]; simp_all + rw [blockLift_entry]; simp_all only [ne_eq, Fin.succ_ne_zero, not_false_eq_true, mul_zero, + add_zero, ite_eq_right_iff, implies_true] private lemma det_lowerRight {m : ℕ} (τ : Matrix.SpecialLinearGroup (Fin (m + 1)) ℤ) (h00 : τ.1 0 0 = 1) (h0j : ∀ j : Fin (m + 1), j ≠ 0 → τ.1 0 j = 0) : @@ -224,7 +232,8 @@ private lemma det_lowerRight {m : ℕ} (τ : Matrix.SpecialLinearGroup (Fin (m + by ext i j; rfl] have hdet : τ.1.det = 1 := τ.2 rw [Matrix.det_succ_row_zero, Finset.sum_eq_single (0 : Fin (m + 1)) - (fun j _ hj => by simp [h0j j hj]) (fun h => absurd (Finset.mem_univ _) h)] at hdet + (fun j _ hj => by simp only [Int.reduceNeg, Nat.succ_eq_add_one, h0j j hj, mul_zero, + zero_mul]) (fun h => absurd (Finset.mem_univ _) h)] at hdet simpa [Fin.succAbove_zero, h00] using hdet private def extractBlock {m : ℕ} (τ : Matrix.SpecialLinearGroup (Fin (m + 1)) ℤ) @@ -339,7 +348,7 @@ private lemma nzCount_le_one_unique_nonzero {m : ℕ} simp only [Finset.mem_insert, Finset.mem_singleton] at hx simp only [Finset.mem_filter, Finset.mem_univ, true_and] exact hx.elim (· ▸ hi₀) (· ▸ hne) - linarith + linarith only [h_nz, this] private lemma sole_nonzero_col0_is_unit {m : ℕ} (τ : Matrix.SpecialLinearGroup (Fin (m + 1)) ℤ) (i₀ : Fin (m + 1)) (h_others : ∀ k, k ≠ i₀ → τ.1 k 0 = 0) : diff --git a/LeanPool/LeanModularForms/HeckeRIngs/GLn/TransposeAntiInvolution.lean b/LeanPool/LeanModularForms/HeckeRIngs/GLn/TransposeAntiInvolution.lean index ea49dc0eaf..8ed59ad63e 100644 --- a/LeanPool/LeanModularForms/HeckeRIngs/GLn/TransposeAntiInvolution.lean +++ b/LeanPool/LeanModularForms/HeckeRIngs/GLn/TransposeAntiInvolution.lean @@ -46,7 +46,7 @@ lemma GL_transposeEquiv_val (g : GL (Fin n) ℚ) : lemma GL_transposeEquiv_involutive (g : GL (Fin n) ℚ) : (GLTransposeEquiv n (GLTransposeEquiv n g).unop).unop = g := by - ext i j; simp [GL_transposeEquiv_val] + ext i j; simp only [GL_transposeEquiv_val, transpose_apply] lemma SLnZ_to_GLnQ_transpose (σ : SpecialLinearGroup (Fin n) ℤ) : (GLTransposeEquiv n (σ : GL (Fin n) ℚ)).unop = (σ.transpose : GL (Fin n) ℚ) := by diff --git a/LeanPool/LeanModularForms/Modularforms/BigO.lean b/LeanPool/LeanModularForms/Modularforms/BigO.lean index 8c6d41b702..32695cce8a 100644 --- a/LeanPool/LeanModularForms/Modularforms/BigO.lean +++ b/LeanPool/LeanModularForms/Modularforms/BigO.lean @@ -25,7 +25,9 @@ open scoped Interval Real NNReal ENNReal Topology BigOperators Nat lemma norm_symm (x y : ℤ) : ‖![x, y]‖ = ‖![y,x]‖ := by - simp [EisensteinSeries.norm_eq_max_natAbs, max_comm] + simp only [Nat.succ_eq_add_one, Nat.reduceAdd, norm_eq_max_natAbs, Fin.isValue, + Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_fin_one, Nat.cast_max, + Nat.cast_natAbs, Int.cast_abs, max_comm] lemma linear_bigO (m : ℤ) (z : ℍ) : (fun (n : ℤ) => ((m : ℂ) * z + n)⁻¹) =O[cofinite] diff --git a/LeanPool/LeanModularForms/Modularforms/Cauchylems.lean b/LeanPool/LeanModularForms/Modularforms/Cauchylems.lean index 7ba2e9d4df..0943b767f3 100644 --- a/LeanPool/LeanModularForms/Modularforms/Cauchylems.lean +++ b/LeanPool/LeanModularForms/Modularforms/Cauchylems.lean @@ -148,8 +148,14 @@ theorem telescope_aux (z : ℍ) (m : ℤ) (b : ℕ) : ring · omega · omega - · simp_all - · simp_all + · simp_all only [neg_add_rev, Int.reduceNeg, Finset.disjoint_insert_right, Finset.mem_Ico, + le_add_iff_nonneg_left, Int.neg_nonneg, Int.reduceLE, add_neg_lt_iff_lt_add, false_and, + not_false_eq_true, Finset.disjoint_singleton_right, neg_le_self_iff, Nat.cast_nonneg, + lt_self_iff_false, and_false, and_self] + · simp_all only [neg_add_rev, Int.reduceNeg, Finset.disjoint_insert_right, Finset.mem_Ico, + le_add_iff_nonneg_left, Int.neg_nonneg, Int.reduceLE, add_neg_lt_iff_lt_add, false_and, + not_false_eq_true, Finset.disjoint_singleton_right, neg_le_self_iff, Nat.cast_nonneg, + lt_self_iff_false, and_false, and_self] theorem extracted_3 (z : ℍ) (b : ℤ) : CauchySeq fun N : ℕ ↦ ∑ n ∈ Finset.Ico (-↑N : ℤ) ↑N, (1 / ((b : ℂ) * ↑z + ↑n) - 1 / (↑b * ↑z + ↑n + 1)) := by @@ -190,7 +196,7 @@ theorem extracted_5 (z : ℍ) (b : ℤ) : apply this apply Filter.Eventually.of_forall intro N - simp + simp only [zpow_ofNat, comp_apply, one_div] congr lemma CauchySeq.congr (f g : ℕ → ℂ) (hf : f = g) (hh : CauchySeq g) : CauchySeq f := hf ▸ hh @@ -201,14 +207,14 @@ lemma cauchy_seq_mul_const (f : ℕ → ℂ) (c : ℂ) (hc : c ≠ 0) : rw [Metric.cauchySeq_iff'] at * simp only [ne_eq, gt_iff_lt, ge_iff_le, Pi.smul_apply, smul_eq_mul] at * intro ε hε - have hC : 0 < ‖c‖ := by simp [ne_eq, hc, not_false_eq_true] - obtain ⟨N, hN⟩ := hf (ε / ‖c‖) (by rw [lt_div_iff₀' hC]; simp [hε]) + have hC : 0 < ‖c‖ := by simp only [norm_pos_iff, ne_eq, hc, not_false_eq_true] + obtain ⟨N, hN⟩ := hf (ε / ‖c‖) (by rw [lt_div_iff₀' hC]; simp only [mul_zero, hε]) exact ⟨N, fun n hn => by have h1 := hN n hn simp only [dist_eq_norm, gt_iff_lt] at * rw [← mul_sub] simp only [Complex.norm_mul] - rw [lt_div_iff₀' (by simp [hc])] at h1 + rw [lt_div_iff₀' (by simp only [norm_pos_iff, ne_eq, hc, not_false_eq_true])] at h1 exact h1⟩ @@ -223,7 +229,7 @@ lemma term_evem (z : ℍ) (m : ℤ) : summableTerm z m = summableTerm z (-m) := nth_rw 1 [int_sum_neg] congr funext m - simp + simp only [Int.cast_neg, inv_inj] ring lemma t8 (z : ℍ) : @@ -247,7 +253,7 @@ lemma t8 (z : ℍ) : congr ext d let Z : ℍ := ⟨(d +1)* z, by simp only [mul_im, add_re, natCast_re, one_re, coe_im, add_im, - natCast_im, one_im, add_zero, coe_re, zero_mul]; exact mul_pos (by linarith) z.2⟩ + natCast_im, one_im, add_zero, coe_re, zero_mul]; exact mul_pos (by linarith only []) z.2⟩ have := q_exp_iden 2 (by norm_num) (z := Z) simp only [one_div, neg_mul, even_two, Even.neg_pow, Nat.add_one_sub_one, Nat.factorial_one, Nat.cast_one, div_one, pow_one, Z] at * @@ -281,7 +287,8 @@ theorem G2_c_tendsto (z : ℍ) : rw [← this] have := (a4 2 z).prod_symm.prod apply Summable.mul_left - simp_all + simp_all only [neg_mul, even_two, Even.neg_pow, Nat.add_one_sub_one, Nat.factorial_one, + Nat.cast_one, div_one, pow_one, Nat.cast_add, Prod.swap_prod_mk, uncurry_apply_pair] have := hf.hasSum have V := this.comp tendsto_finset_range simp only [neg_mul, even_two, Even.neg_pow, Nat.add_one_sub_one, Nat.factorial_one, diff --git a/LeanPool/LeanModularForms/Modularforms/ClogArgLems.lean b/LeanPool/LeanModularForms/Modularforms/ClogArgLems.lean index d6c467e9f2..217f87304a 100644 --- a/LeanPool/LeanModularForms/Modularforms/ClogArgLems.lean +++ b/LeanPool/LeanModularForms/Modularforms/ClogArgLems.lean @@ -62,7 +62,7 @@ lemma arg_pow_aux (n : ℕ) (x : ℂ) (hx : x ≠ 0) (hna : |arg x| < π / n) : lemma one_add_abs_half_ne_zero {x : ℂ} (hb : ‖x‖ < 1 / 2) : 1 + x ≠ 0 := by intro h rw [add_eq_zero_iff_neg_eq] at h - simp [← h] at hb; linarith only [hb] + simp only [← h, norm_neg, norm_one, one_div] at hb; linarith only [hb] lemma arg_pow (n : ℕ) (f : ℕ → ℂ) (hf : Tendsto f atTop (𝓝 0)) : ∀ᶠ m : ℕ in atTop, Complex.arg ((1 + f m) ^ n) = n * Complex.arg (1 + f m) := by @@ -154,4 +154,4 @@ lemma log_summable_pow (f : ℕ → ℂ) (hf : Summable f) (m : ℕ) : have H := clog_pow m f hft simp only [norm_mul, Complex.norm_natCast, eventually_atTop] at * obtain ⟨a, ha⟩ := H - exact ⟨a, fun b hb => by simp [ha b hb]⟩ + exact ⟨a, fun b hb => by simp only [ha b hb, Complex.norm_mul, RCLike.norm_natCast, Std.le_refl]⟩ diff --git a/LeanPool/LeanModularForms/Modularforms/Csqrt.lean b/LeanPool/LeanModularForms/Modularforms/Csqrt.lean index cc229926de..188faa6247 100644 --- a/LeanPool/LeanModularForms/Modularforms/Csqrt.lean +++ b/LeanPool/LeanModularForms/Modularforms/Csqrt.lean @@ -36,7 +36,7 @@ lemma csqrt_deriv (z : ℍ) : deriv (fun a : ℂ => cexp ((1 / (2 : ℂ))* (log (2 : ℂ)⁻¹ • (fun a : ℂ => cexp (-(1 / (2 : ℂ)) * (log a))) z:= by have : (fun a ↦ cexp (1 / 2 * Complex.log a)) = cexp ∘ (fun a ↦ (1 / 2 * Complex.log a)) := by ext z - simp + simp only [one_div, comp_apply] have hzz : ↑z ∈ slitPlane := mem_slitPlane_iff.mpr (Or.inr (ne_of_lt z.2).symm) rw [this, deriv_comp] · simp only [one_div, Complex.deriv_exp, deriv_const_mul_field', neg_mul, @@ -47,7 +47,7 @@ lemma csqrt_deriv (z : ℍ) : deriv (fun a : ℂ => cexp ((1 / (2 : ℂ))* (log rw [← Complex.exp_nat_mul]; grind simpa [hsq, (Complex.hasDerivAt_log hzz).deriv, Complex.exp_log <| ne_zero z] using Complex.mul_inv_cancel <| ne_zero z - · fun_prop + · exact DifferentiableAt.cexp differentiableAt_id · apply DifferentiableAt.const_mul refine Complex.differentiableAt_log hzz diff --git a/LeanPool/LeanModularForms/Modularforms/Delta.lean b/LeanPool/LeanModularForms/Modularforms/Delta.lean index 79582dbfff..a3fe59b9e8 100644 --- a/LeanPool/LeanModularForms/Modularforms/Delta.lean +++ b/LeanPool/LeanModularForms/Modularforms/Delta.lean @@ -43,7 +43,7 @@ lemma DiscriminantProductFormula (z : ℍ) : Δ z = cexp (2 * π * Complex.I * z conv => enter [1,1] ext n - rw [show (n : ℂ) + 1 = ((n + 1) : ℕ) by simp] + rw [show (n : ℂ) + 1 = ((n + 1) : ℕ) by simp only [Nat.cast_add, Nat.cast_one] ] have := tprod_pnat_eq_tprod_succ (f := (fun n => (1 - cexp (2 * π * Complex.I * (n) * z)) ^ 24)) rw [this] @@ -52,16 +52,16 @@ lemma Delta_eq_eta_pow (z : ℍ) : Δ z = (η z) ^ 24 := by have hm : Multipliable (fun n : ℕ => 1 - ModularForm.eta_q n z) := by refine (MultipliableEtaProductExpansion z).congr ?_ intro n - simp [ModularForm.eta_q_eq_cexp] + simp only [eta_q_eq_cexp] rw [ModularForm.eta, Δ, mul_pow, tprod_pow (f := fun n : ℕ => 1 - ModularForm.eta_q n z) hm 24] congr · rw [Periodic.qParam] rw [← Complex.exp_nat_mul] congr 1 - simp [field] + simp only [Nat.cast_ofNat, ofReal_ofNat, fieldEq] · ext n - simp [ModularForm.eta_q_eq_cexp] + simp only [eta_q_eq_cexp] /-This should be easy from the definition and the Mulitpliable bit. -/ @@ -81,7 +81,7 @@ lemma Discriminant_T_invariant : (Δ ∣[(12 : ℤ)] ModularGroup.T) = Δ := by apply tprod_congr intro b have := exp_periodo z (b+1) - simp_all + simp_all only [Nat.cast_add, Nat.cast_one] /-This is the hard one. -/ @@ -160,7 +160,7 @@ lemma atImInfy_pnat_mono (S : Set ℍ) (hS : S ∈ atImInfty) (B : ℝ) : ∃ A exact one_le exact ⟨le_trans hs2.1 ((le_mul_iff_one_le_left s.2).mpr hn), le_trans hs2.2 ((le_mul_iff_one_le_left s.2).mpr hn)⟩ - simp_all + simp_all only [sup_le_iff, and_self] · simp only [ inter_mem_iff, hS2, true_and] apply I_in_atImInfty @@ -201,7 +201,7 @@ theorem log_one_neg_cexp_tendto_zero (k : ℕ) : apply Tendsto.comp (y := 𝓝 1) · exact (continuous_pow 24).tendsto' ( 1 : ℂ) (1 : ℂ) (by simp) · simp_rw [sub_eq_add_neg] - nth_rw 3 [show (1 : ℂ) = 1 + 0 by ring] + nth_rw 3 [show (1 : ℂ) = 1 + 0 by ac_rfl] apply Tendsto.add · simp only [tendsto_const_nhds_iff] apply tendsto_neg_cexp_atImInfty @@ -300,7 +300,7 @@ lemma Discriminant_zeroAtImInfty : rw [this] simp only [DiscriminantSIF, SlashInvariantForm.coe_mk] unfold Δ - rw [show (0 : ℂ) = 0 * 1 by ring] + rw [show (0 : ℂ) = 0 * 1 by ac_rfl] apply Tendsto.mul · rw [tendsto_zero_iff_norm_tendsto_zero] simp only [Complex.norm_exp, mul_re, re_ofNat, ofReal_re, im_ofNat, @@ -405,7 +405,7 @@ theorem div_Delta_is_SIF (k : ℤ) (f : CuspForm (CongruenceSubgroup.Gamma 1) k) rw [← inv_zpow, inv_zpow'] simp_rw [← mul_assoc] rw [zpow_add₀ (by apply (denom_ne_zero γ z))] - ring + ac_rfl /-- Divides a weight-`k` cusp form by `Δ` to obtain a weight-`(k - 12)` modular form. -/ def CuspFormDivDiscriminant (k : ℤ) (f : CuspForm (CongruenceSubgroup.Gamma 1) k) : @@ -479,13 +479,15 @@ theorem CuspForm_div_Discriminant_Add (k : ℤ) (x y : CuspForm (CongruenceSubgr lemma cexp_aux1 (t : ℝ) : cexp (2 * ↑π * Complex.I * (Complex.I * t)) = rexp (-2 * π * t) := by calc _ = cexp (2 * ↑π * (Complex.I * Complex.I) * t) := by ring_nf - _ = rexp (-2 * π * t) := by simp + _ = rexp (-2 * π * t) := by simp only [I_mul_I, mul_neg, mul_one, neg_mul, ofReal_exp, + ofReal_neg, ofReal_mul, ofReal_ofNat] lemma cexp_aux2 (t : ℝ) (n : ℕ) : cexp (2 * π * Complex.I * (n + 1) * (Complex.I * t)) = rexp (-(2 * π * (n + 1) * t)) := by calc _ = cexp (2 * ↑π * (n + 1) * (Complex.I * Complex.I) * t) := by ring_nf - _ = rexp (-(2 * π * (n + 1) * t)) := by simp + _ = rexp (-(2 * π * (n + 1) * t)) := by simp only [I_mul_I, mul_neg, mul_one, neg_mul, + ofReal_exp, ofReal_neg, ofReal_mul, ofReal_ofNat, ofReal_add, ofReal_natCast, ofReal_one] lemma cexp_aux3 (t : ℝ) (n : ℕ) (ht : 0 < t) : 0 < 1 - rexp (-(2 * π * (n + 1) * t)) := sub_pos.mpr (exp_lt_one_iff.mpr (by simp only [Left.neg_neg_iff]; positivity)) @@ -501,12 +503,15 @@ lemma Complex.im_finset_prod_eq_zero_of_im_eq_zero {ι : Type*} (s : Finset ι) (f : ι → ℂ) (h : ∀ i ∈ s, (f i).im = 0) : (∏ i ∈ s, f i).im = 0 := by classical - revert h; refine Finset.induction_on s (fun _ => by simp) ?_; simp_all + revert h; refine Finset.induction_on s (fun _ => by simp only [Finset.prod_empty, + one_im]) ?_; simp_all only [Finset.mem_insert, + forall_eq_or_imp, not_false_eq_true, Finset.prod_insert, mul_im, implies_true, mul_zero, + zero_mul, add_zero] lemma Complex.im_pow_eq_zero_of_im_eq_zero {z : ℂ} (hz : z.im = 0) (m : ℕ) : (z ^ m).im = 0 := by induction m with - | zero => simp - | succ m ih => simp [pow_succ, Complex.mul_im, *] + | zero => simp only [pow_zero, one_im] + | succ m ih => simp only [pow_succ, mul_im, mul_zero, zero_mul, add_zero, hz, ih] lemma Complex.im_tprod_eq_zero_of_im_eq_zero (f : ℕ → ℂ) (hf : Multipliable f) (him : ∀ n, (f n).im = 0) : @@ -516,7 +521,8 @@ lemma Complex.im_tprod_eq_zero_of_im_eq_zero (f : ℕ → ℂ) Complex.im_finset_prod_eq_zero_of_im_eq_zero (s := Finset.range n) (f := f) (by intro i _; simpa using him i) have h1 := ((Complex.continuous_im.tendsto _).comp hf.hasProd.tendsto_prod_nat) - have h2 : Tendsto (fun n => (∏ i ∈ Finset.range n, f i).im) atTop (𝓝 (0 : ℝ)) := by simp [hz] + have h2 : Tendsto (fun n => (∏ i ∈ Finset.range n, f i).im) atTop (𝓝 (0 : ℝ)) := by simp only [hz, + tendsto_const_nhds_iff] exact tendsto_nhds_unique h1 h2 /- Δ(it) is real on the (positive) imaginary axis. -/ @@ -534,7 +540,8 @@ lemma Delta_imag_axis_real : ResToImagAxis.Real Δ := by have : ((1 - cexp (2 * (π : ℂ) * Complex.I * (n + 1) * (Complex.I * t))) : ℂ).im = 0 := by simpa [Complex.sub_im, hArg n] using this simpa [g] using Complex.im_pow_eq_zero_of_im_eq_zero this 24 - let z : ℍ := ⟨Complex.I * t, by simp [ht]⟩ + let z : ℍ := ⟨Complex.I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, + Complex.I_im, ofReal_re, one_mul, zero_add, ht]⟩ have hmul : Multipliable g := by have hz : (z : ℂ) = Complex.I * t := rfl simpa [g, hz] using @@ -544,7 +551,7 @@ lemma Delta_imag_axis_real : ResToImagAxis.Real Δ := by have him_pref : (cexp (2 * π * Complex.I * (Complex.I * t))).im = 0 := by have : (cexp (-(2 * (π : ℂ) * t))).im = 0 := by simpa using cexp_aux5 t simpa [by simpa using hArg 0] using this - simp [g, him_pref, htprod_im] + simp only [↓reduceDIte, mul_im, htprod_im, mul_zero, him_pref, zero_mul, add_zero, g] lemma re_ResToImagAxis_Delta_eq_real_prod (t : ℝ) (ht : 0 < t) : (Δ.resToImagAxis t).re = @@ -558,7 +565,8 @@ lemma re_ResToImagAxis_Delta_eq_real_prod (t : ℝ) (ht : 0 < t) : (g := Complex.ofRealHom.toMonoidHom) (hg := Complex.continuous_ofReal) (hg' := Complex.continuous_re) - (hgg' := by intro x; simp)) + (hgg' := by intro x; simp only [RingHom.toMonoidHom_eq_coe, MonoidHom.coe_ofClass, + ofRealHom_eq_coe, ofReal_re])) simpa [ResToImagAxis, ht, Delta_apply, Δ, cexp_aux1, cexp_aux2, hMap', fR] using Complex.ofReal_re (Real.exp (-2 * π * t) * ∏' n : ℕ, fR n) @@ -593,8 +601,10 @@ lemma Delta_imag_axis_pos : ResToImagAxis.Pos Δ := by intro t ht have hprod : 0 < ∏' (n : ℕ), (1 - Real.exp (-(2 * π * ((n + 1) : ℝ) * t))) ^ 24 := by - let z : ℍ := ⟨Complex.I * t, by simp [ht]⟩ - have hz : z.im = t := by simp [UpperHalfPlane.im, z] + let z : ℍ := ⟨Complex.I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, + Complex.I_im, ofReal_re, one_mul, zero_add, ht]⟩ + have hz : z.im = t := by simp only [UpperHalfPlane.im, mul_im, Complex.I_re, ofReal_im, + mul_zero, Complex.I_im, ofReal_re, one_mul, zero_add, z] simpa [hz] using tprod_pos_nat_im z rw [re_ResToImagAxis_Delta_eq_real_prod t ht] exact mul_pos (Real.exp_pos _) hprod diff --git a/LeanPool/LeanModularForms/Modularforms/Derivative.lean b/LeanPool/LeanModularForms/Modularforms/Derivative.lean index 558b4a0aa0..366af190cf 100644 --- a/LeanPool/LeanModularForms/Modularforms/Derivative.lean +++ b/LeanPool/LeanModularForms/Modularforms/Derivative.lean @@ -130,13 +130,15 @@ theorem D_smul (c : ℂ) (F : ℍ → ℂ) (hF : MDiff F) change (2 * π * I)⁻¹ * deriv (c • (F ∘ ofComplex)) z = c * ((2 * π * I)⁻¹ * deriv (F ∘ ofComplex) z) rw [h, smul_eq_mul] - ring + ac_rfl @[simp] theorem D_neg (F : ℍ → ℂ) (hF : MDiff F) : D (-F) = -D F := by - have : -F = (-1 : ℂ) • F := by ext; simp - rw [this, D_smul _ _ hF]; ext; simp + have : -F = (-1 : ℂ) • F := by ext; simp only [Pi.neg_apply, Pi.smul_apply, smul_eq_mul, neg_mul, + one_mul] + rw [this, D_smul _ _ hF]; ext; simp only [Pi.smul_apply, smul_eq_mul, neg_mul, one_mul, + Pi.neg_apply] @[simp] theorem D_mul (F G : ℍ → ℂ) (hF : MDiff F) (hG : MDiff G) @@ -171,12 +173,12 @@ lemma MDifferentiable_div {F G : ℍ → ℂ} intro τ suffices h : DifferentiableAt ℂ ((fun z => F z / G z) ∘ ofComplex) ↑τ by have h_eq : ((fun z => F z / G z) ∘ ofComplex) ∘ UpperHalfPlane.coe = fun z => F z / G z := by - ext x; simp [Function.comp, ofComplex_apply] + ext x; simp only [Function.comp, ofComplex_apply] rw [← h_eq]; exact DifferentiableAt_MDifferentiableAt h have h_eq : (fun z => F z / G z) ∘ ofComplex =ᶠ[nhds ↑τ] (F ∘ ofComplex) / (G ∘ ofComplex) := by filter_upwards [isOpen_upperHalfPlaneSet.mem_nhds τ.2] with w hw - simp [Function.comp, Pi.div_apply, ofComplex_apply_of_im_pos hw] + simp only [Function.comp, ofComplex_apply_of_im_pos hw, Pi.div_apply] exact ((MDifferentiableAt_DifferentiableAt (hF τ)).div (MDifferentiableAt_DifferentiableAt (hG τ)) (by simp_all only [ne_eq, Function.comp_apply, ofComplex_apply, @@ -209,7 +211,7 @@ private lemma hasDerivAt_qexp (a c w : ℂ) : simp only [mul_one, id] at h have := ((Complex.hasDerivAt_exp _).scomp w h).const_mul a simp only [smul_eq_mul] at this ⊢ - exact this.congr_deriv (by ring) + exact this.congr_deriv (by ac_rfl) /-- Helper: derivWithin for qexp term on upper half-plane. -/ private lemma derivWithin_qexp (a c : ℂ) (w : ℂ) (hw : 0 < w.im) : @@ -274,14 +276,14 @@ theorem D_qexp_tsum (a : ℕ → ℂ) (z : ℍ) have h_pos : (0 : ℝ) < 2 * π * n := by positivity have h_key : ‖a n * cexp (2 * π * I * n * y)‖ * (2 * π * n) = ‖a n * (2 * π * I * n) * cexp (2 * π * I * n * y)‖ := by - simp only [norm_mul, h_norm_2pin]; ring + simp only [norm_mul, h_norm_2pin]; ac_rfl calc ‖a n * cexp (2 * π * I * n * y)‖ = ‖a n * cexp (2 * π * I * n * y)‖ * (2 * π * n) / (2 * π * n) := by field_simp _ = ‖a n * (2 * π * I * n) * cexp (2 * π * I * n * y)‖ / (2 * π * n) := by rw [h_key] _ ≤ u n / (2 * π * n) := div_le_div_of_nonneg_right h_deriv_bound h_pos.le _ ≤ u n / (2 * π) := by apply div_le_div_of_nonneg_left (le_trans (norm_nonneg _) h_deriv_bound) - (by positivity); nlinarith + (by positivity); nlinarith only [h_n_ge_1, h_pos] exact hn.not_ge h_bound have hu : ∀ K ⊆ {w : ℂ | 0 < w.im}, IsCompact K → ∃ u : ℕ → ℝ, Summable u ∧ ∀ n (k : K), @@ -371,7 +373,7 @@ theorem serre_D_sub (k : ℤ) (F G : ℍ → ℂ) (hF : MDiff F) theorem serre_D_smul (k : ℤ) (c : ℂ) (F : ℍ → ℂ) (hF : MDiff F) : serreD k (c • F) = c • (serreD k F) := by simp only [serre_D_eq, D_smul c F hF] - ext z; simp [Pi.smul_apply]; ring + ext z; simp only [Pi.smul_apply, smul_eq_mul]; ring theorem serre_D_mul (k₁ k₂ : ℤ) (F G : ℍ → ℂ) (hF : MDiff F) (hG : MDiff G) : @@ -410,13 +412,19 @@ variable (γ : SL(2, ℤ)) lemma deriv_denom (z : ℂ) : deriv (fun w => denom γ w) z = ((γ : Matrix (Fin 2) (Fin 2) ℤ) 1 0 : ℂ) := by simp only [denom] - rw [deriv_add_const, deriv_const_mul _ differentiableAt_id, deriv_id'', mul_one]; simp + rw [deriv_add_const, deriv_const_mul _ differentiableAt_id, deriv_id'', mul_one]; simp only [ + Fin.isValue, Matrix.SpecialLinearGroup.coe_GL_coe_matrix, + Matrix.SpecialLinearGroup.map_apply_coe, RingHom.mapMatrix_apply, Int.coe_castRingHom, + Matrix.map_apply, ofReal_intCast] /-- Derivative of the numerator function: d/dz[az + b] = a. -/ lemma deriv_num (z : ℂ) : deriv (fun w => num γ w) z = ((γ : Matrix (Fin 2) (Fin 2) ℤ) 0 0 : ℂ) := by simp only [num] - rw [deriv_add_const, deriv_const_mul _ differentiableAt_id, deriv_id'', mul_one]; simp + rw [deriv_add_const, deriv_const_mul _ differentiableAt_id, deriv_id'', mul_one]; simp only [ + Fin.isValue, Matrix.SpecialLinearGroup.coe_GL_coe_matrix, + Matrix.SpecialLinearGroup.map_apply_coe, RingHom.mapMatrix_apply, Int.coe_castRingHom, + Matrix.map_apply, ofReal_intCast] /-- Differentiability of denom. -/ lemma differentiableAt_denom (z : ℂ) : @@ -461,7 +469,7 @@ lemma deriv_denom_zpow (k : ℤ) (z : ℍ) : rw [← deriv_denom]; exact hdiff.hasDerivAt have hcomp := hderiv_zpow.comp (z : ℂ) hderiv_denom have heq : (fun w => w ^ (-k)) ∘ (fun w => denom γ w) = (fun w => (denom γ w) ^ (-k)) := rfl - rw [← heq, hcomp.deriv]; simp only [Int.cast_neg]; ring + rw [← heq, hcomp.deriv]; simp only [Int.cast_neg]; ac_rfl end DSlashHelpers @@ -548,7 +556,7 @@ lemma D_slash (k : ℤ) (F : ℍ → ℂ) (hF : MDiff F) (γ : SL(2, ℤ)) : have hpow_m1 : (denom γ z) ^ (-k - 1) = (denom γ z) ^ (-1 : ℤ) * (denom γ z) ^ (-k) := by rw [← zpow_add₀ hz_denom_ne] congr 1 - ring + ac_rfl conv_lhs => rw [mul_assoc (deriv (F ∘ ofComplex) (num γ z / denom γ z)) (1 / denom γ z ^ 2) _, hpow_combine, hpow_m1] @@ -619,11 +627,13 @@ The key computation is: -/ theorem deriv_resToImagAxis_eq (F : ℍ → ℂ) (hF : MDiff F) {t : ℝ} (ht : 0 < t) : deriv F.resToImagAxis t = -2 * π * (D F).resToImagAxis t := by - let z : ℍ := ⟨I * t, by simp [ht]⟩ + let z : ℍ := ⟨I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, Complex.I_im, + ofReal_re, one_mul, zero_add, ht]⟩ let g : ℝ → ℂ := (I * ·) have h_eq : F.resToImagAxis =ᶠ[nhds t] ((F ∘ ofComplex) ∘ g) := by filter_upwards [lt_mem_nhds ht] with s hs - have him : 0 < (g s).im := by simp [g, hs] + have him : 0 < (g s).im := by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, + Complex.I_im, ofReal_re, one_mul, zero_add, hs, g] simp [Function.resToImagAxis_apply, ResToImagAxis, hs, Function.comp_apply, g, ofComplex_apply_of_im_pos him] suffices h : deriv ((F ∘ ofComplex) ∘ g) t = -2 * ↑π * (D F).resToImagAxis t by @@ -756,8 +766,12 @@ lemma norm_D_le_of_sphere_bound {f : ℍ → ℂ} {z : ℍ} {r M : ℝ} (hr : 0 < r) (hDiff : DiffContOnCl ℂ (f ∘ ofComplex) (Metric.ball (z : ℂ) r)) (hbdd : ∀ w ∈ Metric.sphere (z : ℂ) r, ‖(f ∘ ofComplex) w‖ ≤ M) : ‖D f z‖ ≤ M / (2 * π * r) := calc ‖D f z‖ - _ = ‖(2 * π * I)⁻¹‖ * ‖deriv (f ∘ ofComplex) z‖ := by simp [D] - _ = (2 * π)⁻¹ * ‖deriv (f ∘ ofComplex) z‖ := by simp [abs_of_pos Real.pi_pos] + _ = ‖(2 * π * I)⁻¹‖ * ‖deriv (f ∘ ofComplex) z‖ := by simp only [D, mul_inv_rev, inv_I, neg_mul, + norm_neg, Complex.norm_mul, norm_I, norm_inv, norm_real, norm_eq_abs, abs_pi, + Complex.norm_ofNat, one_mul] + _ = (2 * π)⁻¹ * ‖deriv (f ∘ ofComplex) z‖ := by simp only [mul_inv_rev, inv_I, neg_mul, norm_neg, + Complex.norm_mul, norm_I, norm_inv, norm_real, norm_eq_abs, abs_of_pos Real.pi_pos, + Complex.norm_ofNat, one_mul] _ ≤ (2 * π)⁻¹ * (M / r) := by gcongr; exact norm_deriv_le_of_forall_mem_sphere_norm_le hr hDiff hbdd _ = M / (2 * π * r) := by ring @@ -796,7 +810,7 @@ lemma D_isBoundedAtImInfty_of_bounded {f : ℍ → ℂ} calc ‖D f z‖ ≤ M / (2 * π * (z.im / 2)) := norm_D_le_of_sphere_bound hR_pos hDiff hf_bdd_sphere _ = M / (π * z.im) := by ring _ ≤ M / (π * 1) := by gcongr - _ = M / π := by ring + _ = M / π := by ac_rfl /-- The D-derivative of a bounded holomorphic function tends to zero at infinity. @@ -849,7 +863,7 @@ theorem serre_D_isBoundedAtImInfty_of_bounded {f : ℍ → ℂ} (k : ℂ) Filter.const_boundedAtFilter _ _ have hfun : (fun z => k * 12⁻¹ * E₂ z * f z) = ((fun _ : ℍ => k * 12⁻¹) * (E₂ * f)) := by - ext z; simp only [Pi.mul_apply]; ring + ext z; simp only [Pi.mul_apply]; ac_rfl rw [hfun] exact hconst.mul (E₂_isBoundedAtImInfty.mul hbdd) exact hD.sub hE₂f diff --git a/LeanPool/LeanModularForms/Modularforms/DimensionFormulas.lean b/LeanPool/LeanModularForms/Modularforms/DimensionFormulas.lean index 1294f4221e..92962c145c 100644 --- a/LeanPool/LeanModularForms/Modularforms/DimensionFormulas.lean +++ b/LeanPool/LeanModularForms/Modularforms/DimensionFormulas.lean @@ -162,7 +162,7 @@ lemma Delta_E4_E6_aux_q_one_term : (qExpansion 1 DeltaE4E6Aux).coeff 1 = 1 := by apply qExpansion_ext2 DeltaE4E6Aux (ModFormMk Γ(1) 12 DeltaE4E6Aux) ?_ ext z rw [DeltaE4E6Aux, ModFormMk] - simp + simp only [one_div, DirectSum.sub_apply] rfl rw [h1, Delta_E4_E6_eq] simp only [one_div, DirectSum.sub_apply] @@ -175,7 +175,8 @@ lemma Delta_E4_E6_aux_q_one_term : (qExpansion 1 DeltaE4E6Aux).coeff 1 = 1 := by have hsub1 : qExpansion 1 ⇑(A - B) = qExpansion 1 (⇑A - ⇑B) := by rfl have hsub2 : qExpansion 1 (⇑A - ⇑B) = qExpansion 1 ⇑A - qExpansion 1 ⇑B := by simpa using (ModularForm.qExpansion_sub (h := (1 : ℕ)) - (hh := by positivity) (hΓ := by simp) (f := A) (g := B)) + (hh := by positivity) (hΓ := by simp only [CongruenceSubgroup.strictPeriods_Gamma, + Nat.cast_one, AddSubgroup.mem_zmultiples]) (f := A) (g := B)) have hmain : (PowerSeries.coeff 1) ((1728⁻¹ : ℂ) • (qExpansion 1 ⇑A - qExpansion 1 ⇑B)) = 1 := by have h4 := qExpansion_pow E₄ 3 have h6 := qExpansion_pow E₆ 2 @@ -234,7 +235,8 @@ theorem Delta_E4_eqn : Delta = DeltaE4E6Aux := by have h2 := Delta_E4_E6_aux_q_one_term rw [← H] at h2 have hs := (ModularForm.qExpansion_smul (h := (1 : ℕ)) - (hh := by positivity) (hΓ := by simp) c Delta).symm + (hh := by positivity) (hΓ := by simp only [CongruenceSubgroup.strictPeriods_Gamma, + Nat.cast_one, AddSubgroup.mem_zmultiples]) c Delta).symm have hsmul : qExpansion 1 ⇑(c • Delta) = qExpansion 1 (c • ⇑Delta) := by rfl rw [hsmul, ← Nat.cast_one (R := ℝ), ← hs] at h2 simp_all only [Nat.cast_one, map_smul, smul_eq_mul, mul_one, one_smul] @@ -263,9 +265,11 @@ private lemma rank_one_of_qExpansion_coeff_zero_eq_one {k : ℤ} (hk : k < 12) have hcusp : IsCuspForm Γ(1) k (g - c⁻¹• f) := by rw [IsCuspForm_iff_coeffZero_eq_zero] rw [← Nat.cast_one (R := ℝ), qExpansion_coe_sub, - ModularForm.qExpansion_sub (h := (1 : ℕ)) (hh := by positivity) (hΓ := by simp)] + ModularForm.qExpansion_sub (h := (1 : ℕ)) (hh := by positivity) (hΓ := by simp only [ + CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, AddSubgroup.mem_zmultiples])] have hnorm0 := modularForm_normalise f hf2 - simp_all + simp_all only [ne_eq, PowerSeries.coeff_zero_eq_constantCoeff, Nat.cast_one, FunLike.coe_smul, + map_sub, sub_self] have := IsCuspForm_weight_lt_eq_zero k hk (g - c⁻¹• f) hcusp have hfc := hf c rw [@sub_eq_zero] at this @@ -367,7 +371,9 @@ f^3 = a^3 E₆, but now this would mean that Δ = 0 or a = 0, which is a contrad simp only [one_div, _root_.smul_apply, sub_apply, smul_eq_mul, zero_apply, mul_eq_zero, inv_eq_zero, OfNat.ofNat_ne_zero, false_or, F] ring_nf - simp_all + simp_all only [PowerSeries.coeff_zero_eq_constantCoeff, ne_eq, Int.reduceAdd, one_div, + isUnit_iff_ne_zero, OfNat.ofNat_ne_zero, not_false_eq_true, pow_eq_zero_iff, + IsUnit.smul_eq_zero] lemma dim_modforms_eq_one_add_dim_cuspforms (k : ℕ) (hk : 3 ≤ (k : ℤ)) (hk2 : Even k) : Module.rank ℂ (ModularForm (CongruenceSubgroup.Gamma 1) k) = @@ -394,7 +400,8 @@ lemma dim_modforms_eq_one_add_dim_cuspforms (k : ℕ) (hk : 3 ≤ (k : ℤ)) (hk qExpansion 1 ⇑(c • E k hk - f) = qExpansion 1 ⇑(c • E k hk) - qExpansion 1 ⇑f := by simpa using - (ModularForm.qExpansion_sub (h := (1 : ℕ)) (hh := by positivity) (hΓ := by simp) + (ModularForm.qExpansion_sub (h := (1 : ℕ)) (hh := by positivity) (hΓ := by simp only [ + CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, AddSubgroup.mem_zmultiples]) (f := c • E k hk) (g := f)) have hsmul : qExpansion 1 ⇑(c • E k hk) = c • qExpansion 1 (E k hk) := by calc diff --git a/LeanPool/LeanModularForms/Modularforms/E2.lean b/LeanPool/LeanModularForms/Modularforms/E2.lean index 7531094bce..ecd7ffc34e 100644 --- a/LeanPool/LeanModularForms/Modularforms/E2.lean +++ b/LeanPool/LeanModularForms/Modularforms/E2.lean @@ -113,7 +113,7 @@ lemma E₂_S_transform (z : ℍ) : private lemma cexp_succ_eq_pow (z : ℍ) (n : ℕ) : cexp (2 * π * Complex.I * (n + 1) * z) = cexp (2 * π * Complex.I * z) ^ (n + 1) := by - rw [← Complex.exp_nat_mul]; congr 1; push_cast; ring + rw [← Complex.exp_nat_mul]; congr 1; push_cast; ac_rfl lemma tsum_eq_tsum_sigma (z : ℍ) : ∑' n : ℕ, (n + 1) * cexp (2 * π * Complex.I * (n + 1) * z) / (1 - cexp (2 * π * Complex.I * (n + 1) * z)) = @@ -131,10 +131,11 @@ lemma tsum_eq_tsum_sigma (z : ℍ) : ∑' n : ℕ, (n + 1) * calc ∑' n : ℕ, (n + 1) * cexp (2 * π * Complex.I * (n + 1) * z) / (1 - cexp (2 * π * Complex.I * (n + 1) * z)) - = ∑' n : ℕ, f (n + 1) := tsum_congr fun n => by simp [f, pow_one, cexp_succ_eq_pow z n, q] + = ∑' n : ℕ, f (n + 1) := tsum_congr fun n => by simp only [cexp_succ_eq_pow z n, pow_one, + Nat.cast_add, Nat.cast_one, f, q] _ = ∑' n : ℕ, g (n + 1) := h _ = ∑' n : ℕ, sigma 1 (n + 1) * cexp (2 * π * Complex.I * (n + 1) * z) := - tsum_congr fun n => by simp [g, cexp_succ_eq_pow z n, q] + tsum_congr fun n => by simp only [cexp_succ_eq_pow z n, g, q] lemma E₂_eq (z : UpperHalfPlane) : E₂ z = 1 - 24 * ∑' n : ℕ+, ↑n * cexp (2 * π * Complex.I * n * z) / diff --git a/LeanPool/LeanModularForms/Modularforms/Eisenstein.lean b/LeanPool/LeanModularForms/Modularforms/Eisenstein.lean index 00e0162f50..07fa865bdf 100644 --- a/LeanPool/LeanModularForms/Modularforms/Eisenstein.lean +++ b/LeanPool/LeanModularForms/Modularforms/Eisenstein.lean @@ -152,8 +152,10 @@ theorem cuspfunc_lim_coef {k : ℤ} {F : Type u_1} [inst : FunLike F ℍ ℂ] (n (by simp only [Nat.cast_pos]; exact Nat.pos_of_neZero n) hq hq1 have hft := hf ⟨(Periodic.invQParam (↑n) q), hq2⟩ have := eq_cuspFunction (h := n) (f := ⇑f) - ⟨(Periodic.invQParam (↑n) q), hq2⟩ (by simp [inst_2.1]) - (SlashInvariantFormClass.periodic_comp_ofComplex f (by simp)) + ⟨(Periodic.invQParam (↑n) q), hq2⟩ (by simp only [ne_eq, Nat.cast_eq_zero, inst_2.1, + not_false_eq_true]) + (SlashInvariantFormClass.periodic_comp_ofComplex f (by simp only [ + CongruenceSubgroup.strictPeriods_Gamma, AddSubgroup.mem_zmultiples])) simp only [smul_eq_mul, ne_eq] at * rw [Function.Periodic.qParam_right_inv] at this hft · rw [← this] at hft @@ -167,7 +169,8 @@ theorem cuspfunc_lim_coef {k : ℤ} {F : Type u_1} [inst : FunLike F ℍ ℂ] (n theorem summable_zero_pow {G : Type*} [NormedField G] (f : ℕ → G) : Summable fun m ↦ f m * 0 ^ m := by - simp [← summable_nat_add_iff 1] + simp only [← summable_nat_add_iff 1, ne_eq, Nat.add_eq_zero_iff, one_ne_zero, and_false, + not_false_eq_true, zero_pow, mul_zero, summable_zero] lemma tsum_zero_pow (f : ℕ → ℂ) : (∑' m, f m * 0 ^ m) = f 0 := by simp [Summable.tsum_eq_zero_add (summable_zero_pow f)] @@ -183,7 +186,8 @@ lemma cuspfunc_Zero [hn : NeZero n] [ModularFormClass F Γ(n) k] : cuspFunction hnpos hΓ⟩ have := UpperHalfPlane.hasSum_qExpansion_of_norm_lt (h := n) (q := 0) hnpos (SlashInvariantFormClass.periodic_comp_ofComplex f hΓ) - (ModularFormClass.holo f) (ModularFormClass.bdd_at_infty f) (by simp) + (ModularFormClass.holo f) (ModularFormClass.bdd_at_infty f) (by simp only [norm_zero, + zero_lt_one]) simp only [smul_eq_mul] at this rw [Summable.hasSum_iff] at this · rw [tsum_zero_pow] at this @@ -390,7 +394,7 @@ lemma qexpsummable (k : ℕ) (hk : 3 ≤ (k : ℤ)) (z : ℍ) : conv => enter [1] ext a - rw [show ((a : ℝ) + 1) = ((a + 1) : ℕ) by simp] + rw [show ((a : ℝ) + 1) = ((a + 1) : ℕ) by simp only [Nat.cast_add, Nat.cast_one] ] have := summable_nat_add_iff 1 (f := fun a : ℕ ↦ (((a) : ℝ) ^ k) * ‖cexp (2 * ↑π * Complex.I * ↑z) ^ (a)‖) simp only [Nat.ofNat_le_cast, Nat.cast_add, Nat.cast_one, norm_pow] at * @@ -429,7 +433,7 @@ lemma qexpsummable (k : ℕ) (hk : 3 ≤ (k : ℤ)) (z : ℍ) : nth_rw 2 [show k = 1 + (k - 1) by omega] rw [pow_add] gcongr - simp + simp only [pow_one] simpa using Nat.card_divisors_le_self (b + 1) @@ -457,8 +461,8 @@ private lemma Ek_hasSum (k : ℕ) (hk : 3 ≤ (k : ℤ)) (hk2 : Even k) (z : ℍ congr rw [Function.Periodic.qParam, ← Complex.exp_nsmul] congr - simp - ring + simp only [ofReal_one, div_one, nsmul_eq_mul] + ac_rfl have hr := (summable_nat_add_iff 1 (f := fun n : ℕ ↦ c (n) • 𝕢 (1 : ℝ) ↑z ^ (n))) simp only [smul_eq_mul, Nat.cast_one] at * rw [hr] @@ -477,7 +481,7 @@ lemma Ek_q_exp_zero (k : ℕ) (hk : 3 ≤ (k : ℤ)) (hk2 : Even k) : (qExpansio have h := q_exp_unique 1 c (E k hk) (fun z => Ek_hasSum k hk hk2 z) have hc := congr_fun h 0 rw [Nat.cast_one] at hc - simp [← hc, c] + simp only [← hc, one_div, neg_mul, ↓reduceIte, c] lemma Ek_q_exp (k : ℕ) (hk : 3 ≤ (k : ℤ)) (hk2 : Even k) : (fun m => (qExpansion 1 (E k hk)).coeff m) = @@ -635,7 +639,7 @@ lemma Delta_cuspFuntion_eq : Set.EqOn (cuspFunction 1 Delta) · have : cexp (2 * ↑π * Complex.I * Periodic.invQParam 1 y) = y := by nth_rw 2 [← hq] congr 1 - simp + simp only [ofReal_one, div_one] rw [this] congr ext n @@ -650,7 +654,7 @@ lemma Delta_cuspFuntion_eq : Set.EqOn (cuspFunction 1 Delta) exact Ne.symm (zero_ne_one' ℝ) · simp only [one_div, mem_ball, dist_zero_right] at hy apply lt_trans hy - linarith + linarith only [] · exact hyn0 exact hyn0 @@ -812,7 +816,7 @@ lemma neg_two_pi_I_pow_even_real (k : ℕ) (hk : Even k) : simp only [← two_mul, pow_mul, I_sq] -- (-1)^m is real: ±1 rcases m.even_or_odd with hm | hm <;> simp [hm.neg_one_pow] - simp [Complex.mul_im, h1, h2] + simp only [mul_im, h2, mul_zero, h1, zero_mul, add_zero] /-- On imaginary axis z = I*t, the q-expansion exponent 2πi·n·z reduces to -(2πnt). This is useful for reusing the same algebraic simplification across `E₂`, `E₄`, `E₆`. -/ @@ -830,7 +834,8 @@ theorem E_even_imag_axis_real (k : ℕ) (hk : (3 : ℤ) ≤ k) (hk2 : Even k) : ResToImagAxis.Real (E k hk).toFun := by intro t ht simp only [Function.resToImagAxis, ResToImagAxis, ht, ↓reduceDIte] - let z : ℍ := ⟨Complex.I * t, by simp [ht]⟩ + let z : ℍ := ⟨Complex.I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, + Complex.I_im, ofReal_re, one_mul, zero_add, ht]⟩ change (E k hk z).im = 0 have hq := E_k_q_expansion k hk hk2 z rw [hq] @@ -869,16 +874,17 @@ theorem E_even_imag_axis_real (k : ℕ) (hk : (3 : ℤ) ≤ k) (hk2 : Even k) : have hsum_im : (∑' (n : ℕ+), ↑((ArithmeticFunction.sigma (k - 1)) ↑n) * cexp (2 * ↑Real.pi * Complex.I * z * n)).im = 0 := by rw [im_tsum hsum] - simp [hterm_im] + simp only [hterm_im, tsum_zero] -- Step 4: Show the coefficient is real and product with sum is real have hpow_im : ((-2 * Real.pi * Complex.I) ^ k : ℂ).im = 0 := neg_two_pi_I_pow_even_real k hk2 - have hfact_im : ((k - 1).factorial : ℂ).im = 0 := by simp + have hfact_im : ((k - 1).factorial : ℂ).im = 0 := by simp only [natCast_im] -- For ζ(k) when k ≥ 4, it's real (mathlib: riemannZeta_im_eq_zero_of_one_lt) have hzeta_im : (riemannZeta k).im = 0 := by rw [show (k : ℂ) = ((k : ℝ) : ℂ) from by push_cast; ring] exact riemannZeta_im_eq_zero_of_one_lt (by exact_mod_cast show 1 < (k : ℤ) by omega) - have hinv_zeta_im : (1 / riemannZeta k).im = 0 := by simp [hzeta_im] + have hinv_zeta_im : (1 / riemannZeta k).im = 0 := by simp only [one_div, inv_im, hzeta_im, + neg_zero, zero_div] simp only [mul_im, div_im, hinv_zeta_im, hsum_im, hpow_im, hfact_im] ring @@ -897,7 +903,8 @@ theorem E₆_imag_axis_real : ResToImagAxis.Real E₆.toFun := theorem E₂_imag_axis_real : ResToImagAxis.Real E₂ := by intro t ht simp only [Function.resToImagAxis, ResToImagAxis, ht, ↓reduceDIte] - let z : ℍ := ⟨Complex.I * t, by simp [ht]⟩ + let z : ℍ := ⟨Complex.I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, + Complex.I_im, ofReal_re, one_mul, zero_add, ht]⟩ change (E₂ z).im = 0 have hq := E₂_eq z rw [hq] @@ -915,7 +922,8 @@ theorem E₂_imag_axis_real : ResToImagAxis.Real E₂ := by simp only [Complex.sub_im, Complex.one_im, hexp_arg, exp_ofReal_im, sub_zero] have hnum_real : (↑n * cexp (2 * ↑Real.pi * Complex.I * n * z)).im = 0 := by simp only [mul_im, natCast_im, hexp_arg, exp_ofReal_im, mul_zero, zero_mul, add_zero] - simp [Complex.div_im, hnum_real, hone_sub_real] + simp only [div_im, hnum_real, sub_re, one_re, zero_mul, zero_div, mul_re, natCast_re, + natCast_im, sub_zero, hone_sub_real, mul_zero, sub_self] -- Step 2: Summability of the series have hsum : Summable fun n : ℕ+ => ↑n * cexp (2 * ↑Real.pi * Complex.I * n * z) / (1 - cexp (2 * ↑Real.pi * Complex.I * n * z)) := by @@ -949,8 +957,10 @@ This bound on the q-parameter is useful for estimating q-expansions when im(z) lemma norm_exp_two_pi_I_le_exp_neg_two_pi (z : ℍ) (hz : 1 ≤ z.im) : ‖cexp (2 * π * Complex.I * z)‖ ≤ Real.exp (-2 * π) := by have h : (2 * ↑π * Complex.I * (z : ℂ)).re = -2 * π * z.im := by - rw [show (2 : ℂ) * ↑π * Complex.I * z = Complex.I * (2 * π * z) by ring] - simp [Complex.I_re, Complex.I_im, mul_comm] + rw [show (2 : ℂ) * ↑π * Complex.I * z = Complex.I * (2 * π * z) by ac_rfl] + simp only [mul_comm, mul_re, Complex.I_re, coe_re, ofReal_re, re_ofNat, ofReal_im, im_ofNat, + mul_zero, sub_zero, coe_im, mul_im, zero_mul, add_zero, Complex.I_im, zero_add, one_mul, + zero_sub, mul_neg, neg_mul] rw [Complex.norm_exp, h, Real.exp_le_exp] nlinarith only [hz, Real.pi_pos] @@ -980,7 +990,7 @@ lemma norm_tsum_logDeriv_expo_le {q : ℂ} (hq : ‖q‖ < 1) : linarith _ = 1 - ‖q ^ (n : ℕ)‖ := by rw [norm_pow] _ ≤ ‖1 - q ^ (n : ℕ)‖ := by - have := norm_sub_norm_le (1 : ℂ) (q ^ (n : ℕ)); simp only [norm_one] at this; linarith + have := norm_sub_norm_le (1 : ℂ) (q ^ (n : ℕ)); simp only [norm_one] at this; exact this calc ↑n * ‖q ^ (n : ℕ)‖ / ‖1 - q ^ (n : ℕ)‖ ≤ ↑n * ‖q ^ (n : ℕ)‖ / (1 - r) := by exact div_le_div_of_nonneg_left (mul_nonneg (Nat.cast_nonneg _) (norm_nonneg _)) (sub_pos.mpr hq) hdenom_lower @@ -1030,13 +1040,13 @@ lemma E₂_isBoundedAtImInfty : IsBoundedAtImInfty E₂ := by have : cexp (2 * π * Complex.I * n * z) = q ^ (n : ℕ) := by change _ = (cexp (2 * π * Complex.I * z)) ^ (n : ℕ) rw [← Complex.exp_nat_mul]; ring_nf - simp [this] + simp only [this] calc ‖1 - 24 * ∑' n : ℕ+, ↑n * cexp (2 * π * Complex.I * ↑n * ↑z) / (1 - cexp (2 * π * Complex.I * ↑n * ↑z))‖ = ‖1 - 24 * S‖ := by rw [hS_eq] _ ≤ 1 + 24 * ‖S‖ := by calc _ ≤ ‖(1 : ℂ)‖ + ‖24 * S‖ := norm_sub_le _ _ - _ = _ := by simp + _ = _ := by simp only [norm_one, Complex.norm_mul, Complex.norm_ofNat] _ ≤ 1 + 24 * (r₀ / (1 - r₀) ^ 3) := by gcongr; exact norm_tsum_logDeriv_expo_le_of_norm_le hq_bound hr₀_lt_one diff --git a/LeanPool/LeanModularForms/Modularforms/EisensteinAsymptotics.lean b/LeanPool/LeanModularForms/Modularforms/EisensteinAsymptotics.lean index 6f5206a2da..a88e79728a 100644 --- a/LeanPool/LeanModularForms/Modularforms/EisensteinAsymptotics.lean +++ b/LeanPool/LeanModularForms/Modularforms/EisensteinAsymptotics.lean @@ -65,8 +65,10 @@ lemma modular_form_tendsto_atImInfty {k : ℤ} (f : ModularForm (Gamma 1) k) : Filter.Tendsto f.toFun atImInfty (nhds ((qExpansion 1 f).coeff 0)) := by obtain ⟨c, hc, hO⟩ := ModularFormClass.exp_decay_sub_atImInfty' f rw [qExpansion_coeff_zero (f := ⇑f) (by norm_num : (0 : ℝ) < 1) - (ModularFormClass.analyticAt_cuspFunction_zero f one_pos (by simp)) - (SlashInvariantFormClass.periodic_comp_ofComplex f (by simp))] + (ModularFormClass.analyticAt_cuspFunction_zero f one_pos (by simp only [strictPeriods_Gamma, + Nat.cast_one, AddSubgroup.mem_zmultiples])) + (SlashInvariantFormClass.periodic_comp_ofComplex f (by simp only [strictPeriods_Gamma, + Nat.cast_one, AddSubgroup.mem_zmultiples]))] simpa using (tendsto_zero_of_exp_decay hc hO).add_const (valueAtInfty f.toFun) /-- E₂ - 1 = O(exp(-2π·Im z)) at infinity. -/ @@ -77,11 +79,12 @@ lemma E₂_sub_one_isBigO_exp : (fun z : ℍ => E₂ z - 1) =O[atImInfty] -- E₂ z - 1 = -24 * ∑' n, n·qⁿ/(1-qⁿ) have hsub : E₂ z - 1 = -24 * ∑' (n : ℕ+), ↑n * cexp (2 * π * Complex.I * ↑n * ↑z) / (1 - cexp (2 * π * Complex.I * ↑n * ↑z)) := by rw [E₂_eq z]; ring - rw [hsub, norm_mul, show ‖(-24 : ℂ)‖ = 24 by simp, Real.norm_of_nonneg (Real.exp_pos _).le] + rw [hsub, norm_mul, show ‖(-24 : ℂ)‖ = 24 by simp only [norm_neg, + Complex.norm_ofNat], Real.norm_of_nonneg (Real.exp_pos _).le] set q : ℂ := cexp (2 * π * Complex.I * z) -- Rewrite sum in terms of q^n simp_rw [show ∀ n : ℕ, cexp (2 * π * Complex.I * n * z) = q ^ n by - intro n; rw [← Complex.exp_nat_mul]; congr 1; ring] + intro n; rw [← Complex.exp_nat_mul]; congr 1; ac_rfl] -- Key bounds: ‖q‖ ≤ exp(-2π) < 1/2 have hq_bound : ‖q‖ ≤ Real.exp (-2 * π) := norm_exp_two_pi_I_le_exp_neg_two_pi z hz have hexp_lt_half : Real.exp (-2 * π) < 1 / 2 := by @@ -239,11 +242,11 @@ lemma summable_pow_shift (k : ℕ) : rexp (2 * π) * ((m + 1) ^ k * rexp (-2 * π * (m + 1))) := fun m => by have : rexp (-2 * π * m) = rexp (2 * π) * rexp (-2 * π * (m + 1)) := by rw [← Real.exp_add]; ring_nf - rw [this]; ring + rw [this]; ac_rfl simp_rw [h_eq] apply Summable.mul_left refine (h.comp_injective Nat.succ_injective).congr (fun m => ?_) - simp [Function.comp_apply, Nat.succ_eq_add_one] + simp only [neg_mul, Function.comp_apply, Nat.succ_eq_add_one, Nat.cast_add, Nat.cast_one] /-- Derivative bounds for q-expansion coefficients. Given `‖a n‖ ≤ n^k`, produces bounds @@ -290,7 +293,10 @@ lemma qexp_deriv_bound_of_coeff_bound {a : ℕ+ → ℂ} {k : ℕ} gcongr; exact ha n _ ≤ (n : ℝ)^k * (2 * π * n) * rexp (-2 * π * n * k_min.im) := by apply mul_le_mul_of_nonneg_left _ (by positivity) - simp_all + simp_all only [mul_pos_iff_of_pos_right, Nat.ofNat_pos, mul_pos_iff_of_pos_left, + neg_mul, Nat.cast_pos, PNat.pos, Complex.norm_mul, Complex.norm_ofNat, norm_real, + norm_eq_abs, abs_pi, norm_I, mul_one, RCLike.norm_natCast, exp_le_exp, neg_le_neg_iff, + mul_le_mul_iff_right₀] _ = 2 * π * (n : ℝ)^(k + 1) * rexp (-2 * π * n * k_min.im) := by ring · use fun _ => 0 constructor diff --git a/LeanPool/LeanModularForms/Modularforms/Eisensteinqexpansions.lean b/LeanPool/LeanModularForms/Modularforms/Eisensteinqexpansions.lean index b78bad74e8..7fd0d5a049 100644 --- a/LeanPool/LeanModularForms/Modularforms/Eisensteinqexpansions.lean +++ b/LeanPool/LeanModularForms/Modularforms/Eisensteinqexpansions.lean @@ -157,7 +157,7 @@ def GammaSetOneEquiv : (Fin 2 → ℤ) ≃ (Σn : ℕ, gammaSetN n) where theorem q_exp_iden_2 (k : ℕ) (hk : 3 ≤ k) (hk2 : Even k) (z : ℍ) : ∑' x : ℤ × ℤ, 1 / ((x.1 : ℂ) * z + x.2) ^ k = 2 * (riemannZeta (k)) + 2 * ∑' c : ℕ+, ∑' d : ℤ, 1 / (c * (z : ℂ) + d) ^ k := by - have hkk : 1 < (k ) := by linarith + have hkk : 1 < (k ) := by linarith only [hk] rw [Summable.tsum_prod, sum_int_even] · simp only [Int.cast_zero, zero_mul, zero_add, one_div, Int.cast_natCast, add_left_inj] rw [sum_int_even] @@ -172,12 +172,12 @@ theorem q_exp_iden_2 (k : ℕ) (hk : 3 ≤ k) (hk2 : Even k) (z : ℍ) : simp only [PNat.pow_coe, Nat.cast_pow] rw [zeta_nat_eq_tsum_of_gt_one hkk, ← tsum_pNat _ (by simp; omega)] simp only [one_div] - · simp_all + · simp_all only [Int.cast_neg, Even.neg_pow, implies_true] have := (Complex.summable_one_div_nat_cpow (p := k)).mpr (by simp [hkk]) simp only [one_div] at * norm_cast at * apply Summable.of_nat_of_neg_add_one - · simp_all + · simp_all only [Nat.cast_pow, Int.cast_pow, Int.cast_natCast] rw [← summable_nat_add_iff 1] at this apply this.congr intro b @@ -196,7 +196,7 @@ theorem q_exp_iden_2 (k : ℕ) (hk : 3 ≤ k) (hk2 : Even k) (z : ℍ) : have := Even.neg_pow hk2 (n* (z : ℂ) + d) rw [←this] ring - · have hkz : 3 ≤ (k : ℤ) := by linarith + · have hkz : 3 ≤ (k : ℤ) := by linarith only [hk] refine Summable.prod (f := fun x : ℤ × ℤ => 1 / ((x.1 : ℂ) * z + x.2) ^ k) ?_ rw [← (piFinTwoEquiv fun _ => ℤ).summable_iff] apply Summable.of_norm @@ -205,7 +205,7 @@ theorem q_exp_iden_2 (k : ℕ) (hk : 3 ≤ k) (hk2 : Even k) (z : ℍ) : simp_rw [eisSummand] simp only [Fin.isValue, zpow_neg, zpow_natCast, norm_inv, norm_pow, one_div, piFinTwoEquiv_apply, comp_apply] - · have hkz : 3 ≤ (k : ℤ) := by linarith + · have hkz : 3 ≤ (k : ℤ) := by linarith only [hk] rw [← (piFinTwoEquiv fun _ => ℤ).summable_iff] apply Summable.of_norm apply (EisensteinSeries.summable_norm_eisSummand hkz z).congr @@ -223,9 +223,9 @@ lemma EQ1 (k : ℕ) (hk : 3 ≤ (k : ℤ)) (hk2 : Even k) (z : ℍ) : ∑' (x : 1 / (x 0 * (z : ℂ) + x 1) ^ ↑k = 2 * riemannZeta ↑k + 2 * ((-2 * ↑π * Complex.I) ^ k / ↑(k - 1)!) * ∑' (n : ℕ+), ↑((σ (k - 1)) ↑n) * cexp (2 * ↑π * Complex.I * ↑z * ↑↑n) := by - rw [EQ0, q_exp_iden_2 k (by linarith) hk2] + rw [EQ0, q_exp_iden_2 k (by linarith only [hk]) hk2] simp only [one_div, neg_mul, add_right_inj] - have h1 (c : ℕ+) := q_exp_iden k (by linarith) (c • z) + have h1 (c : ℕ+) := q_exp_iden k (by linarith only [hk]) (c • z) simp only [Nat.ofNat_le_cast, natPosSMul_apply, one_div, neg_mul] at * conv => enter [1,2,1] @@ -247,7 +247,7 @@ lemma EQ1 (k : ℕ) (hk : 3 ≤ (k : ℤ)) (hk2 : Even k) (z : ℍ) : ∑' (x : simp only [sigmaAntidiagonalEquivProd, PNat.mk_coe, Equiv.coe_fn_mk] apply (summable_auxil_1 (k - 1) z).congr intro b - simp [divisorsAntidiagonalFactors] + simp only [divisorsAntidiagonalFactors, comp_apply, PNat.mk_coe] simp only [Fin.isValue, piFinTwoEquiv_symm_apply, Fin.cons_zero, Fin.cons_one] intro b have A3 := a1 k b z @@ -286,13 +286,13 @@ lemma EQ22 (k : ℕ) (hk : 3 ≤ (k : ℤ)) (z : ℍ) : enter [2,1] ext c rw [show ((0 : ℂ)^ k)⁻¹ = 0 by simp; omega] - simp + simp only [zero_mul] conv => enter [1,1] ext c rw [gammaSetN_eisSummand k z, show (((0 : ℕ) : ℂ)^ (k : ℤ))⁻¹ = 0 by simp; omega] - simp - simp + simp only [zero_mul] + simp only [tsum_zero] conv => enter [1,1] ext c @@ -314,7 +314,7 @@ lemma EQ22 (k : ℕ) (hk : 3 ≤ (k : ℤ)) (z : ℍ) : apply (EisensteinSeries.summable_norm_eisSummand hk z).subtype have := (GammaSetOneEquiv.symm.summable_iff ( f := fun v => eisSummand k v z)).mpr ?_ · apply this.congr - simp_all + simp_all only [Nat.ofNat_le_cast, one_div, comp_apply, implies_true] exact (EisensteinSeries.summable_norm_eisSummand hk z).of_norm lemma EQ2 (k : ℕ) (hk : 3 ≤ (k : ℤ)) (z : ℍ) : ∑' (x : Fin 2 → ℤ), diff --git a/LeanPool/LeanModularForms/Modularforms/Eta.lean b/LeanPool/LeanModularForms/Modularforms/Eta.lean index 4a497f1cd9..114e327336 100644 --- a/LeanPool/LeanModularForms/Modularforms/Eta.lean +++ b/LeanPool/LeanModularForms/Modularforms/Eta.lean @@ -64,7 +64,7 @@ lemma eta_logDeriv_eql (z : ℍ) : (logDeriv (η ∘ (fun z : ℂ => -1/z))) z = nth_rw 2 [div_eq_mul_inv] · rw [← Complex.exp_neg, show 2⁻¹ * cexp (-(2⁻¹ * Complex.log ↑z)) * cexp (-(2⁻¹ * Complex.log ↑z)) = - (cexp (-(2⁻¹ * Complex.log ↑z)) * cexp (-(2⁻¹ * Complex.log ↑z)))* 2⁻¹ by ring, + (cexp (-(2⁻¹ * Complex.log ↑z)) * cexp (-(2⁻¹ * Complex.log ↑z)))* 2⁻¹ by ac_rfl, ← Complex.exp_add, ← sub_eq_add_neg, show -(2⁻¹ * Complex.log ↑z) - 2⁻¹ * Complex.log ↑z = -Complex.log ↑z by ring, Complex.exp_neg, Complex.exp_log, @@ -114,8 +114,8 @@ lemma eta_logderivs_const : ∃ z : ℂ, z ≠ 0 ∧ {z : ℂ | 0 < z.im}.EqOn ( simpa [ModularForm.eta] using (ModularForm.differentiableAt_eta_of_mem_upperHalfPlaneSet (z := x) hx) · apply DifferentiableOn.div - · fun_prop - · fun_prop + · exact differentiableOn_const (-1) + · exact differentiableOn_id intro x hx have hx2 := ne_zero (⟨x, hx⟩ : ℍ) norm_cast at * diff --git a/LeanPool/LeanModularForms/Modularforms/EtaCleanup.lean b/LeanPool/LeanModularForms/Modularforms/EtaCleanup.lean index 63dc7611b2..e744607751 100644 --- a/LeanPool/LeanModularForms/Modularforms/EtaCleanup.lean +++ b/LeanPool/LeanModularForms/Modularforms/EtaCleanup.lean @@ -39,11 +39,12 @@ local notation "𝕢₁" => Periodic.qParam 1 noncomputable abbrev etaQ (n : ℕ) (z : ℂ) := (𝕢₁ z) ^ (n + 1) lemma eta_q_eq_exp (n : ℕ) (z : ℂ) : etaQ n z = cexp (2 * π * Complex.I * (n + 1) * z) := by - simp [etaQ, Periodic.qParam, ← Complex.exp_nsmul] + simp only [etaQ, Periodic.qParam, ofReal_one, div_one, ← exp_nsmul, nsmul_eq_mul, Nat.cast_add, + Nat.cast_one] ring_nf lemma eta_q_eq_pow (n : ℕ) (z : ℂ) : etaQ n z = cexp (2 * π * Complex.I * z) ^ (n + 1) := by - simp [etaQ, Periodic.qParam] + simp only [etaQ, Periodic.qParam, ofReal_one, div_one] theorem qParam_lt_one (z : ℍ) (r : ℝ) (hr : 0 < r) : ‖𝕢 r z‖ < 1 := by simp only [Periodic.qParam, norm_exp, div_ofReal_re, mul_re, re_ofNat, ofReal_re, im_ofNat, @@ -57,7 +58,7 @@ lemma one_sub_qParam_ne_zero (r : ℝ) (hr : 0 < r) (z : ℍ) : 1 - 𝕢 r z ≠ intro h have := qParam_lt_one z r hr rw [← h] at this - simp at this + simp only [norm_one, lt_self_iff_false] at this lemma one_add_eta_q_ne_zero (n : ℕ) (z : ℍ) : 1 - etaQ n z ≠ 0 := by rw [eta_q_eq_exp, sub_ne_zero] @@ -111,7 +112,7 @@ lemma hasProdLocallyUniformlyOn_eta : · filter_upwards with n x hx simpa only [etaQ, eta_q_eq_pow n x, norm_neg, norm_pow, UpperHalfPlane.coe_mk, eta_q_eq_pow n (⟨z, hK hz⟩ : ℍ)] using - pow_le_pow_left₀ (by simp [norm_nonneg]) (HB x hx) (n + 1) + pow_le_pow_left₀ (by simp only [norm_nonneg]) (HB x hx) (n + 1) · simp_rw [etaQ, Periodic.qParam] fun_prop @@ -136,7 +137,8 @@ lemma dedekindEtaFun'_ne_zero (z : ℍ) : η z ≠ 0 := by lemma logDeriv_one_sub_cexp (r : ℂ) : logDeriv (fun z ↦ 1 - r * cexp z) = fun z ↦ -r * cexp z / (1 - r * cexp ( z)) := by ext z - simp [logDeriv] + simp only [logDeriv, deriv_const_sub', differentiableAt_const, differentiableAt_exp, + deriv_fun_mul, deriv_const', zero_mul, Complex.deriv_exp, zero_add, Pi.div_apply, neg_mul] lemma logDeriv_one_sub_mul_cexp_comp (r : ℂ) {g : ℂ → ℂ} (hg : Differentiable ℂ g) : logDeriv ((fun z ↦ 1 - r * cexp z) ∘ g) = @@ -159,7 +161,7 @@ theorem one_add_eta_logDeriv_eq (z : ℂ) (i : ℕ) : simp_all only [one_mul, deriv_const_mul_id'] simp_rw [eta_q_eq_exp, h2, logDeriv_one_sub_mul_cexp_comp 1 (g := fun x => (2 * π * Complex.I * (i + 1) * x)) (by fun_prop), h3] - simp + simp only [neg_mul, one_mul, mul_neg] lemma tsum_log_deriv_eta_q (z : ℂ) : ∑' (i : ℕ), logDeriv (fun x ↦ 1 - etaQ i x) z = @@ -225,7 +227,8 @@ lemma eta_logDeriv' (z : ℍ) : logDeriv dedekindEtaFun' z = (π * Complex.I / 1 (1 - cexp (2 * ↑π * Complex.I * ↑↑n * ↑z))) = ∑' (n : ℕ), (↑(n + 1 : ℕ) * cexp (2 * ↑π * Complex.I * ↑(n + 1 : ℕ) * ↑z) / (1 - cexp (2 * ↑π * Complex.I * ↑(n + 1 : ℕ) * ↑z))) from by - rw [← Equiv.pnatEquivNat.symm.tsum_eq]; simp] + rw [← Equiv.pnatEquivNat.symm.tsum_eq]; simp only [Equiv.pnatEquivNat_symm_apply, + Nat.succPNat_coe, Nat.succ_eq_add_one, Nat.cast_add, Nat.cast_one] ] simp_rw [eta_q_eq_exp] congr 1 · ring @@ -246,8 +249,8 @@ lemma eta_logDeriv' (z : ℍ) : logDeriv dedekindEtaFun' z = (π * Complex.I / 1 simp only [ne_eq, neg_mul, Nat.cast_add, Nat.cast_one, mul_neg] at * field_simp · exact hasProdLocallyUniformlyOn_eta.multipliableLocallyUniformlyOn - · simp [ne_eq, exp_ne_zero, not_false_eq_true, Periodic.qParam] - · fun_prop + · simp only [Periodic.qParam, ofReal_ofNat, ne_eq, exp_ne_zero, not_false_eq_true] + · exact Differentiable.differentiableAt (qParam_differentiable 24) lemma eta_logDeriv_eql' (z : ℍ) : (logDeriv (η ∘ (fun z : ℂ => -1/z))) z = (logDeriv ((csqrt) * η)) z := by @@ -259,7 +262,7 @@ lemma eta_logDeriv_eql' (z : ℍ) : (logDeriv (η ∘ (fun z : ℂ => -1/z))) z enter [1,1] intro z rw [neg_div] - simp + simp only [one_div] simp only [deriv.fun_neg', deriv_inv', neg_neg, inv_inj] norm_cast · simpa only using @@ -268,7 +271,7 @@ lemma eta_logDeriv_eql' (z : ℍ) : (logDeriv (η ∘ (fun z : ℂ => -1/z))) z enter [2] ext z rw [neg_div] - simp + simp only [one_div] apply DifferentiableAt.neg apply DifferentiableAt.inv · simp only [differentiableAt_fun_id] @@ -282,7 +285,7 @@ lemma eta_logDeriv_eql' (z : ℍ) : (logDeriv (η ∘ (fun z : ℂ => -1/z))) z nth_rw 2 [div_eq_mul_inv] rw [← Complex.exp_neg, show 2⁻¹ * cexp (-(2⁻¹ * Complex.log ↑z)) * cexp (-(2⁻¹ * Complex.log ↑z)) = - (cexp (-(2⁻¹ * Complex.log ↑z)) * cexp (-(2⁻¹ * Complex.log ↑z))) * 2⁻¹ by ring, + (cexp (-(2⁻¹ * Complex.log ↑z)) * cexp (-(2⁻¹ * Complex.log ↑z))) * 2⁻¹ by ac_rfl, ← Complex.exp_add, ← sub_eq_add_neg, show -(2⁻¹ * Complex.log ↑z) - 2⁻¹ * Complex.log ↑z = -Complex.log ↑z by ring, Complex.exp_neg, @@ -297,7 +300,7 @@ lemma eta_logDeriv_eql' (z : ℍ) : (logDeriv (η ∘ (fun z : ℂ => -1/z))) z ModularGroup.denom_S, Int.reduceNeg, zpow_neg] at * have h00 : (UpperHalfPlane.mk (-z : ℂ)⁻¹ z.im_inv_neg_coe_pos) = (⟨-1 / z, by simpa using pnat_div_upper 1 z⟩ : ℍ) := by - simp + simp only [inv_neg, UpperHalfPlane.mk.injEq] ring_nf rw [h00] at E rw [← mul_assoc, mul_comm, ← mul_assoc, E, add_mul, add_comm] @@ -306,7 +309,7 @@ lemma eta_logDeriv_eql' (z : ℍ) : (logDeriv (η ∘ (fun z : ℂ => -1/z))) z have hI : Complex.I ≠ 0 := I_ne_zero have hpi : (π : ℂ) ≠ 0 := by simpa only [ne_eq, ofReal_eq_zero] using Real.pi_ne_zero - simp at hzne ⊢ + simp only [ne_eq] at hzne ⊢ field_simp ring · rw [mul_comm] @@ -315,7 +318,7 @@ lemma eta_logDeriv_eql' (z : ℍ) : (logDeriv (η ∘ (fun z : ℂ => -1/z))) z · unfold csqrt rw [show (fun a ↦ cexp (1 / 2 * Complex.log a)) = cexp ∘ (fun a ↦ 1 / 2 * Complex.log a) by rfl] apply DifferentiableAt.comp - · simp + · simp only [one_div, differentiableAt_exp] · apply DifferentiableAt.const_mul apply Complex.differentiableAt_log rw [@mem_slitPlane_iff] @@ -342,8 +345,8 @@ lemma eta_logderivs_const' : ∃ z : ℂ, z ≠ 0 ∧ {z : ℂ | 0 < z.im}.EqOn apply DifferentiableAt.differentiableWithinAt apply eta_DifferentiableAt_UpperHalfPlane' ⟨x, hx⟩ · apply DifferentiableOn.div - · fun_prop - · fun_prop + · exact differentiableOn_const (-1) + · exact differentiableOn_id · intro x hx have hx2 := ne_zero (⟨x, hx⟩ : ℍ) norm_cast at * diff --git a/LeanPool/LeanModularForms/Modularforms/ExpLems.lean b/LeanPool/LeanModularForms/Modularforms/ExpLems.lean index 7cbd01e8cf..cc9984d5b8 100644 --- a/LeanPool/LeanModularForms/Modularforms/ExpLems.lean +++ b/LeanPool/LeanModularForms/Modularforms/ExpLems.lean @@ -41,4 +41,4 @@ lemma exp_periodo (z : ℍ) (n : ℕ) : have ht := (exp_periodic.nat_mul n) (2 * π * Complex.I * n * z) rw [← ht] congr 1 - ring + ac_rfl diff --git a/LeanPool/LeanModularForms/Modularforms/Generators/Defs.lean b/LeanPool/LeanModularForms/Modularforms/Generators/Defs.lean index 61529d9130..b2d93f6e43 100644 --- a/LeanPool/LeanModularForms/Modularforms/Generators/Defs.lean +++ b/LeanPool/LeanModularForms/Modularforms/Generators/Defs.lean @@ -184,7 +184,8 @@ lemma evalE₄E₆_whc_eq_single (n : ℕ) (p : MvPolynomial (Fin 2) ℂ) have hd0 : MvPolynomial.monomial d (p.coeff d) = MvPolynomial.C (p.coeff d) * MvPolynomial.X 0 ^ d 0 * MvPolynomial.X 1 ^ d 1 := by - rw [MvPolynomial.monomial_eq, mul_assoc]; simp_all + rw [MvPolynomial.monomial_eq, mul_assoc]; simp_all only [MvPolynomial.mem_support_iff, ne_eq, + Finsupp.prod_pow, Fin.prod_univ_two, Fin.isValue] rw [hd0, show MvPolynomial.C (p.coeff d) * MvPolynomial.X (0 : Fin 2) ^ d 0 * MvPolynomial.X (1 : Fin 2) ^ d 1 = MvPolynomial.C (p.coeff d) * @@ -202,7 +203,7 @@ lemma evalE₄E₆_whc_eq_single (n : ℕ) (p : MvPolynomial (Fin 2) ℂ) rw [d.sum_fintype (fun i a => a • E₄E₆Weight i) (fun i => by simp only [zero_smul])] simp only [Fin.sum_univ_two, E₄E₆Weight, Matrix.cons_val_zero, Matrix.cons_val_one, mul_comm, smul_eq_mul] - rw [this] at hweight; push_cast [← hweight]; ring), smul_zero] + rw [this] at hweight; push_cast [← hweight]; ac_rfl), smul_zero] /-- Weight casting for DirectSum elements. -/ lemma DirectSum_of_cast_eq {k₁ k₂ : ℤ} (hk : k₁ = k₂) diff --git a/LeanPool/LeanModularForms/Modularforms/Generators/Injectivity.lean b/LeanPool/LeanModularForms/Modularforms/Generators/Injectivity.lean index 79c22855c7..04489a66ef 100644 --- a/LeanPool/LeanModularForms/Modularforms/Generators/Injectivity.lean +++ b/LeanPool/LeanModularForms/Modularforms/Generators/Injectivity.lean @@ -44,7 +44,8 @@ private lemma evalE₄E₆_mono_grade (a b : ℕ) (k : ℤ) private lemma monomial_fin2_eq (d : Fin 2 →₀ ℕ) (c : ℂ) : MvPolynomial.monomial d c = MvPolynomial.C c * MvPolynomial.X 0 ^ d 0 * MvPolynomial.X 1 ^ d 1 := by - rw [MvPolynomial.monomial_eq, mul_assoc]; simp_all + rw [MvPolynomial.monomial_eq, mul_assoc]; simp_all only [Finsupp.prod_pow, Fin.prod_univ_two, + Fin.isValue] private lemma evalE₄E₆_monomial_grade (d : Fin 2 →₀ ℕ) (c : ℂ) (k : ℤ) (hk : k ≠ (↑(d 0) * 4 + ↑(d 1) * 6 : ℤ)) : @@ -66,7 +67,7 @@ private lemma weight_eq_4a_6b (d : Fin 2 →₀ ℕ) : private lemma weight_fin2_cast (d : Fin 2 →₀ ℕ) : (Finsupp.weight E₄E₆Weight d : ℤ) = ↑(d 0) * 4 + ↑(d 1) * 6 := by - rw [weight_eq_4a_6b]; push_cast; ring + rw [weight_eq_4a_6b]; push_cast; ac_rfl private lemma evalE₄E₆_component_eq (p : MvPolynomial (Fin 2) ℂ) (n : ℕ) : (evalE₄E₆ (MvPolynomial.weightedHomogeneousComponent E₄E₆Weight n p)) (↑n : ℤ) = diff --git a/LeanPool/LeanModularForms/Modularforms/Generators/Surjectivity.lean b/LeanPool/LeanModularForms/Modularforms/Generators/Surjectivity.lean index 3bd445e73d..d5fcc3eb6a 100644 --- a/LeanPool/LeanModularForms/Modularforms/Generators/Surjectivity.lean +++ b/LeanPool/LeanModularForms/Modularforms/Generators/Surjectivity.lean @@ -91,7 +91,7 @@ lemma monomial_coeff_zero_eq_one (n a b : ℕ) (hab : 4 * a + 6 * b = n) : (DirectSum.of (fun k : ℤ => ModularForm Γ(1) k) 6 E₆) ^ b) (↑n : ℤ))).coeff 0 = 1 := by subst hab - have hab' : (↑(4 * a + 6 * b) : ℤ) = ↑a * 4 + ↑b * 6 := by push_cast; ring + have hab' : (↑(4 * a + 6 * b) : ℤ) = ↑a * 4 + ↑b * 6 := by push_cast; ac_rfl rw [hab', DirectSum.ofPow, DirectSum.ofPow, DirectSum.of_mul_of] convert_to (qExpansion 1 (⇑(GradedMonoid.GMul.mul (GradedMonoid.GMonoid.gnpow a E₄) (GradedMonoid.GMonoid.gnpow b E₆)))).coeff 0 = 1 using 2 diff --git a/LeanPool/LeanModularForms/Modularforms/IccIcoLems.lean b/LeanPool/LeanModularForms/Modularforms/IccIcoLems.lean index 4d5c5b4742..3d349ad93d 100644 --- a/LeanPool/LeanModularForms/Modularforms/IccIcoLems.lean +++ b/LeanPool/LeanModularForms/Modularforms/IccIcoLems.lean @@ -48,9 +48,12 @@ lemma trex (f : ℤ → ℂ) (N : ℕ) (hn : 1 ≤ N) : ∑ m ∈ Finset.Icc (-N rw [add_assoc] congr rw [Finset.sum_pair] - · ring + · ac_rfl omega - simp + simp only [neg_add_rev, Int.reduceNeg, Finset.disjoint_insert_right, Finset.mem_Icc, + le_add_iff_nonneg_left, Int.neg_nonneg, Int.reduceLE, add_neg_le_iff_le_add, false_and, + not_false_eq_true, Finset.disjoint_singleton_right, add_le_iff_nonpos_right, and_false, + and_self] lemma Icc_sum_even (f : ℤ → ℂ) (hf : ∀ n, f n = f (-n)) (N : ℕ) : diff --git a/LeanPool/LeanModularForms/Modularforms/IsCuspForm.lean b/LeanPool/LeanModularForms/Modularforms/IsCuspForm.lean index 796c3223ac..ab3211c2f6 100644 --- a/LeanPool/LeanModularForms/Modularforms/IsCuspForm.lean +++ b/LeanPool/LeanModularForms/Modularforms/IsCuspForm.lean @@ -169,7 +169,8 @@ lemma IsCuspForm_iff_coeffZero_eq_zero (k : ℤ) (f : ModularForm Γ(1) k) : simp only [Nat.factorial_zero, Nat.cast_one, inv_one, iteratedDeriv_zero, one_mul] rw [IsCuspForm, CuspFormSubmodule, LinearMap.mem_range] at h obtain ⟨g, hg⟩ := h - have := CuspFormClass.cuspFunction_apply_zero (h := 1) g (by positivity) (by simp) + have := CuspFormClass.cuspFunction_apply_zero (h := 1) g (by positivity) (by simp only [ + CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, AddSubgroup.mem_zmultiples]) simp only [CuspFormToModularForm, ModFormMk, LinearMap.coe_mk, AddHom.coe_mk] at hg rw [← hg] exact this diff --git a/LeanPool/LeanModularForms/Modularforms/Iteratedderivs.lean b/LeanPool/LeanModularForms/Modularforms/Iteratedderivs.lean index ab20a5a5c0..ea4a300e15 100644 --- a/LeanPool/LeanModularForms/Modularforms/Iteratedderivs.lean +++ b/LeanPool/LeanModularForms/Modularforms/Iteratedderivs.lean @@ -12,6 +12,8 @@ public import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic public import Mathlib.Analysis.Calculus.IteratedDeriv.Defs import Mathlib.Analysis.Calculus.Deriv.Inv import Mathlib.Analysis.Calculus.Deriv.Pow +import Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas +import Mathlib.Analysis.Calculus.IteratedDeriv.WithinZpow import Mathlib.Analysis.SpecialFunctions.ExpDeriv /-! # Iteratedderivs -/ @@ -22,7 +24,7 @@ import Mathlib.Analysis.SpecialFunctions.ExpDeriv open UpperHalfPlane TopologicalSpace Set Metric Filter Function Complex -open scoped Interval Real NNReal ENNReal Topology BigOperators Nat +open scoped Interval Real NNReal ENNReal Topology BigOperators Nat Pointwise theorem upper_ne_int (x : ℍ) (d : ℤ) : (x : ℂ) + d ≠ 0 := by @@ -35,63 +37,15 @@ theorem aut_iter_deriv (d : ℤ) (k : ℕ) : EqOn (iteratedDerivWithin k (fun z : ℂ => 1 / (z + d)) {z : ℂ | 0 < z.im}) (fun t : ℂ => (-1) ^ k * k ! * (1 / (t + d) ^ (k + 1))) {z : ℂ | 0 < z.im} := by intro x hx - induction k generalizing x with - | zero => - simp_all only [mem_ofPred_eq, one_div, iteratedDerivWithin_zero, pow_zero, - Nat.factorial_zero, Nat.cast_one, - mul_one, zero_add, pow_one, one_mul] - | succ k IH => - rw [iteratedDerivWithin_succ] - simp only [one_div, Nat.cast_succ, Nat.factorial, Nat.cast_mul] - have := (IH hx) - have H : derivWithin (fun (z : ℂ) => (-1: ℂ) ^ k * ↑k ! * ((z + ↑d) ^ (k + 1))⁻¹) - {z : ℂ | 0 < z.im} x = - (-1) ^ (↑k + 1) * ((↑k + 1) * ↑k !) * ((x + ↑d) ^ (↑k + 1 + 1))⁻¹ := by - rw [DifferentiableAt.derivWithin] - · simp only [deriv_const_mul_field'] - rw [show (fun z : ℂ => ((z + d) ^ (k + 1))⁻¹) = (fun z : ℂ => (z + d) ^ (k + 1))⁻¹ from rfl, - show (fun z : ℂ => ((z + d) ^ (k + 1))) = (fun z : ℂ => (z + d)) ^ (k + 1) from rfl, - deriv_inv'', deriv_pow, deriv_add_const', deriv_id''] - · simp only [Nat.cast_add, Nat.cast_one, add_tsub_cancel_right, mul_one] - rw [pow_add] - simp only [pow_one, Pi.mul_apply, Pi.pow_apply] - have Hw : (-(((k : ℂ) + 1) * (x + ↑d) ^ k) / ((x + ↑d) ^ k * (x + ↑d)) ^ 2) = - -(↑k + 1) / (x + ↑d) ^ (k + 2) := by - rw [div_eq_div_iff] - · norm_cast - simp - ring - · norm_cast - apply pow_ne_zero - apply mul_ne_zero - · apply pow_ne_zero k (upper_ne_int ⟨x, hx⟩ d) - apply upper_ne_int ⟨x, hx⟩ d - norm_cast - apply pow_ne_zero (k + 2) (upper_ne_int ⟨x, hx⟩ d) - rw [Hw] - ring - · fun_prop - · fun_prop - norm_cast - apply pow_ne_zero (k + 1) (upper_ne_int ⟨x, hx⟩ d) - · apply DifferentiableAt.mul - · fun_prop - · apply DifferentiableAt.inv - · fun_prop - apply pow_ne_zero (k + 1) (upper_ne_int ⟨x, hx⟩ d) - · apply IsOpen.uniqueDiffWithinAt _ hx - refine isOpen_lt ?_ ?_ - · exact continuous_const - · exact continuous_im - rw [←H] - apply derivWithin_congr - · norm_cast at * - simp only [mem_ofPred_eq, one_div, Int.reduceNegSucc, Int.reduceNeg, Int.cast_mul, - Int.cast_pow, Int.cast_neg, Int.cast_one, Int.cast_natCast, Nat.cast_mul, Nat.cast_add, - Nat.cast_one, Int.cast_add] at * - intro r hr - apply IH hr - simp_all only [mem_ofPred_eq, one_div] + have hs : IsOpen {z : ℂ | 0 < z.im} := isOpen_lt continuous_const continuous_im + rw [iteratedDerivWithin_comp_add_const] + change iteratedDerivWithin k (fun y : ℂ => 1 / y) + ((d : ℂ) +ᵥ {z : ℂ | 0 < z.im}) (x + (d : ℂ)) = _ + have hmem : x + (d : ℂ) ∈ (d : ℂ) +ᵥ {z : ℂ | 0 < z.im} := by + simpa only [vadd_eq_add, add_comm] using vadd_mem_vadd_set (a := (d : ℂ)) hx + have h := iteratedDerivWithin_one_div k (hs.vadd (d : ℂ)) hmem + have exponent : (-1 - (k : ℤ)) = -((k + 1 : ℕ) : ℤ) := by omega + simpa only [exponent, zpow_neg, zpow_natCast, one_div] using h theorem aut_iter_deriv' (d : ℤ) (k : ℕ) : EqOn (iteratedDerivWithin k (fun z : ℂ => 1 / (z - d)) {z : ℂ | 0 < z.im}) diff --git a/LeanPool/LeanModularForms/Modularforms/JacobiTheta.lean b/LeanPool/LeanModularForms/Modularforms/JacobiTheta.lean index ccf7dfe19a..2e0e98f2a6 100644 --- a/LeanPool/LeanModularForms/Modularforms/JacobiTheta.lean +++ b/LeanPool/LeanModularForms/Modularforms/JacobiTheta.lean @@ -67,7 +67,8 @@ theorem Θ₂_as_jacobiTheta₂ (τ : ℍ) : Θ₂ τ = cexp (π * I * τ / 4) * simp_rw [Θ₂, Θ₂_term_as_jacobiTheta₂_term, tsum_mul_left, jacobiTheta₂] theorem Θ₃_term_as_jacobiTheta₂_term (τ : ℍ) (n : ℤ) : - Θ₃Term n τ = jacobiTheta₂_term n 0 τ := by simp [Θ₃Term, jacobiTheta₂_term] + Θ₃Term n τ = jacobiTheta₂_term n 0 τ := by simp only [Θ₃Term, jacobiTheta₂_term, mul_zero, + zero_add] theorem Θ₃_as_jacobiTheta₂ (τ : ℍ) : Θ₃ τ = jacobiTheta₂ (0 : ℂ) τ := by simp_rw [Θ₃, Θ₃_term_as_jacobiTheta₂_term, jacobiTheta₂] @@ -92,7 +93,8 @@ lemma H₂_T_action : (H₂ ∣[(2 : ℤ)] T) = -H₂ := by ext x suffices hΘ₂ : Θ₂ ((1 : ℝ) +ᵥ x) = cexp (π * I / 4) * Θ₂ x by simp_rw [modular_slash_T_apply, Pi.neg_apply, H₂, hΘ₂, mul_pow, ← Complex.exp_nat_mul, - mul_comm ((4 : ℕ) : ℂ), Nat.cast_ofNat, div_mul_cancel₀ (b := (4 : ℂ)) _ (by simp), + mul_comm ((4 : ℕ) : ℂ), Nat.cast_ofNat, div_mul_cancel₀ (b := (4 : ℂ)) _ (by simp only [ne_eq, + OfNat.ofNat_ne_zero, not_false_eq_true]), Complex.exp_pi_mul_I, neg_one_mul] calc _ = ∑' (n : ℤ), cexp (π * I * (n + 1 / 2) ^ 2 * ((1 : ℝ) +ᵥ x)) := by simp_rw [Θ₂, Θ₂Term] @@ -125,9 +127,9 @@ lemma H₃_T_action : (H₃ ∣[(2 : ℤ)] T) = H₄ := by congr 1 rcases Int.even_or_odd b with (hb | hb) · rw [hb.neg_one_zpow, Even.neg_one_zpow] - simp [sq, hb] + simp only [sq, hb, Even.mul_left] · rw [hb.neg_one_zpow, Odd.neg_one_zpow] - simp [sq, hb] + simp only [sq, hb, Odd.mul] lemma H₄_T_action : (H₄ ∣[(2 : ℤ)] T) = H₃ := by -- H₄|T = H₃|T^2 = Θ₂(0, z + 2) = Θ₂(0, z) = H₃ @@ -146,7 +148,8 @@ lemma H₄_T_inv_action : (H₄ ∣[(2 : ℤ)] T⁻¹) = H₃ := by nth_rw 1 [← H₃_T_action, ← slash_mul, mul_inv_cancel, slash_one] /-- Use α = T * T -/ -lemma H₂_α_action : (H₂ ∣[(2 : ℤ)] α.1) = H₂ := by simp [α_eq_T_sq, sq, slash_mul, H₂_T_action] +lemma H₂_α_action : (H₂ ∣[(2 : ℤ)] α.1) = H₂ := by simp only [α_eq_T_sq, sq, slash_mul, H₂_T_action, + neg_slash, neg_neg] lemma H₃_α_action : (H₃ ∣[(2 : ℤ)] α.1) = H₃ := by simp [α_eq_T_sq, sq, slash_mul, H₃_T_action, H₄_T_action] @@ -157,7 +160,8 @@ lemma H₄_α_action : (H₄ ∣[(2 : ℤ)] α.1) = H₄ := by /-- Use jacobiTheta₂_functional_equation -/ lemma H₂_S_action : (H₂ ∣[(2 : ℤ)] S) = -H₄ := by ext ⟨x, hx⟩ - have hx' : x ≠ 0 := by simp [Complex.ext_iff, hx.ne.symm] + have hx' : x ≠ 0 := by simp only [ne_eq, Complex.ext_iff, zero_re, zero_im, hx.ne.symm, and_false, + not_false_eq_true] calc _ = cexp (-π * I / x) * jacobiTheta₂ (-1 / (2 * x)) (-1 / x) ^ 4 * x ^ (-2 : ℤ) := by rw [modular_slash_S_apply, H₂, Θ₂_as_jacobiTheta₂] @@ -177,12 +181,13 @@ lemma H₂_S_action : (H₂ ∣[(2 : ℤ)] S) = -H₄ := by · congr 1 rw [neg_mul, neg_div, one_div, neg_div, div_neg, neg_mul, neg_div, neg_neg] ring_nf - simp [sq, ← mul_assoc, inv_mul_cancel_right₀ hx'] - · ring_nf; simp [hx'] - · ring_nf; simp [inv_inv] + simp only [sq, ← mul_assoc, inv_inv, inv_mul_cancel_right₀ hx', one_div] + · ring_nf; simp only [inv_inv, ne_eq, hx', not_false_eq_true, inv_mul_cancel₀, one_div, one_mul] + · ring_nf; simp only [inv_inv] _ = cexp (-π * I / x) * x ^ (-2 : ℤ) * ((1 / (I / x) ^ ((1 : ℂ) / 2)) ^ 4 * cexp (π * I / (4 * x)) ^ 4 - * jacobiTheta₂ (1 / 2) x ^ 4) := by simp [mul_pow] + * jacobiTheta₂ (1 / 2) x ^ 4) := by simp only [neg_mul, Int.reduceNeg, _root_.zpow_neg, + zpow_ofNat, one_div, mul_pow, inv_pow] _ = cexp (-π * I / x) * x ^ (-2 : ℤ) * ((1 / (I / x) ^ (2 : ℂ)) * cexp (π * I / (4 * x)) ^ 4 * jacobiTheta₂ (1 / 2) x ^ 4) := by congr 3 @@ -202,11 +207,12 @@ lemma H₂_S_action : (H₂ ∣[(2 : ℤ)] S) = -H₄ := by _ = -jacobiTheta₂ (1 / 2) x ^ 4 := by rw [neg_mul, ← Complex.exp_add, neg_mul (π : ℂ), neg_div, neg_add_cancel, Complex.exp_zero, neg_one_mul] - _ = -H₄ ⟨x, hx⟩ := by simp [H₄, Θ₄_as_jacobiTheta₂] + _ = -H₄ ⟨x, hx⟩ := by simp only [one_div, H₄, Θ₄_as_jacobiTheta₂] lemma H₃_S_action : (H₃ ∣[(2 : ℤ)] S) = -H₃ := by ext x - have hx' : (x : ℂ) ≠ 0 := by obtain ⟨x, hx⟩ := x; change x ≠ 0; simp [Complex.ext_iff, hx.ne.symm] + have hx' : (x : ℂ) ≠ 0 := by obtain ⟨x, hx⟩ := x; change x ≠ 0; simp only [ne_eq, Complex.ext_iff, + zero_re, zero_im, hx.ne.symm, and_false, not_false_eq_true] have := jacobiTheta₂_functional_equation 0 simp only [neg_mul, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, mul_zero, zero_div, Complex.exp_zero, mul_one] at this @@ -219,7 +225,8 @@ lemma H₃_S_action : (H₃ ∣[(2 : ℤ)] S) = -H₃ := by ring_nf! rw [← mul_inv, cpow_ofNat, sq, ← mul_assoc, zpow_two] ring_nf! - simp_all + simp_all only [ne_eq, one_div, inv_pow, inv_I, even_two, Even.neg_pow, I_sq, mul_neg, mul_one, + inv_inv, neg_mul, OfNat.ofNat_ne_zero, not_false_eq_true, pow_eq_zero_iff, inv_mul_cancel₀] lemma H₄_S_action : (H₄ ∣[(2 : ℤ)] S) = - H₂ := by rw [← neg_eq_iff_eq_neg.mpr H₂_S_action, neg_slash, ← slash_mul, modular_S_sq, @@ -249,24 +256,26 @@ lemma H₄_S_inv_action : (H₄ ∣[(2 : ℤ)] S⁻¹) = -H₂ := by /-- Use β = -S * α^(-1) * S -/ lemma H₂_β_action : (H₂ ∣[(2 : ℤ)] β.1) = H₂ := calc _ = (((H₂ ∣[(2 : ℤ)] negI.1) ∣[(2 : ℤ)] S) ∣[(2 : ℤ)] α.1⁻¹) ∣[(2 : ℤ)] S := by - simp [β_eq_negI_mul_S_mul_α_inv_mul_S, slash_mul] + simp only [β_eq_negI_mul_S_mul_α_inv_mul_S, InvMemClass.coe_inv, slash_mul] _ = _ := by rw [H₂_negI_action, H₂_S_action, neg_slash, neg_slash, α_eq_T_sq] - simp [sq, slash_mul, H₄_T_inv_action, H₃_T_inv_action, H₄_S_action] + simp only [sq, _root_.mul_inv_rev, slash_mul, H₄_T_inv_action, H₃_T_inv_action, H₄_S_action, + neg_neg] lemma H₃_β_action : (H₃ ∣[(2 : ℤ)] β.1) = H₃ := calc _ = (((H₃ ∣[(2 : ℤ)] negI.1) ∣[(2 : ℤ)] S) ∣[(2 : ℤ)] α.1⁻¹) ∣[(2 : ℤ)] S := by - simp [β_eq_negI_mul_S_mul_α_inv_mul_S, slash_mul] + simp only [β_eq_negI_mul_S_mul_α_inv_mul_S, InvMemClass.coe_inv, slash_mul] _ = _ := by rw [H₃_negI_action, H₃_S_action, neg_slash, neg_slash, α_eq_T_sq] - simp [sq, slash_mul, H₄_T_inv_action, H₃_T_inv_action, H₃_S_action] + simp only [sq, _root_.mul_inv_rev, slash_mul, H₃_T_inv_action, H₄_T_inv_action, H₃_S_action, + neg_neg] lemma H₄_β_action : (H₄ ∣[(2 : ℤ)] β.1) = H₄ := calc _ = (((H₄ ∣[(2 : ℤ)] negI.1) ∣[(2 : ℤ)] S) ∣[(2 : ℤ)] α.1⁻¹) ∣[(2 : ℤ)] S := by - simp [β_eq_negI_mul_S_mul_α_inv_mul_S, slash_mul] + simp only [β_eq_negI_mul_S_mul_α_inv_mul_S, InvMemClass.coe_inv, slash_mul] _ = _ := by rw [H₄_negI_action, H₄_S_action, neg_slash, neg_slash, α_eq_T_sq] - simp [sq, slash_mul, H₂_T_inv_action, H₂_S_action] + simp only [sq, _root_.mul_inv_rev, slash_mul, H₂_T_inv_action, neg_slash, neg_neg, H₂_S_action] /-- H₂, H₃, H₄ are modular forms of weight 2 and level Γ(2) -/ noncomputable def H₂SIF : SlashInvariantForm (Γ 2) 2 where @@ -300,7 +309,7 @@ lemma H₂_SIF_MDifferentiable : MDiff H₂SIF := by suffices h_diff : DifferentiableAt ℂ (↑ₕH₂) (τ : ℂ) by have : (H₂ ∘ ↑ofComplex) ∘ UpperHalfPlane.coe = H₂SIF := by ext x - simp [H₂SIF, ofComplex_apply] + simp only [Function.comp_apply, ofComplex_apply, H₂SIF, SlashInvariantForm.coe_mk] rw [← this] exact h_diff.mdifferentiableAt.comp τ τ.mdifferentiable_coe have hU : {z : ℂ | 0 < z.im} ∈ 𝓝 (τ : ℂ) := isOpen_upperHalfPlaneSet.mem_nhds τ.2 @@ -322,9 +331,9 @@ lemma H₂_SIF_MDifferentiable : MDiff H₂SIF := by intro z hz have h_arg : cexp (((π : ℂ) * I / 4) * z) = cexp (π * I * z / 4) := by have : ((π : ℂ) * I / 4) * z = (π * I * z) / 4 := by - simp [div_eq_mul_inv, mul_comm, mul_assoc] - simp [this] - simp [F, H₂, Θ₂_as_jacobiTheta₂, ofComplex_apply_of_im_pos hz, h_arg] + simp only [mul_comm, div_eq_mul_inv, mul_assoc] + simp only [this] + simp only [h_arg, Function.comp_apply, H₂, ofComplex_apply_of_im_pos hz, Θ₂_as_jacobiTheta₂, F] exact (DifferentiableAt.congr_of_eventuallyEq hF h_ev.symm) lemma H₃_SIF_MDifferentiable : MDiff H₃SIF := by @@ -344,7 +353,8 @@ lemma H₄_SIF_MDifferentiable : MDiff H₄SIF := by (differentiableAt_jacobiTheta₂_snd (1 / 2 : ℂ) (by simpa using hx)).differentiableWithinAt apply (hθ.pow 4).congr intro _ hz - simp [Function.comp, H₄, Θ₄_as_jacobiTheta₂, ofComplex_apply_of_im_pos hz] + simp only [Function.comp, H₄, ofComplex_apply_of_im_pos hz, Θ₄_as_jacobiTheta₂, one_div, + Pi.pow_apply] @[fun_prop] lemma H₂_MDifferentiable : MDiff H₂ := by @@ -400,10 +410,12 @@ lemma jacobiTheta₂_rel_aux (n : ℤ) (t : ℝ) : rw [jacobiTheta₂_term_half_apply, ofReal_exp, ofReal_exp, ← Complex.exp_add, ofReal_mul] congr ring_nf - simp + simp only [ofReal_sub, ofReal_mul, ofReal_div, ofReal_neg, ofReal_one, ofReal_ofNat, + ofReal_intCast, ofReal_pow, I_sq, mul_neg, mul_one, neg_mul] ring_nf! -lemma LeanModularForms.norm_exp_mul_I (z : ℂ) : ‖cexp (z * I)‖ = rexp (-z.im) := by simp [norm_exp] +lemma LeanModularForms.norm_exp_mul_I (z : ℂ) : ‖cexp (z * I)‖ = rexp (-z.im) := by simp only [ + norm_exp, mul_re, Complex.I_re, mul_zero, Complex.I_im, mul_one, zero_sub] theorem isBoundedAtImInfty_H₂ : IsBoundedAtImInfty H₂ := by simp_rw [UpperHalfPlane.isBoundedAtImInfty_iff, H₂, Θ₂] @@ -475,7 +487,8 @@ lemma isBoundedAtImInfty_H₃_aux (z : ℍ) (hz : 1 ≤ z.im) : _ = ∑' (n : ℤ), ‖cexp (π * (n : ℂ) ^ 2 * z * I)‖ := by simp_rw [Θ₃Term, mul_right_comm _ I] _ = ∑' (n : ℤ), rexp (-π * (n : ℂ) ^ 2 * z).im := by simp_rw [Complex.norm_exp_mul_I]; simp _ = ∑' (n : ℤ), rexp (-π * (n : ℝ) ^ 2 * z.im) := by - simp_all + simp_all only [mul_im, mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero, coe_im, add_zero, + coe_re, neg_add_rev, neg_mul, neg_im] _ ≤ _ := Summable.tsum_le_tsum (fun b ↦ ?_) ?_ ?_ · apply exp_monotone simpa only [neg_mul, neg_le_neg_iff] using le_mul_of_one_le_right (by positivity) hz @@ -502,7 +515,8 @@ theorem isBoundedAtImInfty_H₄ : IsBoundedAtImInfty H₄ := by gcongr calc _ ≤ ∑' (n : ℤ), ‖Θ₄Term n z‖ := norm_tsum_le_tsum_norm ?_ - _ = ∑' (n : ℤ), ‖Θ₃Term n z‖ := by congr with n; simp [Θ₄Term, Θ₃Term] + _ = ∑' (n : ℤ), ‖Θ₃Term n z‖ := by congr with n; simp only [Θ₄Term, Complex.norm_mul, norm_zpow, + norm_neg, norm_one, _root_.one_zpow, one_mul, Θ₃Term] _ ≤ _ := isBoundedAtImInfty_H₃_aux z hz simp_rw [Θ₄_term_as_jacobiTheta₂_term] apply Summable.norm @@ -514,7 +528,8 @@ theorem isBoundedAtImInfty_H_slash : IsBoundedAtImInfty (H₂ ∣[(2 : ℤ)] γ) apply Subgroup.closure_induction_left (s := {S, T, ↑negI}) (p := fun γ _ ↦ IsBoundedAtImInfty (H₂ ∣[(2 : ℤ)] γ) ∧ IsBoundedAtImInfty (H₃ ∣[(2 : ℤ)] γ) ∧ IsBoundedAtImInfty (H₄ ∣[(2 : ℤ)] γ)) - · simp [isBoundedAtImInfty_H₂, isBoundedAtImInfty_H₃, isBoundedAtImInfty_H₄] + · simp only [slash_one, isBoundedAtImInfty_H₂, isBoundedAtImInfty_H₃, isBoundedAtImInfty_H₄, + and_self] · intro x hx y _ h simp_rw [slash_mul] rcases hx with (rfl | rfl | rfl | _) @@ -816,7 +831,8 @@ theorem Θ₂_tendsto_atImInfty : Tendsto Θ₂ atImInfty (𝓝 0) := by -- simp_rw directly below fails have (z : ℍ) : ‖cexp (π * I * z / 4)‖ = rexp (-π * z.im / 4) := by rw [mul_right_comm, mul_div_right_comm, norm_exp_mul_I] - simp [neg_div] + simp only [div_ofNat_im, mul_im, ofReal_re, coe_im, ofReal_im, coe_re, zero_mul, add_zero, + neg_mul, neg_div] simp_rw [this] exact (Real.tendsto_exp_atBot).comp <| -- TODO: tendsto_div_const_atBot_of_pos and its friends should be aliased under Tendsto. @@ -885,13 +901,13 @@ private lemma theta_prod_S_action : (theta_prod ∣[(6 : ℤ)] S) = -theta_prod simp only [theta_prod, show (6 : ℤ) = (2 + 2) + 2 from by norm_num, mul_slash_SL2 (2 + 2) 2 S _ _, mul_slash_SL2 2 2 S _ _, H₂_S_action, H₃_S_action, H₄_S_action] - ext z; simp [Pi.mul_apply, Pi.neg_apply]; ring + ext z; simp only [mul_neg, neg_mul, neg_neg, Pi.mul_apply, Pi.neg_apply, neg_inj]; ac_rfl private lemma theta_prod_T_action : (theta_prod ∣[(6 : ℤ)] T) = -theta_prod := by simp only [theta_prod, show (6 : ℤ) = (2 + 2) + 2 from by norm_num, mul_slash_SL2 (2 + 2) 2 T _ _, mul_slash_SL2 2 2 T _ _, H₂_T_action, H₃_T_action, H₄_T_action] - ext z; simp [Pi.mul_apply, Pi.neg_apply]; ring + ext z; simp only [neg_mul, Pi.mul_apply, Pi.neg_apply, neg_inj]; ac_rfl private noncomputable def theta_prod_sq : ℍ → ℂ := fun z => (H₂ z * H₃ z * H₄ z) ^ 2 @@ -1030,13 +1046,14 @@ lemma Θ₂_term_imag_axis_real (n : ℤ) (t : ℝ) (ht : 0 < t) : /-- `im` distributes over tsum when each term has zero imaginary part. -/ lemma Complex.im_tsum_eq_zero_of_im_eq_zero (f : ℤ → ℂ) (hf : Summable f) (him : ∀ n, (f n).im = 0) : - (∑' n : ℤ, f n).im = 0 := by simp [Complex.im_tsum hf, him] + (∑' n : ℤ, f n).im = 0 := by simp only [Complex.im_tsum hf, him, tsum_zero] /-- Θ₂(I*t) has zero imaginary part for t > 0. -/ lemma Θ₂_imag_axis_real (t : ℝ) (ht : 0 < t) : (Θ₂ ⟨I * t, by simp [ht]⟩).im = 0 := by unfold Θ₂ - let z : ℍ := ⟨I * t, by simp [ht]⟩ + let z : ℍ := ⟨I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, Complex.I_im, + ofReal_re, one_mul, zero_add, ht]⟩ have hsum : Summable fun n : ℤ => Θ₂Term n z := by simp_rw [Θ₂_term_as_jacobiTheta₂_term] apply Summable.mul_left @@ -1065,7 +1082,8 @@ lemma Θ₄_term_imag_axis_real (n : ℤ) (t : ℝ) (ht : 0 < t) : lemma Θ₄_imag_axis_real (t : ℝ) (ht : 0 < t) : (Θ₄ ⟨I * t, by simp [ht]⟩).im = 0 := by unfold Θ₄ - let z : ℍ := ⟨I * t, by simp [ht]⟩ + let z : ℍ := ⟨I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, Complex.I_im, + ofReal_re, one_mul, zero_add, ht]⟩ have hsum : Summable fun n : ℤ => Θ₄Term n z := by simp_rw [Θ₄_term_as_jacobiTheta₂_term] rw [summable_jacobiTheta₂_term_iff] @@ -1108,7 +1126,8 @@ lemma Θ₂_term_imag_axis_re_pos (n : ℤ) (t : ℝ) (ht : 0 < t) : /-- Θ₂(I*t) has positive real part for t > 0. -/ lemma Θ₂_imag_axis_re_pos (t : ℝ) (ht : 0 < t) : 0 < (Θ₂ ⟨I * t, by simp [ht]⟩).re := by - let z : ℍ := ⟨I * t, by simp [ht]⟩ + let z : ℍ := ⟨I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, Complex.I_im, + ofReal_re, one_mul, zero_add, ht]⟩ have hsum : Summable fun n : ℤ => Θ₂Term n z := by simp_rw [Θ₂_term_as_jacobiTheta₂_term] apply Summable.mul_left @@ -1134,10 +1153,13 @@ theorem H₂_imag_axis_pos : ResToImagAxis.Pos H₂ := by simp only [Function.resToImagAxis, ResToImagAxis, ht, ↓reduceDIte, H₂] have hΘ₂_im := Θ₂_imag_axis_real t ht have hΘ₂_re_pos := Θ₂_imag_axis_re_pos t ht - have hpow : (Θ₂ ⟨I * t, by simp [ht]⟩ ^ 4).re = - (Θ₂ ⟨I * t, by simp [ht]⟩).re ^ 4 := by - set z := Θ₂ ⟨I * t, by simp [ht]⟩ with hz_def - have hz_eq : z = (z.re : ℂ) := Complex.ext (by simp) (by simp [hΘ₂_im]) + have hpow : (Θ₂ ⟨I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, Complex.I_im, + ofReal_re, one_mul, zero_add, ht]⟩ ^ 4).re = + (Θ₂ ⟨I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, Complex.I_im, + ofReal_re, one_mul, zero_add, ht]⟩).re ^ 4 := by + set z := Θ₂ ⟨I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, Complex.I_im, + ofReal_re, one_mul, zero_add, ht]⟩ with hz_def + have hz_eq : z = (z.re : ℂ) := Complex.ext (by simp) (by simp only [hΘ₂_im, ofReal_im]) rw [hz_eq] norm_cast simp_all only [pow_succ_pos] diff --git a/LeanPool/LeanModularForms/Modularforms/MultipliableLems.lean b/LeanPool/LeanModularForms/Modularforms/MultipliableLems.lean index 27c86e2c61..8a154b1b80 100644 --- a/LeanPool/LeanModularForms/Modularforms/MultipliableLems.lean +++ b/LeanPool/LeanModularForms/Modularforms/MultipliableLems.lean @@ -36,7 +36,7 @@ theorem term_ne_zero (z : ℍ) (n : ℕ) : 1 -cexp (2 * ↑π * Complex.I * (↑ rw [sub_ne_zero] intro h have := exp_upperHalfPlane_lt_one_nat z n - simp [← h] at this + simp only [← h, norm_one, lt_self_iff_false] at this theorem ball_pow_ne_1 (x : ℂ) (hx : x ∈ ball 0 1) (n : ℕ) : 1 + (fun n ↦ -x ^ (n + 1)) n ≠ 0 := by simp only [mem_ball, dist_zero_right] at * @@ -44,7 +44,7 @@ theorem ball_pow_ne_1 (x : ℂ) (hx : x ∈ ball 0 1) (n : ℕ) : 1 + (fun n ↦ intro h have hxn : ‖(x ^ (n + 1))‖ < 1 := by simp only [norm_pow]; exact pow_lt_one₀ (norm_nonneg x) hx (by omega) - simp [← h] at hxn + simp only [← h, norm_one, lt_self_iff_false] at hxn theorem multipliable_lt_one (x : ℂ) (hx : x ∈ ball 0 1) : Multipliable fun i ↦ 1 - x ^ (i+ 1) := by @@ -78,7 +78,7 @@ lemma MultipliableEtaProductExpansion_pnat (z : ℍ) : conv at this => enter [1] ext n - rw [show (n : ℂ) + 1 = (((n + 1) : ℕ) : ℂ) by simp] + rw [show (n : ℂ) + 1 = (((n + 1) : ℕ) : ℂ) by simp only [Nat.cast_add, Nat.cast_one] ] rw [ ← multipliable_pnat_iff_multipliable_succ (f := g)] at this apply this.congr intro b @@ -96,7 +96,7 @@ lemma tprod_ne_zero (x : ℍ) (f : ℕ → ℍ → ℂ) (hf : ∀ i x, 1 + f i x lemma Multipliable_pow {ι : Type*} (f : ι → ℂ) (hf : Multipliable f) (n : ℕ) : Multipliable (fun i => f i ^ n) := by induction n with - | zero => simp + | zero => simp only [pow_zero, multipliable_one] | succ n hn => simpa only [pow_succ] using hn.mul hf @@ -109,7 +109,7 @@ lemma MultipliableDeltaProductExpansion_pnat (z : ℍ) : lemma tprod_pow (f : ℕ → ℂ) (hf : Multipliable f) (n : ℕ) : (∏' (i : ℕ), f i) ^ n = ∏' (i : ℕ), (f i) ^ n := by induction n with - | zero => simp + | zero => simp only [pow_zero, tprod_one] | succ n hn => simp only [pow_succ, hn, ← Multipliable.tprod_mul (Multipliable_pow f hf n) hf] diff --git a/LeanPool/LeanModularForms/Modularforms/QExpansion.lean b/LeanPool/LeanModularForms/Modularforms/QExpansion.lean index 2db28b1031..22d449bb55 100644 --- a/LeanPool/LeanModularForms/Modularforms/QExpansion.lean +++ b/LeanPool/LeanModularForms/Modularforms/QExpansion.lean @@ -38,7 +38,7 @@ lemma tendsto_nat (a : ℕ → ℂ) (ha : Summable fun n : ℕ ↦ ‖a n‖ * r Tendsto (fun z : ℍ ↦ ∑' n, a n * cexp (2 * π * I * z * n)) atImInfty (𝓝 (a 0)) := by convert tendsto_tsum_of_dominated_convergence (f := fun z n ↦ a n * cexp (2 * π * I * z * n)) (𝓕 := atImInfty) (g := Set.indicator {0} (fun _ ↦ a 0)) ha ?_ ?_ - · simp + · simp only [Set.indicator_singleton, tsum_pi_single] · intro k rcases eq_or_ne k 0 with (rfl | hk) · simp @@ -85,11 +85,12 @@ lemma tendsto_int (a : ℤ → ℂ) (ha : Summable fun n : ℤ ↦ ‖a n‖ * r rw [norm_mul, mul_right_comm _ I, mul_right_comm _ I, norm_exp_mul_I] simp ring_nf - simp + simp only [true_or] · apply ha.of_nonneg_of_le (fun _ ↦ by positivity) fun b ↦ ?_ by_cases hb : 0 ≤ b · gcongr - simp [hz] - · simp_all + simp only [mul_neg, neg_le_neg_iff, Nat.ofNat_pos, le_mul_iff_one_le_left, hz] + · simp_all only [neg_mul, neg_add_rev, Int.reduceNeg, Int.cast_add, Int.cast_neg, Int.cast_one, + Int.cast_natCast, not_le, norm_zero, mul_neg, zero_mul, Std.le_refl] end QExp diff --git a/LeanPool/LeanModularForms/Modularforms/QExpansionLems.lean b/LeanPool/LeanModularForms/Modularforms/QExpansionLems.lean index 5affd4dd57..1389e13a53 100644 --- a/LeanPool/LeanModularForms/Modularforms/QExpansionLems.lean +++ b/LeanPool/LeanModularForms/Modularforms/QExpansionLems.lean @@ -121,7 +121,7 @@ lemma qExpansion_mul_coeff (a b : ℤ) (f : ModularForm Γ(n) a) (g : ModularFor simpa using (ModularForm.qExpansion_mul (Γ := Γ(n)) (h := n) (hh := by exact Nat.cast_pos.mpr (Nat.pos_of_neZero n)) - (hΓ := by simp) f g) + (hΓ := by simp only [CongruenceSubgroup.strictPeriods_Gamma, AddSubgroup.mem_zmultiples]) f g) variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] @@ -137,7 +137,8 @@ lemma IteratedDeriv_smul (a : ℂ) (f : ℂ → ℂ) (m : ℕ) : lemma qExpansion_smul2 (a : ℂ) (f : ModularForm Γ(n) k) [NeZero n] : (a • qExpansion n f) = (qExpansion n (a • f)) := (ModularForm.qExpansion_smul (Γ := Γ(n)) (h := n) - (hh := Nat.cast_pos.mpr (Nat.pos_of_neZero n)) (hΓ := by simp) a f).symm + (hh := Nat.cast_pos.mpr (Nat.pos_of_neZero n)) (hΓ := by simp only [ + CongruenceSubgroup.strictPeriods_Gamma, AddSubgroup.mem_zmultiples]) a f).symm instance instFunLikeUpperHalfPlaneFun : FunLike (ℍ → ℂ) ℍ ℂ := { coe := fun ⦃a₁⦄ ↦ a₁, coe_injective := fun ⦃_ _⦄ a ↦ a} @@ -152,7 +153,7 @@ lemma cuspFunction_congr_funLike lemma qExpansion_ext2 {α β : Type*} [FunLike α ℍ ℂ] [FunLike β ℍ ℂ] (f : α) (g : β) (h : ⇑f = ⇑g) : qExpansion 1 f = qExpansion 1 g := by - ext m; simp [qExpansion_coeff, congrArg (cuspFunction 1) h] + ext m; simp only [qExpansion_coeff, congrArg (cuspFunction 1) h] --generalize this away from ℂ lemma IteratedDeriv_zero_fun (n : ℕ) (z : ℂ) : iteratedDeriv n (fun _ : ℂ => (0 : ℂ)) z = 0 := by @@ -167,9 +168,11 @@ lemma qExpansion_pow (f : ModularForm Γ(1) k) (n : ℕ) : qExpansion 1 ((((DirectSum.of (ModularForm Γ(1)) k ) f) ^ n) (n * k)) = (qExpansion 1 f) ^ n := by exact_mod_cast (qExpansion_of_pow (Γ := Γ(1)) (h := (1 : ℕ)) - (hh := by positivity) (hΓ := by simp) (f := f) (n := n)) + (hh := by positivity) (hΓ := by simp only [CongruenceSubgroup.strictPeriods_Gamma, + Nat.cast_one, AddSubgroup.mem_zmultiples]) (f := f) (n := n)) lemma qExpansion_injective [hn : NeZero n] (f : ModularForm Γ(n) k) : qExpansion n f = 0 ↔ f = 0 := ModularForm.qExpansion_eq_zero_iff (Γ := Γ(n)) (h := n) - (Nat.cast_pos.mpr (Nat.pos_of_neZero n)) (by simp) f + (Nat.cast_pos.mpr (Nat.pos_of_neZero n)) (by simp only [CongruenceSubgroup.strictPeriods_Gamma, + AddSubgroup.mem_zmultiples]) f diff --git a/LeanPool/LeanModularForms/Modularforms/ResToImagAxis.lean b/LeanPool/LeanModularForms/Modularforms/ResToImagAxis.lean index 00af428046..7c6f061a2f 100644 --- a/LeanPool/LeanModularForms/Modularforms/ResToImagAxis.lean +++ b/LeanPool/LeanModularForms/Modularforms/ResToImagAxis.lean @@ -89,10 +89,12 @@ Restriction and slash action under S: $(F |_k S) (it) = (it)^{-k} * F(it)$ -/ theorem ResToImagAxis.SlashActionS (F : ℍ → ℂ) (k : ℤ) {t : ℝ} (ht : 0 < t) : (F ∣[k] S).resToImagAxis t = (Complex.I) ^ (-k) * t ^ (-k) * F.resToImagAxis (1 / t) := by - set z : ℍ := ⟨I * t, by simp [ht]⟩ with hzdef + set z : ℍ := ⟨I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, Complex.I_im, + ofReal_re, one_mul, zero_add, ht]⟩ with hzdef set z' : ℍ := ⟨I * (1 / t : ℝ), by simpa [one_div_pos.2 ht]⟩ with hz'def have h : mk (-z)⁻¹ z.im_inv_neg_coe_pos = z' := - UpperHalfPlane.ext (by simp [hzdef, hz'def, mul_comm]) + UpperHalfPlane.ext (by simp only [hzdef, inv_neg, _root_.mul_inv_rev, inv_I, mul_neg, mul_comm, + neg_neg, hz'def, one_div, ofReal_inv]) simpa [ResToImagAxis, ht, hz'def] using (by rw [modular_slash_S_apply, h]; simp [hzdef, mul_zpow I (t : ℂ) (-k), mul_comm (F z')] : (F ∣[k] S) z = I ^ (-k) * t ^ (-k) * F z') @@ -117,7 +119,8 @@ theorem ResToImagAxis.Real.neg {F : ℍ → ℂ} (hF : ResToImagAxis.Real F) : R intro t ht have hFreal := hF t ht simp only [Function.resToImagAxis, ResToImagAxis, ht, ↓reduceDIte] at hFreal - simp [ResToImagAxis, ht, hFreal] + simp only [Function.resToImagAxis_apply, ResToImagAxis, ht, ↓reduceDIte, Pi.neg_apply, neg_im, + hFreal, neg_zero] @[fun_prop] theorem ResToImagAxis.Real.add {F G : ℍ → ℂ} (hF : ResToImagAxis.Real F) @@ -125,7 +128,8 @@ theorem ResToImagAxis.Real.add {F G : ℍ → ℂ} (hF : ResToImagAxis.Real F) intro t ht have hFreal := hF t ht; have hGreal := hG t ht simp only [Function.resToImagAxis, ResToImagAxis, ht, ↓reduceDIte] at hFreal hGreal - simp [ResToImagAxis, ht, hFreal, hGreal] + simp only [Function.resToImagAxis_apply, ResToImagAxis, ht, ↓reduceDIte, Pi.add_apply, add_im, + hFreal, hGreal, add_zero] @[fun_prop] theorem ResToImagAxis.Real.sub {F G : ℍ → ℂ} (hF : ResToImagAxis.Real F) @@ -138,7 +142,8 @@ theorem ResToImagAxis.Real.mul {F G : ℍ → ℂ} (hF : ResToImagAxis.Real F) intro t ht have hFreal := hF t ht; have hGreal := hG t ht simp only [Function.resToImagAxis, ResToImagAxis, ht, ↓reduceDIte] at hFreal hGreal - simp [ResToImagAxis, ht, hFreal, hGreal] + simp only [Function.resToImagAxis_apply, ResToImagAxis, ht, ↓reduceDIte, Pi.mul_apply, mul_im, + hGreal, mul_zero, hFreal, zero_mul, add_zero] @[fun_prop] theorem ResToImagAxis.Real.smul {F : ℍ → ℂ} {c : ℝ} (hF : ResToImagAxis.Real F) : @@ -146,7 +151,8 @@ theorem ResToImagAxis.Real.smul {F : ℍ → ℂ} {c : ℝ} (hF : ResToImagAxis. intro t ht have hFreal := hF t ht simp only [Function.resToImagAxis, ResToImagAxis, ht, ↓reduceDIte] at hFreal - simp [ResToImagAxis, ht, hFreal] + simp only [Function.resToImagAxis_apply, ResToImagAxis, ht, ↓reduceDIte, Pi.smul_apply, real_smul, + mul_im, ofReal_re, hFreal, mul_zero, ofReal_im, zero_mul, add_zero] @[fun_prop] theorem ResToImagAxis.Real.pow {F : ℍ → ℂ} (hF : ResToImagAxis.Real F) (n : ℕ) : @@ -156,7 +162,8 @@ theorem ResToImagAxis.Real.pow {F : ℍ → ℂ} (hF : ResToImagAxis.Real F) (n | succ n hn => exact hn.mul hF theorem ResToImagAxis.Pos.const (c : ℝ) (hc : 0 < c) : ResToImagAxis.Pos (fun _ => c) := - ⟨ResToImagAxis.Real.const c, fun t ht ↦ by simp [ResToImagAxis, ht, hc]⟩ + ⟨ResToImagAxis.Real.const c, fun t ht ↦ by simp only [Function.resToImagAxis_apply, ResToImagAxis, + ht, ↓reduceDIte, ofReal_re, hc]⟩ @[fun_prop] theorem ResToImagAxis.Pos.one : ResToImagAxis.Pos (fun _ => 1) := @@ -168,7 +175,8 @@ theorem ResToImagAxis.Pos.add {F G : ℍ → ℂ} (hF : ResToImagAxis.Pos F) rw [Pos]; refine ⟨Real.add hF.1 hG.1, fun t ht ↦ ?_⟩ have hFpos := hF.2 t ht; have hGpos := hG.2 t ht simp only [Function.resToImagAxis, ResToImagAxis, ht, ↓reduceDIte] at hFpos hGpos - simp [ResToImagAxis, ht, add_pos hFpos hGpos] + simp only [Function.resToImagAxis_apply, ResToImagAxis, ht, ↓reduceDIte, Pi.add_apply, add_re, + add_pos hFpos hGpos] @[fun_prop] theorem ResToImagAxis.Pos.mul {F G : ℍ → ℂ} (hF : ResToImagAxis.Pos F) @@ -177,7 +185,8 @@ theorem ResToImagAxis.Pos.mul {F G : ℍ → ℂ} (hF : ResToImagAxis.Pos F) have hFreal := hF.1 t ht; have hGreal := hG.1 t ht have hFpos := hF.2 t ht; have hGpos := hG.2 t ht simp only [Function.resToImagAxis, ResToImagAxis, ht, ↓reduceDIte] at hFreal hGreal hFpos hGpos - simp [ResToImagAxis, ht, hFreal, hGreal, mul_pos hFpos hGpos] + simp only [Function.resToImagAxis_apply, ResToImagAxis, ht, ↓reduceDIte, Pi.mul_apply, mul_re, + hFreal, hGreal, mul_zero, sub_zero, mul_pos hFpos hGpos] @[fun_prop] theorem ResToImagAxis.Pos.smul {F : ℍ → ℂ} {c : ℝ} (hF : ResToImagAxis.Pos F) @@ -185,7 +194,8 @@ theorem ResToImagAxis.Pos.smul {F : ℍ → ℂ} {c : ℝ} (hF : ResToImagAxis.P rw [Pos]; refine ⟨Real.smul hF.1, fun t ht ↦ ?_⟩ have hFreal := hF.1 t ht; have hFpos := hF.2 t ht simp only [Function.resToImagAxis, ResToImagAxis, ht, ↓reduceDIte] at hFreal hFpos - simp [ResToImagAxis, ht, mul_pos hc hFpos] + simp only [Function.resToImagAxis_apply, ResToImagAxis, ht, ↓reduceDIte, Pi.smul_apply, real_smul, + mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero, mul_pos hc hFpos] @[fun_prop] theorem ResToImagAxis.Pos.pow {F : ℍ → ℂ} (hF : ResToImagAxis.Pos F) (n : ℕ) : @@ -215,7 +225,7 @@ theorem ResToImagAxis.EventuallyPos.add {F G : ℍ → ℂ} ResToImagAxis.EventuallyPos (F + G) := by rw [EventuallyPos]; refine ⟨ResToImagAxis.Real.add hF.1 hG.1, ?_⟩ obtain ⟨tF, hF0, hFpos⟩ := hF.2; obtain ⟨tG, hG0, hGpos⟩ := hG.2 - refine ⟨max tF tG, by positivity, fun t ht ↦ ?_⟩ + refine ⟨max tF tG, by exact lt_max_of_lt_left hF0, fun t ht ↦ ?_⟩ have hFpos_t := hFpos t ((le_max_left ..).trans ht) have hGpos_t := hGpos t ((le_max_right ..).trans ht) have htpos : 0 < t := by grind @@ -229,7 +239,7 @@ theorem ResToImagAxis.EventuallyPos.mul {F G : ℍ → ℂ} ResToImagAxis.EventuallyPos (F * G) := by rw [EventuallyPos]; refine ⟨ResToImagAxis.Real.mul hF.1 hG.1, ?_⟩ obtain ⟨tF, hF0, hFpos⟩ := hF.2; obtain ⟨tG, hG0, hGpos⟩ := hG.2 - refine ⟨max tF tG, by positivity, fun t ht ↦ ?_⟩ + refine ⟨max tF tG, by exact lt_max_of_lt_left hF0, fun t ht ↦ ?_⟩ have htpos : 0 < t := by grind have hFreal_t := hF.1 t htpos; have hGreal_t := hG.1 t htpos have hFpos_t := hFpos t ((le_max_left ..).trans ht) @@ -256,7 +266,8 @@ theorem ResToImagAxis.EventuallyPos.smul {F : ℍ → ℂ} {c : ℝ} (hF : ResTo have htpos : 0 < t := by grind have hFreal_t := hF.1 t htpos; have hFpos_t := hFpos t ht simp only [Function.resToImagAxis, ResToImagAxis, htpos, ↓reduceDIte] at hFreal_t hFpos_t - simp [ResToImagAxis, htpos, mul_pos hc hFpos_t] + simp only [Function.resToImagAxis_apply, ResToImagAxis, htpos, ↓reduceDIte, Pi.smul_apply, + real_smul, mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero, mul_pos hc hFpos_t] /-- If `F` is real-valued, then `F` is equal to the real part of itself on imaginary axis. -/ theorem ResToImagAxis.Real.eq_real_part {F : ℍ → ℂ} (hF : ResToImagAxis.Real F) (t : ℝ) : @@ -288,8 +299,10 @@ lemma isBigO_resToImagAxis_of_isBigO_atImInfty {F : ℍ → ℂ} {c : ℝ} (_hc filter_upwards [Filter.eventually_ge_atTop (max A 1)] with t ht have ht_pos : 0 < t := lt_of_lt_of_le one_pos (le_of_max_le_right ht) simp only [Function.resToImagAxis, ResToImagAxis, ht_pos, ↓reduceDIte] - set z : ℍ := ⟨Complex.I * t, by simp [ht_pos]⟩ - have him : z.im = t := by change (Complex.I * t).im = t; simp + set z : ℍ := ⟨Complex.I * t, by simp only [mul_im, Complex.I_re, ofReal_im, mul_zero, + Complex.I_im, ofReal_re, one_mul, zero_add, ht_pos]⟩ + have him : z.im = t := by change (Complex.I * t).im = t; simp only [mul_im, Complex.I_re, + ofReal_im, mul_zero, Complex.I_im, ofReal_re, one_mul, zero_add] simpa [him] using hA z (by simpa [him] using le_of_max_le_left ht) /-- @@ -381,7 +394,7 @@ lemma isBigO_atImInfty_of_fourier_shift calc ‖a m‖ * rexp (-(2 * π) * (↑m + ↑n₀) * z.im) ≤ ‖a m‖ * (rexp (-(2 * π * c) * m) * rexp (-(2 * π * c) * n₀)) := mul_le_mul_of_nonneg_left (hexp_bound m) (norm_nonneg _) - _ = ‖a m‖ * rexp (-(2 * π * c) * m) * rexp (-(2 * π * c) * n₀) := by ring + _ = ‖a m‖ * rexp (-(2 * π * c) * m) * rexp (-(2 * π * c) * n₀) := by ac_rfl have hsum_norms' : Summable fun m => ‖a m‖ * rexp (-(2 * π) * (m + n₀) * z.im) := by convert hsum_norms with m; rw [norm_mul, norm_exp, hexp_re] -- Main calculation @@ -402,7 +415,7 @@ lemma isBigO_atImInfty_of_fourier_shift nlinarith only [key, Real.pi_pos, (Nat.cast_nonneg m : (0 : ℝ) ≤ m), z.im_pos] calc ‖a m‖ * rexp (-(2 * π) * (↑m + ↑n₀) * z.im) = ‖a m‖ * rexp (-(2 * π) * m * z.im) * rexp (-(2 * π) * n₀ * z.im) := by - rw [hsplit]; ring + rw [hsplit]; ac_rfl _ ≤ ‖a m‖ * rexp (-(2 * π * c) * m) * rexp (-(2 * π) * n₀ * z.im) := by apply mul_le_mul_of_nonneg_right _ (le_of_lt (Real.exp_pos _)) exact mul_le_mul_of_nonneg_left hexp_m (norm_nonneg _) diff --git a/LeanPool/LeanModularForms/Modularforms/SerreDerivativeSlash.lean b/LeanPool/LeanModularForms/Modularforms/SerreDerivativeSlash.lean index fafe396ba8..0420805862 100644 --- a/LeanPool/LeanModularForms/Modularforms/SerreDerivativeSlash.lean +++ b/LeanPool/LeanModularForms/Modularforms/SerreDerivativeSlash.lean @@ -111,4 +111,5 @@ lemma serre_DE₂_slash_invariant (γ : SL(2, ℤ)) : show α = 3 / π ^ 2 by simp only [hα_def, riemannZeta_two]; field_simp; ring] field_simp [UpperHalfPlane.denom_ne_zero γ z, Complex.ofReal_ne_zero.mpr Real.pi_ne_zero] ring_nf - simp_all + simp_all only [one_div, mul_inv_rev, Fin.isValue, I_sq, mul_neg, mul_one, neg_mul, + add_neg_cancel_right] diff --git a/LeanPool/LeanModularForms/Modularforms/SlashActionAuxil.lean b/LeanPool/LeanModularForms/Modularforms/SlashActionAuxil.lean index 72015a081e..58a7dccae2 100644 --- a/LeanPool/LeanModularForms/Modularforms/SlashActionAuxil.lean +++ b/LeanPool/LeanModularForms/Modularforms/SlashActionAuxil.lean @@ -108,20 +108,26 @@ theorem modular_negI_smul : negI.1 • z = z := by theorem modular_slash_negI_of_even (hk : Even k) : f ∣[k] negI.1 = f := by ext x rw [slash_action_eq'_iff, modular_negI_smul] - simp [negI, negIMatrix, hk.neg_one_zpow] + simp only [negI, negIMatrix, Int.reduceNeg, Fin.isValue, of_apply, cons_val', cons_val_zero, + cons_val_fin_one, cons_val_one, Int.cast_zero, zero_mul, Int.cast_neg, Int.cast_one, zero_add, + hk.neg_one_zpow, one_mul] theorem modular_slash_S_apply : (f ∣[k] S) z = f (UpperHalfPlane.mk (-z)⁻¹ z.im_inv_neg_coe_pos) * z ^ (-k) := by rw [SL_slash_apply, denom, UpperHalfPlane.modular_S_smul] simp only [SpecialLinearGroup.coe_GL_coe_matrix] rw [SpecialLinearGroup.map_apply_coe (Int.castRingHom ℝ) S] - simp [S, RingHom.mapMatrix_apply] + simp only [inv_neg, S, Int.reduceNeg, Fin.isValue, RingHom.mapMatrix_apply, Int.coe_castRingHom, + map_apply, of_apply, cons_val', cons_val_zero, cons_val_fin_one, cons_val_one, Int.cast_one, + Complex.ofReal_one, one_mul, Int.cast_zero, Complex.ofReal_zero, add_zero, zpow_neg] theorem modular_slash_T_apply : (f ∣[k] T) z = f ((1 : ℝ) +ᵥ z) := by rw [SL_slash_apply, denom, UpperHalfPlane.modular_T_smul] simp only [SpecialLinearGroup.coe_GL_coe_matrix] rw [SpecialLinearGroup.map_apply_coe (Int.castRingHom ℝ) T] - simp [T, RingHom.mapMatrix_apply] + simp only [T, Fin.isValue, RingHom.mapMatrix_apply, Int.coe_castRingHom, map_apply, of_apply, + cons_val', cons_val_zero, cons_val_fin_one, cons_val_one, Int.cast_zero, Complex.ofReal_zero, + zero_mul, Int.cast_one, Complex.ofReal_one, zero_add, zpow_neg, one_zpow, inv_one, mul_one] end slash_action @@ -343,7 +349,8 @@ theorem slashaction_generators_GL2R rw [←hA₂] change f ∣[k] A = f refine (slashaction_generators f ⊤ _ SL2Z_generate k).mpr ?_ ⟨A, by simp⟩ - simp_all + simp_all only [Gamma_mem, Fin.isValue, Set.mem_insert_iff, Set.mem_singleton_iff, + forall_eq_or_imp, implies_true, and_self] theorem slashaction_generators_Γ2 (f : ℍ → ℂ) (k : ℤ) (hα : f ∣[k] α.1 = f) (hβ : f ∣[k] β.1 = f) (hnegI : f ∣[k] negI.1 = f) : @@ -354,6 +361,7 @@ theorem slashaction_generators_Γ2 rw [←hA₂] change f ∣[k] A = f refine (slashaction_generators' f {α, β, negI} Γ2_generate k).mpr ?_ ⟨_, hA₁⟩ - simp_all + simp_all only [Gamma_mem, Fin.isValue, Set.mem_insert_iff, Set.mem_singleton_iff, + forall_eq_or_imp, implies_true, and_self] end slashaction_generators diff --git a/LeanPool/LeanModularForms/Modularforms/SummableLems.lean b/LeanPool/LeanModularForms/Modularforms/SummableLems.lean index e2e8635fc1..47d3ef4462 100644 --- a/LeanPool/LeanModularForms/Modularforms/SummableLems.lean +++ b/LeanPool/LeanModularForms/Modularforms/SummableLems.lean @@ -66,7 +66,7 @@ theorem nat_pos_tsum2 {α : Type _} [TopologicalSpace α] [AddCommMonoid α] simp only [mem_range, not_exists] at * by_cases h : 0 < x · simpa using hx ⟨x,h⟩ - simp_all + simp_all only [not_lt, nonpos_iff_eq_zero] theorem tsum_pNat {α : Type _} [AddCommGroup α] [UniformSpace α] [IsUniformAddGroup α] [T2Space α] (f : ℕ → α) (hf : f 0 = 0) : ∑' n : ℕ+, f n = ∑' n, f n := by @@ -76,7 +76,7 @@ theorem tsum_pNat {α : Type _} [AddCommGroup α] [UniformSpace α] [IsUniformAd have h1 := tsum_eq_zero_of_not_summable hf2 rw [← nat_pos_tsum2 f hf] at hf2 have h2 := tsum_eq_zero_of_not_summable hf2 - simp [h1, h2] + simp only [h2, h1] lemma tsum_pnat_eq_tsum_succ4 {α : Type*} [TopologicalSpace α] [AddCommGroup α] @@ -89,7 +89,8 @@ lemma tsum_pnat_eq_tsum_succ4 {α : Type*} [TopologicalSpace α] [AddCommGroup /-- Closed form for ∑ n·rⁿ over ℕ+ when ‖r‖ < 1. -/ lemma tsum_pnat_coe_mul_geometric {r : ℝ} (hr : ‖r‖ < 1) : (∑' n : ℕ+, (n : ℝ) * r ^ (n : ℕ)) = r / (1 - r) ^ 2 := by - rw [tsum_pNat (f := fun n => (n : ℝ) * r ^ n) (by simp)] + rw [tsum_pNat (f := fun n => (n : ℝ) * r ^ n) (by simp only [CharP.cast_eq_zero, pow_zero, + mul_one])] exact tsum_coe_mul_geometric_of_norm_lt_one hr theorem nat_pos_tsum2' {α : Type*} [TopologicalSpace α] [AddCommMonoid α] (f : ℕ → α) : @@ -97,7 +98,8 @@ theorem nat_pos_tsum2' {α : Type*} [TopologicalSpace α] [AddCommMonoid α] (f rw [← Equiv.summable_iff _root_.Equiv.pnatEquivNat] constructor · intro hf - exact hf.congr fun b => by simp + exact hf.congr fun b => by simp only [Equiv.pnatEquivNat_apply, comp_apply, + PNat.natPred_add_one] intro hf exact hf.congr fun b => by simp @@ -152,7 +154,7 @@ lemma pnat_inv_sub_squares (z : ℍ) : rw [one_div_add_one_div] · norm_cast ring_nf - simp_all + simp_all only [PNat.pow_coe, Nat.cast_pow] · have h1 := upp_half_not_ints z (n) norm_cast at * rw [@sub_eq_zero] @@ -194,7 +196,7 @@ theorem upbnd (z : ℍ) (d : ℤ) : (d ^ 2 : ℝ) * r z ^ 2 ≤ ‖((z : ℂ) ^ simp only [ofReal_inv, ofReal_intCast, ofReal_neg, ofReal_one] ring · have h1 := auxbound2 z ((d : ℝ)⁻¹) (d := 1) (by norm_num) - simp_all + simp_all only [ne_eq, one_div, ofReal_inv, ofReal_intCast, ofReal_one] · simp_all @@ -236,14 +238,14 @@ theorem sum_int_even {α : Type*} [UniformSpace α] [CommRing α] [IsUniformAddG have hf3 : Summable ((fun n : ℕ => f (↑n + 1)) ∘ PNat.natPred) := by have hs : Summable fun n : ℕ+ => f n := (int_nat_sum f hf2).subtype _ apply Summable.congr hs - intro b; simp; congr; simp + intro b; simp only [comp_apply]; congr; simp only [PNat.natPred_add_one] rw [Summable.hasSum_iff hf3] congr funext - simp + simp only [comp_apply] congr norm_cast - simp + simp only [PNat.natPred_add_one] have hneg : HasSum (fun n : ℕ => f (-n.succ)) (∑' n : ℕ+, f n) := by have h1 : (fun n : ℕ => f (-↑n.succ)) = fun n : ℕ => f ↑n.succ := by funext n @@ -251,7 +253,7 @@ theorem sum_int_even {α : Type*} [UniformSpace α] [CommRing α] [IsUniformAddG rw [h1] convert hpos using 2 with n push_cast - ring + ac_rfl have := (HasSum.pos_add_zero_add_neg hpos hneg).tsum_eq rw [this] ring @@ -265,12 +267,12 @@ theorem summable_diff (z : ℍ) (d : ℤ) : · simp_all by_cases hd2 : 0 < d · have := lhs_summable ⟨ -d / z, by simpa using pos_nat_div_upper d hd2 z⟩ - simp_all + simp_all only [one_div] let D := (-d).natAbs have hd : 0 < D := by aesop have hd22 : (D : ℂ) = -d := by simp only [Int.natAbs_neg, D] - have : 0 ≤ -d := by linarith + have : 0 ≤ -d := by linarith only [hd2] have := Int.natAbs_of_nonneg this norm_cast rw [← this, Int.natAbs_neg] @@ -393,13 +395,13 @@ theorem summable_diff_denom (z : ℍ) (i : ℤ) : apply h3.congr · intro n rw [mul_comm] - simp + simp only [Int.cast_add, Int.cast_one, mul_inv_rev] ring · intro n norm_cast rw [pow_two] rw [← mul_inv] - simp + simp only [Int.cast_abs, abs_mul_abs_self, mul_inv_rev, Int.cast_mul] lemma summable_pain (z : ℍ) (i : ℤ) : Summable (fun m : ℤ ↦ 1 / ((m : ℂ) * ↑z + ↑i) - 1 / (↑m * ↑z + ↑i + 1)) := by @@ -517,7 +519,7 @@ lemma G_2_alt_summable (z : ℍ) : Summable fun (m : Fin 2 → ℤ) => r z ^ (-3 : ℝ) * ‖![b 0, b 1 + 1]‖ ^ (-1 : ℝ) * ‖b‖ ^ (-2 : ℝ) := by rw [show (-3 : ℝ) = -2 -1 by norm_num] nth_rw 5 [Real.rpow_of_add_eq (y := -2) (z := -1)] - · ring + · ac_rfl · exact (r_pos z).le · norm_cast norm_cast @@ -533,7 +535,7 @@ lemma G_2_alt_summable (z : ℍ) : Summable fun (m : Fin 2 → ℤ) => simpa using HB2 · positivity · have := (r_pos z).le - positivity + exact Real.rpow_nonneg this (-3) · apply Real.rpow_nonneg apply norm_nonneg · exact @@ -548,9 +550,11 @@ noncomputable def δ (a b : ℤ) : ℂ := if a = 0 ∧ b = 0 then 1 else if a = lemma δ_eq : δ 0 0 = 1 := by simp [δ] @[simp] -lemma δ_eq2 : δ 0 (-1) = 2 := by simp [δ] +lemma δ_eq2 : δ 0 (-1) = 2 := by simp only [δ, Int.reduceNeg, neg_eq_zero, one_ne_zero, and_false, + ↓reduceIte, and_self] -lemma δ_neq (a b : ℤ) (h : a ≠ 0) : δ a b = 0 := by simp [δ, h] +lemma δ_neq (a b : ℤ) (h : a ≠ 0) : δ a b = 0 := by simp only [δ, h, false_and, ↓reduceIte, + Int.reduceNeg] lemma G_2_alt_summable_δ (z : ℍ) : Summable fun (m : Fin 2 → ℤ) => (1 / (((m 0 : ℂ) * z + m 1)^2 * (m 0 * z + m 1 + 1)) + δ (m 0) (m 1)):= by @@ -674,7 +678,7 @@ theorem summable_2 (k : ℕ) (z : ℍ) (hk : 1 ≤ k) : rw [this] apply Asymptotics.IsBigO.pow have hl := linear_bigO_nat 1 z - simp_all + simp_all only [Nat.cast_pow, inv_pow, Int.cast_one, one_mul, Nat.abs_cast] @@ -785,7 +789,9 @@ theorem summable_auxil_1 (k : ℕ) (z : ℍ) : apply Summable.of_nonneg_of_le _ _ hsum · intro b apply Finset.sum_nonneg - simp_all + simp_all only [Finset.sum_const, nsmul_eq_mul, Nat.mem_divisors, ne_eq, PNat.ne_zero, + not_false_eq_true, and_true, Nat.cast_div_charZero, norm_pos_iff, exp_ne_zero, + mul_nonneg_iff_of_pos_right, Nat.cast_nonneg, pow_nonneg, implies_true] · intro b apply Finset.sum_le_sum intro i hi @@ -798,7 +804,9 @@ theorem summable_auxil_1 (k : ℕ) (z : ℍ) : simp only [Finset.sum_const, nsmul_eq_mul] at * exact Nat.mul_div_cancel' hi rw [mul_assoc, hni] - · simp_all + · simp_all only [Complex.norm_mul, norm_pow, RCLike.norm_natCast, norm_pos_iff, ne_eq, + exp_ne_zero, not_false_eq_true, mul_nonneg_iff_of_pos_right, Nat.cast_nonneg, pow_nonneg, + implies_true] @@ -807,7 +815,8 @@ theorem summable_auxil_1 (k : ℕ) (z : ℍ) : lemma sum_range_zero (f : ℤ → ℂ) (n : ℕ) : ∑ m ∈ Finset.range (n+1), f m = f 0 + - ∑ m ∈ Finset.range n, f (m+1) := by rw [Finset.sum_range_succ', add_comm]; simp + ∑ m ∈ Finset.range n, f (m+1) := by rw [Finset.sum_range_succ', add_comm]; simp only [ + CharP.cast_eq_zero, Nat.cast_add, Nat.cast_one] @@ -906,7 +915,7 @@ theorem tsum_uexp_contDiffOn (k : ℕ) : apply IsOpen.uniqueDiffOn upper_half_plane_isOpen aesop rw [hr] - simp + simp only [Real.abs_pi, norm_one, mul_one] ring theorem iter_der_within_add (k : ℕ+) (x : {z : ℂ | 0 < z.im}) : @@ -987,12 +996,12 @@ lemma sub_bound (s : ℍ) (A B : ℝ) (hB : 0 < B) (hs : s ∈ verticalStrip A B have habs : |r (⟨⟨A, B⟩, hB⟩ : ℍ)| = r ⟨⟨A, B⟩, hB⟩ := abs_of_nonneg (EisensteinSeries.r_pos _).le rw [hnorm] at this - have hcast : (-(2 : ℝ) + -↑k) = ((-2 + -↑k : ℤ) : ℝ) := by push_cast; ring + have hcast : (-(2 : ℝ) + -↑k) = ((-2 + -↑k : ℤ) : ℝ) := by push_cast; ac_rfl rw [hcast] at this simp only [Real.rpow_intCast] at this have hexp : (-(↑(k + 2) : ℤ)) = -2 + -↑k := by push_cast; ring have hexp2 : (-((k : ℤ) + 2)) = -2 + -↑k := by ring - rw [show (s : ℂ) - n = s + -↑↑n by ring, habs, hexp, hexp2] + rw [show (s : ℂ) - n = s + -↑↑n by ac_rfl, habs, hexp, hexp2] exact this @@ -1017,12 +1026,12 @@ lemma add_bound (s : ℍ) (A B : ℝ) (hB : 0 < B) (hs : s ∈ verticalStrip A B have habs : |r (⟨⟨A, B⟩, hB⟩ : ℍ)| = r ⟨⟨A, B⟩, hB⟩ := abs_of_nonneg (EisensteinSeries.r_pos _).le rw [hnorm] at this - have hcast : (-(2 : ℝ) + -↑k) = ((-2 + -↑k : ℤ) : ℝ) := by push_cast; ring + have hcast : (-(2 : ℝ) + -↑k) = ((-2 + -↑k : ℤ) : ℝ) := by push_cast; ac_rfl rw [hcast] at this simp only [Real.rpow_intCast] at this have hexp : (-(↑(k + 2) : ℤ)) = -2 + -↑k := by push_cast; ring have hexp2 : (-((k : ℤ) + 2)) = -2 + -↑k := by ring - rw [show (s : ℂ) + n = s + ↑↑n by ring, habs, hexp, hexp2] + rw [show (s : ℂ) + n = s + ↑↑n by ac_rfl, habs, hexp, hexp2] exact this theorem aut_bound_on_comp (K : Set ℍ) (hk2 : IsCompact K) (k : ℕ) : @@ -1092,7 +1101,7 @@ theorem diff_at_aux (s : {z : ℂ | 0 < z.im}) (k : ℕ) (n : ℕ+) : simp_all only [Int.cast_natCast, one_div, mem_ofPred_eq, Pi.add_apply] exact (isOpen_lt (by exact continuous_const) (by - exact Complex.continuous_im)).mem_nhds (by simp) + exact Complex.continuous_im)).mem_nhds (by simp only [mem_ofPred_eq, Subtype.coe_prop]) theorem aut_series_ite_deriv_uexp2 (k : ℕ) (x : ℍ) : iteratedDerivWithin k (fun z : ℂ => ∑' n : ℕ+, (1 / (z - n) + 1 / (z + n))) {z : ℂ | 0 < z.im} x @@ -1182,7 +1191,7 @@ theorem tsum_aexp_contDiffOn (k : ℕ) : apply DifferentiableOn.congr _ h1 intro x hx apply HasDerivWithinAt.differentiableWithinAt - apply hasDerivWithinAt_tsum_fun _ (isOpen_lt (by fun_prop) (by fun_prop)) _ hx + apply hasDerivWithinAt_tsum_fun _ (isOpen_lt (by exact continuous_const) (by fun_prop)) _ hx · intro y hy apply summable_3 m ⟨y, hy⟩ · intro K hK1 hK2 @@ -1217,7 +1226,7 @@ theorem tsum_aexp_contDiffOn (k : ℕ) : have:= (diff_on_aux m n) have hN : {z : ℂ | 0 < z.im} ∈ 𝓝 r.1 := by refine IsOpen.mem_nhds ?_ ?_ - · apply isOpen_lt (by fun_prop) (by fun_prop) + · apply isOpen_lt (by exact continuous_const) (by exact Complex.continuous_im) apply r.2 apply DifferentiableOn.differentiableAt _ hN simp only [Nat.cast_le, one_div, mem_ofPred_eq] at * @@ -1265,7 +1274,7 @@ theorem aux_iter_der_tsum (k : ℕ) (hk : 1 ≤ k) (x : ℍ) : apply (summable_1 k x hk).congr intro n congr - simp + simp only [Int.cast_neg, Int.cast_natCast] rfl · have := (aut_contDiffOn 0 k) simp only [Int.cast_zero, sub_zero, one_div] at * @@ -1276,8 +1285,8 @@ theorem aux_iter_der_tsum (k : ℕ) (hk : 1 ≤ k) (x : ℍ) : · exact x.2 · refine IsOpen.uniqueDiffOn ?_ refine isOpen_lt ?_ ?_ - · fun_prop - · fun_prop + · exact continuous_const + · exact Complex.continuous_im theorem aux_iter_der_tsum_eqOn (k : ℕ) (hk : 2 ≤ k) : EqOn (iteratedDerivWithin (k - 1) @@ -1309,7 +1318,7 @@ theorem pos_sum_eq (k : ℕ) (hk : 0 < k) : simp only [CharP.cast_eq_zero, mul_zero, zero_mul, exp_zero, mul_one, pow_eq_zero_iff', ne_eq, true_and] at this apply this - linarith + exact ne_of_gt hk theorem cot_series_repr (z : ℍ) : ↑π * cot (↑π * z) - 1 / z = ∑' n : ℕ+, (1 / ((z : ℂ) - n) + 1 / (z + n)) := by @@ -1338,7 +1347,7 @@ theorem q_exp_iden'' (k : ℕ) (hk : 2 ≤ k) : apply EqOn.trans this have hkpos : 0 < k - 1 := by apply Nat.sub_pos_of_lt - linarith + exact hk have h2 := (iter_exp_eqOn (⟨k - 1, hkpos⟩ : ℕ+)).symm simp only [one_div, PNat.mk_coe, neg_mul, smul_eq_mul] at * have h3 := pos_sum_eq (k - 1) hkpos @@ -1363,7 +1372,7 @@ theorem q_exp_iden (k : ℕ) (hk : 2 ≤ k) (z : ℍ) : (-2 * ↑π * Complex.I) ^ k / (k - 1)! * ∑' n : ℕ+, n ^ ((k - 1)) * Complex.exp (2 * ↑π * Complex.I * z * n) := by have := q_exp_iden'' k hk z.2 - have hkk : 1 ≤ (k: ℤ) := by linarith + have hkk : 1 ≤ (k: ℤ) := by linarith only [hk] simp only [one_div, neg_mul, Nat.one_le_cast] at * have hk2 : (-1 : ℂ) ^ ((k - 1)) * (k - 1)! ≠ 0 := by simp only [ne_eq, mul_eq_zero, pow_eq_zero_iff', neg_eq_zero, one_ne_zero, false_and, @@ -1387,10 +1396,10 @@ theorem q_exp_iden (k : ℕ) (hk : 2 ≤ k) (z : ℍ) : have hkk : (k - 1) + k = 2 * k - 1 := by rw [add_comm, ← Nat.add_sub_assoc] · rw [two_mul] - linarith + linarith only [hk] rw [hkk] apply Nat.Even.sub_odd - · nlinarith + · nlinarith only [hk] · simp exact odd_one rw [← mul_assoc] @@ -1477,14 +1486,15 @@ lemma exp_aux (z : ℍ) (n : ℕ) : cexp (2 * ↑π * Complex.I * n * ↑z) = cexp (2 * ↑π * Complex.I * ↑z) ^ n := by rw [← Complex.exp_nat_mul] congr 1 - ring + ac_rfl theorem summable_exp_pow (z : ℍ) : Summable fun i : ℕ ↦ ‖(cexp (2 * ↑π * Complex.I * (↑i + 1) * z))‖ := by conv => enter [1] ext i - rw [show ((i : ℂ) + 1) = ((i + 1) : ℕ) by simp, exp_aux, norm_pow] + rw [show ((i : ℂ) + 1) = ((i + 1) : ℕ) by simp only [Nat.cast_add, + Nat.cast_one], exp_aux, norm_pow] rw [summable_nat_add_iff 1] simp only [summable_geometric_iff_norm_lt_one, norm_norm] apply exp_upperHalfPlane_lt_one @@ -1506,7 +1516,7 @@ lemma a1_summable_norm (e : ℕ+) (z : ℍ) : funext a rw [← Complex.exp_nat_mul] congr 2 - ring + ac_rfl rw [hpow] exact summable_norm_iff.mpr (summable_geometric_iff_norm_lt_one.mpr (a1_norm_lt_one e z)) @@ -1561,7 +1571,7 @@ lemma t9 (z : ℍ) : ∑' m : ℕ, funext n simp only [mul_eq_mul_left_iff, Nat.cast_eq_zero, PNat.ne_zero, or_false] congr 1 - ring + ac_rfl · have := (a4 2 z).prod_symm simp only [Nat.add_one_sub_one, pow_one] at * apply this.congr @@ -1582,9 +1592,10 @@ lemma t9 (z : ℍ) : ∑' m : ℕ, have := a4 2 z apply this.congr intro b - simp [uncurry] + simp only [uncurry, Nat.add_one_sub_one, pow_one, mul_eq_mul_left_iff, Nat.cast_eq_zero, + PNat.ne_zero, or_false] congr 1 - ring + ac_rfl @@ -1599,7 +1610,7 @@ theorem summable_diff_right_a (z : ℍ) (d : ℕ+) : apply this.congr intro b have hz := ne_zero z - simp at * + simp only [Int.cast_natCast, one_div, ne_eq] at * grind theorem summable_diff_right (z : ℍ) (d : ℕ+) : @@ -1612,7 +1623,7 @@ theorem summable_diff_right (z : ℍ) (d : ℕ+) : apply this.congr intro b have hz := ne_zero z - simp at * + simp only [Int.cast_natCast, one_div, ne_eq, Int.cast_neg, neg_mul] at * grind lemma sum_int_pnatt (z : ℍ) (d : ℕ+) : diff --git a/LeanPool/LeanModularForms/Modularforms/ThetaDerivIdentities.lean b/LeanPool/LeanModularForms/Modularforms/ThetaDerivIdentities.lean index 4668ddd72f..0b91ce1889 100644 --- a/LeanPool/LeanModularForms/Modularforms/ThetaDerivIdentities.lean +++ b/LeanPool/LeanModularForms/Modularforms/ThetaDerivIdentities.lean @@ -93,7 +93,8 @@ noncomputable def f₄ : ℍ → ℂ := /-- f₂ decomposes as serreD 2 H₂ + (-1/6) • (H₂ * (H₂ + 2*H₄)) -/ lemma f₂_decompose : f₂ = serreD (2 : ℤ) H₂ + ((-1/6 : ℂ) • (H₂ * (H₂ + (2 : ℂ) • H₄))) := by - ext z; simp [f₂, sub_eq_add_neg]; ring + ext z; simp only [f₂, one_div, Pi.sub_apply, serre_D_apply, sub_eq_add_neg, Pi.smul_apply, + Pi.mul_apply, Pi.add_apply, smul_eq_mul, Int.cast_ofNat, add_right_inj]; ring /-- f₄ decomposes as serreD 2 H₄ + (1/6) • (H₄ * (2*H₂ + H₄)) -/ lemma f₄_decompose : @@ -172,11 +173,13 @@ lemma f₂_S_action : (f₂ ∣[(4 : ℤ)] S) = -f₄ := by -- Step 2: (H₂ + 2•H₄)|[2]S = -(H₄ + 2•H₂) have h_lin_comb : ((H₂ + (2 : ℂ) • H₄) ∣[(2 : ℤ)] S) = -(H₄ + (2 : ℂ) • H₂) := by rw [add_slash, SL_smul_slash, H₂_S_action, H₄_S_action] - ext z; simp [Pi.add_apply, Pi.smul_apply, Pi.neg_apply]; ring + ext z; simp only [smul_neg, Pi.add_apply, Pi.neg_apply, Pi.smul_apply, smul_eq_mul, + neg_add_rev]; ac_rfl -- Step 3: Product (H₂ * (H₂ + 2•H₄))|[4]S = H₄ * (H₄ + 2•H₂) have h_prod : ((H₂ * (H₂ + (2 : ℂ) • H₄)) ∣[(4 : ℤ)] S) = H₄ * (H₄ + (2 : ℂ) • H₂) := by rw [show (4 : ℤ) = 2 + 2 from rfl, mul_slash_SL2 2 2 S _ _, H₂_S_action, h_lin_comb] - ext z; simp [Pi.mul_apply, Pi.neg_apply, Pi.add_apply, Pi.smul_apply]; ring + ext z; simp only [neg_add_rev, Pi.mul_apply, Pi.neg_apply, Pi.add_apply, Pi.smul_apply, + smul_eq_mul, neg_mul]; ring -- Combine: f₂|[4]S = -serreD 2 H₄ - (1/6) * H₄ * (2*H₂ + H₄) = -f₄ rw [f₂_decompose, add_slash, SL_smul_slash, h_serre_term, h_prod]; unfold f₄ ext z; simp only [Pi.add_apply, Pi.smul_apply, Pi.neg_apply, Pi.mul_apply, smul_eq_mul]; ring_nf @@ -226,11 +229,13 @@ lemma f₄_S_action : (f₄ ∣[(4 : ℤ)] S) = -f₂ := by -- Step 2: (2•H₂ + H₄)|[2]S = -(2•H₄ + H₂) have h_lin_comb : (((2 : ℂ) • H₂ + H₄) ∣[(2 : ℤ)] S) = -((2 : ℂ) • H₄ + H₂) := by rw [add_slash, SL_smul_slash, H₂_S_action, H₄_S_action] - ext z; simp [Pi.add_apply, Pi.smul_apply, Pi.neg_apply]; ring + ext z; simp only [smul_neg, Pi.add_apply, Pi.neg_apply, Pi.smul_apply, smul_eq_mul, + neg_add_rev]; ac_rfl -- Step 3: Product (H₄ * (2•H₂ + H₄))|[4]S = H₂ * (H₂ + 2•H₄) have h_prod : ((H₄ * ((2 : ℂ) • H₂ + H₄)) ∣[(4 : ℤ)] S) = H₂ * (H₂ + (2 : ℂ) • H₄) := by rw [show (4 : ℤ) = 2 + 2 from rfl, mul_slash_SL2 2 2 S _ _, H₄_S_action, h_lin_comb] - ext z; simp [Pi.mul_apply, Pi.neg_apply, Pi.add_apply, Pi.smul_apply]; ring + ext z; simp only [neg_add_rev, Pi.mul_apply, Pi.neg_apply, Pi.add_apply, Pi.smul_apply, + smul_eq_mul, neg_mul]; ring -- Combine: f₄|[4]S = -serreD 2 H₂ + (1/6) * H₂ * (H₂ + 2H₄) = -f₂ rw [f₄_decompose, add_slash, SL_smul_slash, h_serre_term, h_prod]; unfold f₂ ext z @@ -291,10 +296,12 @@ lemma theta_g_S_action : (thetaG ∣[(6 : ℤ)] S) = thetaG := by -- Linear combination transforms: (2•H₂ + H₄)|S = -(2•H₄ + H₂), (H₂ + 2•H₄)|S = -(H₄ + 2•H₂) have h_2H₂_H₄ : (((2 : ℂ) • H₂ + H₄) ∣[(2 : ℤ)] S) = -((2 : ℂ) • H₄ + H₂) := by simp only [add_slash, SL_smul_slash, H₂_S_action, H₄_S_action] - ext z; simp [Pi.add_apply, Pi.smul_apply, Pi.neg_apply]; ring + ext z; simp only [smul_neg, Pi.add_apply, Pi.neg_apply, Pi.smul_apply, smul_eq_mul, + neg_add_rev]; ac_rfl have h_H₂_2H₄ : ((H₂ + (2 : ℂ) • H₄) ∣[(2 : ℤ)] S) = -(H₄ + (2 : ℂ) • H₂) := by simp only [add_slash, SL_smul_slash, H₂_S_action, H₄_S_action] - ext z; simp [Pi.add_apply, Pi.smul_apply, Pi.neg_apply]; ring + ext z; simp only [smul_neg, Pi.add_apply, Pi.neg_apply, Pi.smul_apply, smul_eq_mul, + neg_add_rev]; ac_rfl -- Product transforms using mul_slash_SL2 have h_term1 : ((((2 : ℂ) • H₂ + H₄) * f₂) ∣[(6 : ℤ)] S) = ((2 : ℂ) • H₄ + H₂) * f₄ := by have hmul := mul_slash_SL2 2 4 S ((2 : ℂ) • H₂ + H₄) f₂ @@ -314,7 +321,7 @@ lemma theta_g_S_action : (thetaG ∣[(6 : ℤ)] S) = thetaG := by | norm_num -- g|S = (2H₄ + H₂)f₄ + (H₄ + 2H₂)f₂ = g simp only [thetaG, add_slash, h_term1, h_term2] - ext z; simp only [Pi.add_apply, Pi.mul_apply, Pi.smul_apply]; ring + ext z; simp only [Pi.add_apply, Pi.mul_apply, Pi.smul_apply]; ac_rfl /-- g is invariant under T. @@ -368,7 +375,7 @@ lemma theta_h_S_action : (thetaH ∣[(8 : ℤ)] S) = thetaH := by simp [Pi.mul_apply, Pi.neg_apply, mul_comm] -- h|S = f₄² + f₂f₄ + f₂² = h simp only [thetaH, add_slash, h_f₂_sq, h_f₂f₄, h_f₄_sq] - ext z; simp only [Pi.add_apply, Pi.mul_apply, sq]; ring + ext z; simp only [Pi.add_apply, Pi.mul_apply, sq]; ac_rfl /-- h is invariant under T. @@ -576,24 +583,27 @@ Their difference is a weight-4 cusp form, hence zero by dimension vanishing. /-- S-action on HSumSq: invariant since H₂|S = -H₄ and H₄|S = -H₂ -/ private lemma H_sum_sq_S_action : (HSumSq ∣[(4 : ℤ)] S) = HSumSq := by - have h_eq : HSumSq = H₂ * H₂ + H₂ * H₄ + H₄ * H₄ := by ext z; simp [HSumSq, sq] + have h_eq : HSumSq = H₂ * H₂ + H₂ * H₄ + H₄ * H₄ := by ext z; simp only [HSumSq, sq, Pi.add_apply, + Pi.mul_apply] simp only [h_eq, show (4 : ℤ) = 2 + 2 from by norm_num, SlashAction.add_slash, mul_slash_SL2 2 2 S _ _, H₂_S_action, H₄_S_action] - ext z; simp [Pi.mul_apply, Pi.add_apply]; ring + ext z; simp only [mul_neg, neg_mul, neg_neg, Pi.add_apply, Pi.mul_apply]; ac_rfl /-- T-action on HSumSq: invariant since H₂|T = -H₂ and H₄|T = H₃ = H₂+H₄ -/ private lemma H_sum_sq_T_action : (HSumSq ∣[(4 : ℤ)] T) = HSumSq := by - have h_eq : HSumSq = H₂ * H₂ + H₂ * H₄ + H₄ * H₄ := by ext z; simp [HSumSq, sq] + have h_eq : HSumSq = H₂ * H₂ + H₂ * H₄ + H₄ * H₄ := by ext z; simp only [HSumSq, sq, Pi.add_apply, + Pi.mul_apply] simp only [h_eq, show (4 : ℤ) = 2 + 2 from by norm_num, SlashAction.add_slash, mul_slash_SL2 2 2 T _ _, H₂_T_action, H₄_T_action, ← jacobi_identity] - ext z; simp [Pi.mul_apply, Pi.add_apply]; ring + ext z; simp only [mul_neg, neg_mul, neg_neg, Pi.add_apply, Pi.mul_apply, Pi.neg_apply]; ring private lemma H_sum_sq_SL2Z_invariant : ∀ γ : SL(2, ℤ), HSumSq ∣[(4 : ℤ)] γ = HSumSq := slashaction_generators_SL2Z HSumSq 4 H_sum_sq_S_action H_sum_sq_T_action private lemma isBoundedAtImInfty_H_sum_sq : IsBoundedAtImInfty HSumSq := by - have : HSumSq = H₂ * H₂ + H₂ * H₄ + H₄ * H₄ := by ext z; simp [HSumSq, sq] + have : HSumSq = H₂ * H₂ + H₂ * H₄ + H₄ * H₄ := by ext z; simp only [HSumSq, sq, Pi.add_apply, + Pi.mul_apply] rw [this]; exact ((isBoundedAtImInfty_H₂.mul isBoundedAtImInfty_H₂).add (isBoundedAtImInfty_H₂.mul isBoundedAtImInfty_H₄)).add (isBoundedAtImInfty_H₄.mul isBoundedAtImInfty_H₄) @@ -613,7 +623,8 @@ private noncomputable def H_sum_sq_MF : ModularForm (Γ 1) 4 := { at ∞, so their difference is a weight-4 cusp form, hence zero. -/ theorem E₄_eq_H_sum_sq : _root_.E₄.toFun = HSumSq := by have h_toFun : (_root_.E₄ - H_sum_sq_MF).toFun = _root_.E₄.toFun - HSumSq := by - ext z; simp [H_sum_sq_MF, H_sum_sq_SIF]; rfl + ext z; simp only [H_sum_sq_MF, H_sum_sq_SIF, SlashInvariantForm.toFun_eq_coe, + toSlashInvariantForm_coe, _root_.sub_apply, Pi.sub_apply, sub_right_inj]; rfl have h_diff_tendsto : Tendsto (_root_.E₄ - H_sum_sq_MF).toFun atImInfty (nhds 0) := by rw [h_toFun] have h := E₄_tendsto_one_atImInfty.sub H_sum_sq_tendsto diff --git a/LeanPool/LeanModularForms/Modularforms/TsumderivWithin.lean b/LeanPool/LeanModularForms/Modularforms/TsumderivWithin.lean index a5d76fee65..bcb93be044 100644 --- a/LeanPool/LeanModularForms/Modularforms/TsumderivWithin.lean +++ b/LeanPool/LeanModularForms/Modularforms/TsumderivWithin.lean @@ -133,7 +133,7 @@ theorem iter_deriv_comp_bound2 (K : Set ℂ) (hK1 : K ⊆ ℍ') (hK2 : IsCompact · intro x; rw [BoundedContinuousFunction.mkOfCompact_apply]; simp_rw [ctsExpTwoPiN] simp only [ContinuousMap.coe_mk] apply exp_upperHalfPlane_lt_one ⟨x.1, hK1 x.2⟩ - linarith + linarith only [] have hr2 : 0 ≤ r := by apply norm_nonneg _ have hu : Summable fun n : ℕ => ‖((2 * ↑π * Complex.I * n) ^ (k + 1) * r ^ n)‖ := summable_two_pi_pow_geometric r (by rwa [Real.norm_of_nonneg hr2]) (k + 1) @@ -168,9 +168,9 @@ theorem iter_deriv_comp_bound2 (K : Set ℂ) (hK1 : K ⊆ ℍ') (hK2 : IsCompact rw [norm_norm] simpa [ctsExpTwoPiN] using this apply mul_le_mul - · simp - · simp_all - · positivity + · simp only [Real.abs_pi, Std.le_refl] + · simp_all only [Real.abs_pi, BoundedContinuousFunction.norm_mkOfCompact, Real.norm_eq_abs] + · exact norm_nonneg (cexp (2 * ↑π * Complex.I * ↑n * ↑t)) positivity @@ -248,6 +248,7 @@ theorem iter_deriv_comp_bound3 (K : Set ℂ) (hK1 : K ⊆ ℍ') (hK2 : IsCompact simpa [ctsExpTwoPiN] using this apply mul_le_mul · simp - · simp_all - · positivity + · simp_all only [BoundedContinuousFunction.norm_mkOfCompact, Complex.norm_mul, norm_pow, + norm_ofNat, norm_real, Real.norm_eq_abs, Real.abs_pi, norm_I, mul_one, RCLike.norm_natCast] + · exact norm_nonneg (cexp (2 * ↑π * Complex.I * ↑n * ↑t)) positivity diff --git a/LeanPool/LeanModularForms/Modularforms/Uniformcts.lean b/LeanPool/LeanModularForms/Modularforms/Uniformcts.lean index 131a66d083..3ce4254e6b 100644 --- a/LeanPool/LeanModularForms/Modularforms/Uniformcts.lean +++ b/LeanPool/LeanModularForms/Modularforms/Uniformcts.lean @@ -7,7 +7,6 @@ Authors: Chris Birkbeck module import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan -import Mathlib.MeasureTheory.Covering.Besicovitch import Mathlib.Tactic.Positivity.Finset /-! # Uniformcts -/ diff --git a/LeanPool/LeanModularForms/SpherePacking/CuspDecay.lean b/LeanPool/LeanModularForms/SpherePacking/CuspDecay.lean index de77b46f98..b4f2213bcd 100644 --- a/LeanPool/LeanModularForms/SpherePacking/CuspDecay.lean +++ b/LeanPool/LeanModularForms/SpherePacking/CuspDecay.lean @@ -65,10 +65,14 @@ private theorem tendsto_one_atImInfty_of_cuspFunction_zero (hval : UpperHalfPlane.cuspFunction 1 f 0 = 1) : Tendsto f UpperHalfPlane.atImInfty (nhds 1) := by have hcont : ContinuousAt (UpperHalfPlane.cuspFunction 1 f) 0 := - (ModularFormClass.analyticAt_cuspFunction_zero f one_pos (by simp)).continuousAt + (ModularFormClass.analyticAt_cuspFunction_zero f one_pos (by simp only [ + CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples])).continuousAt rw [show (1 : ℂ) = UpperHalfPlane.cuspFunction 1 f 0 from hval.symm] exact (hcont.tendsto.comp tendsto_qParam_atImInfty).congr - (fun z => (SlashInvariantFormClass.eq_cuspFunction f z (by simp) one_ne_zero)) + (fun z => (SlashInvariantFormClass.eq_cuspFunction f z (by simp only [ + CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) one_ne_zero)) /-- `E4(z) -> 1` as `Im(z) -> infinity`, from the q-expansion constant term. -/ theorem E₄_tendsto_one_atImInfty_SP : @@ -96,7 +100,8 @@ noncomputable def cFDelta := UpperHalfPlane.cuspFunction 1 Delta /-- The derivative of cFDelta at 0 equals 1. -/ lemma deriv_cF_Delta_zero : deriv cFDelta 0 = 1 := by have hfps := ModularFormClass.hasFPowerSeries_cuspFunction Delta one_pos - (by simp) + (by simp only [CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) rw [show cFDelta = UpperHalfPlane.cuspFunction 1 Delta from rfl, hfps.hasFPowerSeriesAt.deriv] simp only [UpperHalfPlane.qExpansionFormalMultilinearSeries, @@ -108,7 +113,8 @@ lemma deriv_cF_Delta_zero : deriv cFDelta 0 = 1 := by /-- cFDelta has derivative 1 at 0. -/ lemma cF_Delta_hasDerivAt_zero : HasDerivAt cFDelta (1 : ℂ) 0 := by have hana := ModularFormClass.analyticAt_cuspFunction_zero Delta one_pos - (by simp) + (by simp only [CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) rw [← deriv_cF_Delta_zero, show cFDelta = UpperHalfPlane.cuspFunction 1 Delta from rfl] exact hana.differentiableAt.hasDerivAt @@ -117,16 +123,19 @@ lemma cF_Delta_hasDerivAt_zero : HasDerivAt cFDelta (1 : ℂ) 0 := by lemma cF_Delta_div_q_tendsto : Tendsto (fun q => cFDelta q / q) (𝓝[≠] 0) (nhds 1) := by have h0 : cFDelta 0 = 0 := CuspFormClass.cuspFunction_apply_zero Delta one_pos - (by simp) + (by simp only [CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) have hda := cF_Delta_hasDerivAt_zero rw [hasDerivAt_iff_tendsto_slope] at hda - convert hda using 1; ext q; simp [slope, h0, div_eq_mul_inv, mul_comm] + convert hda using 1; ext q; simp only [div_eq_mul_inv, slope, sub_zero, h0, vsub_eq_sub, + smul_eq_mul, mul_comm] /-- `deriv cFDelta` is continuous at 0. -/ lemma continuousAt_deriv_cF_Delta : ContinuousAt (deriv cFDelta) 0 := by rw [show cFDelta = UpperHalfPlane.cuspFunction 1 Delta from rfl] exact (ModularFormClass.analyticAt_cuspFunction_zero Delta one_pos - (by simp)).deriv.continuousAt + (by simp only [CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples])).deriv.continuousAt /-- `cF'(q) -> 1` as `q -> 0`. -/ lemma tendsto_deriv_cF_Delta : Tendsto (deriv cFDelta) (𝓝 0) (nhds 1) := by @@ -190,7 +199,7 @@ private lemma summable_two_mul_pnat_pow {r : ℝ} (hr : ‖r‖ < 1) : Summable (fun n : ℕ+ => 2 * (↑↑n : ℝ) * r ^ (n : ℕ)) := by change Summable ((fun m : ℕ => 2 * (↑m : ℝ) * r ^ m) ∘ (↑· : ℕ+ → ℕ)) exact (((summable_nat_mul_pow hr).mul_left 2).congr - (fun n => by ring)).comp_injective Subtype.val_injective + (fun n => by ac_rfl)).comp_injective Subtype.val_injective private lemma summable_norm_E2_terms {q : ℂ} (hq : ‖q‖ ≤ 1 / 2) : Summable (fun n : ℕ+ => ‖(↑↑n : ℂ) * q ^ (n : ℕ) / (1 - q ^ (n : ℕ))‖) := by @@ -209,7 +218,7 @@ private lemma tsum_succ_mul_pow {r : ℝ} (hr : ‖r‖ < 1) : private lemma tsum_two_mul_pnat_pow {r : ℝ} (hr : ‖r‖ < 1) : ∑' (n : ℕ+), 2 * (↑↑n : ℝ) * r ^ (n : ℕ) = 2 * (r / (1 - r) ^ 2) := by rw [show (fun n : ℕ+ => 2 * (↑↑n : ℝ) * r ^ (n : ℕ)) = - (fun n : ℕ+ => 2 * ((↑↑n : ℝ) * r ^ (n : ℕ))) from by ext n; ring, + (fun n : ℕ+ => 2 * ((↑↑n : ℝ) * r ^ (n : ℕ))) from by ext n; ac_rfl, tsum_mul_left, tsum_pnat_eq_r_times r, tsum_succ_mul_pow hr]; ring private lemma tsum_E2_series_bound {q : ℂ} (hq : ‖q‖ ≤ 1 / 2) : @@ -248,7 +257,8 @@ private lemma cuspFunction_sub_one_isBigO {f : ModularForm (CongruenceSubgroup.G (hval : UpperHalfPlane.cuspFunction 1 f 0 = 1) : (fun q : ℂ => UpperHalfPlane.cuspFunction 1 f q - 1) =O[𝓝 0] id := by have hbig := (ModularFormClass.analyticAt_cuspFunction_zero f one_pos - (by simp)).differentiableAt.hasFDerivAt.isBigO_sub + (by simp only [CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples])).differentiableAt.hasFDerivAt.isBigO_sub simpa only [hval, sub_zero, Function.id_def] using hbig /-- For a level-one modular form with constant q-term `1`, `‖f z - 1‖ ≤ C * ‖q(z)‖` @@ -261,7 +271,9 @@ private lemma form_sub_one_eventually_le {k : ℤ} obtain ⟨C, hC, hbound⟩ := (cuspFunction_sub_one_isBigO hval).exists_pos exact ⟨C, hC, (tendsto_qParam_atImInfty.eventually (hbound.bound.mono (fun q hq => by simpa [id] using hq))).mono fun z hz => by - rwa [(SlashInvariantFormClass.eq_cuspFunction f z (by simp) one_ne_zero).symm]⟩ + rwa [(SlashInvariantFormClass.eq_cuspFunction f z (by simp only [ + CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) one_ne_zero).symm]⟩ /-- `‖E₄ z - 1‖ ≤ C * ‖q(z)‖` eventually, for some `C > 0`. -/ private lemma E4_sub_one_eventually_le : ∃ C > 0, @@ -359,7 +371,8 @@ private lemma Delta_lower_bound : ∃ r > 0, ∀ z : UpperHalfPlane, set qz := Function.Periodic.qParam 1 (z : ℂ) have hDelta_eq : Δ z = cFDelta qz := by have := (SlashInvariantFormClass.eq_cuspFunction Delta z - (by simp) one_ne_zero).symm + (by simp only [CongruenceSubgroup.strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) one_ne_zero).symm simp only [cFDelta] at this ⊢; exact this rw [hDelta_eq] have hq_pos : 0 < ‖qz‖ := norm_pos_iff.mpr hqz_ne diff --git a/LeanPool/LeanModularForms/SpherePacking/ViazovskaMagicFunction.lean b/LeanPool/LeanModularForms/SpherePacking/ViazovskaMagicFunction.lean index 30b311e437..2726f12c33 100644 --- a/LeanPool/LeanModularForms/SpherePacking/ViazovskaMagicFunction.lean +++ b/LeanPool/LeanModularForms/SpherePacking/ViazovskaMagicFunction.lean @@ -221,12 +221,14 @@ alias isOpen_upperHalfPlaneSet := UpperHalfPlane.isOpen_upperHalfPlaneSet theorem convex_upperHalfPlaneSet : Convex ℝ {z : ℂ | 0 < z.im} := by intro x hx y hy a b ha hb hab change 0 < (a • x + b • y).im - have him : (a • x + b • y).im = a * x.im + b * y.im := by simp [Complex.add_im] + have him : (a • x + b • y).im = a * x.im + b * y.im := by simp only [real_smul, add_im, mul_im, + ofReal_re, ofReal_im, zero_mul, add_zero] rw [him] have hx' : (0 : ℝ) < x.im := hx have hy' : (0 : ℝ) < y.im := hy rcases eq_or_lt_of_le ha with rfl | ha' - · simp only [zero_add] at hab; subst hab; simp; linarith only [hy'] + · simp only [zero_add] at hab; subst hab; simp only [zero_mul, one_mul, zero_add, + gt_iff_lt]; linarith only [hy'] · linarith only [hb, hx', hy', ha', mul_pos ha' hx', mul_nonneg hb (le_of_lt hy')] /-! ## Holomorphicity of the integrand -/ @@ -234,7 +236,8 @@ theorem convex_upperHalfPlaneSet : Convex ℝ {z : ℂ | 0 < z.im} := by /-- When `Im(z) > 0`, the point `-1/(z+1)` also has positive imaginary part. -/ theorem neg_inv_add_one_im_pos {z : ℂ} (hz : 0 < z.im) : 0 < (-1 / (z + 1)).im := by have hne : z + 1 ≠ 0 := by - intro h; have := (Complex.ext_iff.mp h).2; simp at this; linarith only [hz, + intro h; have := (Complex.ext_iff.mp h).2; simp only [add_im, one_im, add_zero, + zero_im] at this; linarith only [hz, this] rw [neg_div, Complex.neg_im, Complex.div_im] rw [Complex.one_im, Complex.one_re, zero_mul, zero_div, one_mul, zero_sub, neg_neg] @@ -248,7 +251,8 @@ theorem viazovska_integrand_left_differentiableOn (r : ℝ) : unfold viazovskaIntegrandLeft have hz' : 0 < z.im := hz have hne : z + 1 ≠ 0 := by - intro h; have := (Complex.ext_iff.mp h).2; simp at this; linarith only [hz', + intro h; have := (Complex.ext_iff.mp h).2; simp only [add_im, one_im, add_zero, + zero_im] at this; linarith only [hz', this] have him := neg_inv_add_one_im_pos hz' have hφ : DifferentiableAt ℂ φ₀'' (-1 / (z + 1)) := @@ -346,7 +350,7 @@ theorem I12_eq_segment_integral (r : ℝ) : unfold I12; congr 1; ext t rw [deriv_contour_neg1_to_i] have h1 : contourNeg1ToI t = (-1 : ℂ) + ↑t • ((I : ℂ) - (-1)) := by - simp [contourNeg1ToI, Complex.real_smul, sub_neg_eq_add]; ring + simp only [contourNeg1ToI, sub_neg_eq_add, smul_add, real_smul, mul_one, add_right_inj]; ring rw [h1, show (1 : ℂ) + I = (I : ℂ) - (-1) from by ring] /-! ### Rectangular decomposition integrals -/ @@ -366,7 +370,7 @@ theorem I12_vert_eq_segment (r : ℝ) : ((-1 + I) - (-1 : ℂ)) := by simp only [I12Vert]; congr 1; ext t congr 1 - · congr 1; simp [Complex.real_smul]; ring + · congr 1; simp only [sub_neg_eq_add, neg_add_cancel_comm, real_smul, add_right_inj]; ac_rfl · ring /-- `I12Horiz` expressed as a segment integral from `-1+I` to `I`. -/ @@ -377,7 +381,7 @@ theorem I12_horiz_eq_segment (r : ℝ) : simp only [I12Horiz]; congr 1; ext t have h1 : (I : ℂ) - (-1 + I) = 1 := by ring rw [h1, mul_one] - congr 1; simp [Complex.real_smul] + congr 1; simp only [real_smul, mul_one] /-! ### Truncated contour equivalence @@ -391,10 +395,11 @@ theorem neg_one_add_delta_I_mem_uhp {δ : ℝ} (hδ : 0 < δ) : (-1 + ↑δ * I : ℂ) ∈ {z : ℂ | 0 < z.im} := by simpa using hδ /-- The point `-1 + I` lies in the upper half-plane. -/ -theorem neg_one_add_I_mem_uhp : (-1 + I : ℂ) ∈ {z : ℂ | 0 < z.im} := by simp +theorem neg_one_add_I_mem_uhp : (-1 + I : ℂ) ∈ {z : ℂ | 0 < z.im} := by simp only [mem_ofPred_eq, + add_im, neg_im, one_im, neg_zero, I_im, zero_add, zero_lt_one] /-- The point `I` lies in the upper half-plane. -/ -theorem I_mem_uhp : (I : ℂ) ∈ {z : ℂ | 0 < z.im} := by simp +theorem I_mem_uhp : (I : ℂ) ∈ {z : ℂ | 0 < z.im} := by simp only [mem_ofPred_eq, I_im, zero_lt_one] /-- Truncated contour equivalence: for `δ > 0`, the diagonal segment integral from `-1 + δI` to `I` equals the vertical from `-1 + δI` to `-1 + I` plus the @@ -434,11 +439,15 @@ Along the diagonal contour `t -> -1 + t(1+I)` and the vertical contour /-- The integrand at `contourNeg1ToI 0 = -1` equals zero, because `(z+1)^2 = 0`. -/ private theorem integrand_at_zero_diag (r : ℝ) : viazovskaIntegrandLeft r (contourNeg1ToI 0) * (1 + I) = 0 := by - simp [viazovskaIntegrandLeft, contourNeg1ToI] + simp only [viazovskaIntegrandLeft, contourNeg1ToI, ofReal_zero, mul_zero, add_zero, + neg_add_cancel, div_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, mul_neg, + mul_one, zero_mul] /-- The integrand at vertical contour parameter 0 equals zero. -/ private theorem integrand_at_zero_vert (r : ℝ) : - viazovskaIntegrandLeft r (-1 + I * (0 : ℝ)) * I = 0 := by simp [viazovskaIntegrandLeft] + viazovskaIntegrandLeft r (-1 + I * (0 : ℝ)) * I = 0 := by simp only [viazovskaIntegrandLeft, + ofReal_zero, mul_zero, add_zero, neg_add_cancel, div_zero, ne_eq, OfNat.ofNat_ne_zero, + not_false_eq_true, zero_pow, mul_neg, mul_one, zero_mul] /-- The diagonal contour point has positive imaginary part for `t > 0`. -/ private theorem contour_neg1_to_i_im_pos {t : ℝ} (ht : 0 < t) : @@ -473,7 +482,7 @@ the common sub-arguments into reusable helpers. -/ /-- Along the diagonal contour, `contourNeg1ToI t + 1 = (1+I) * t`. -/ private theorem diag_contour_add_one (t : ℝ) : - contourNeg1ToI t + 1 = (1 + I) * ↑t := by simp [contourNeg1ToI] + contourNeg1ToI t + 1 = (1 + I) * ↑t := by simp only [contourNeg1ToI, neg_add_cancel_comm] /-- Along the vertical contour, `(-1 + I*t) + 1 = I * t`. -/ private theorem vert_contour_add_one (t : ℝ) : @@ -563,7 +572,7 @@ private theorem phi0_bound_of_small_vert {t A : ℝ} (ht : 0 < t) (ht_lt : t < 1 rw [im_neg_inv_vert ht] have : max A 1 ≤ 1 / t := by rw [lt_div_iff₀ (by positivity : (0 : ℝ) < max A 1)] at ht_lt - rw [le_div_iff₀ (by positivity : (0 : ℝ) < t)]; linarith only [ht_lt] + rw [le_div_iff₀ (by exact ht : (0 : ℝ) < t)]; linarith only [ht_lt] linarith only [this, le_max_left A 1] /-- The integrand norm along the diagonal is bounded by `C * t^2` for small `t > 0`. -/ @@ -836,7 +845,7 @@ private theorem ftc_tail_diag (r : ℝ) (G : ℂ → ℂ) · exact lt_of_lt_of_le zero_lt_one h2 exact ((@HasDerivAt.scomp ℝ _ ℂ _ _ t ℂ _ _ _ IsScalarTower.right _ _ _ _ (hG _ (contour_neg1_to_i_im_pos ht_pos)) - (hasDerivAt_contour_neg1_to_i t))).congr_deriv (by simp [smul_eq_mul]; ring) + (hasDerivAt_contour_neg1_to_i t))).congr_deriv (by simp only [smul_eq_mul]; ac_rfl) have h := intervalIntegral.integral_eq_sub_of_hasDerivAt hGdiag ((hcont.mono (fun x hx => ⟨by linarith only [hδ, hx, hx.1], hx.2⟩)).intervalIntegrable_of_Icc (by linarith only [hδ1])) @@ -859,7 +868,7 @@ private theorem ftc_tail_vert (r : ℝ) (G : ℂ → ℂ) · exact lt_of_lt_of_le zero_lt_one h2 exact ((@HasDerivAt.scomp ℝ _ ℂ _ _ t ℂ _ _ _ IsScalarTower.right _ _ _ _ (hG _ (vertical_contour_im_pos ht_pos)) - (hasDerivAt_vert_contour t))).congr_deriv (by simp [smul_eq_mul]; ring) + (hasDerivAt_vert_contour t))).congr_deriv (by simp only [smul_eq_mul]; ac_rfl) exact intervalIntegral.integral_eq_sub_of_hasDerivAt hGvert ((hcont.mono (fun x hx => ⟨by linarith only [hδ, hx, hx.1], hx.2⟩)).intervalIntegrable_of_Icc (by linarith only [hδ1])) @@ -878,13 +887,14 @@ private theorem D_eq_three_terms (r : ℝ) (G : ℂ → ℂ) have hsd := I12_split_at_delta r δ hδ.le hδ1 hcont_diag have hsv := I12_vert_split_at_delta r δ hδ.le hδ1 hcont_vert have htd := ftc_tail_diag r G hG δ hδ hδ1 - have hc1 : contourNeg1ToI 1 = I := by simp [contourNeg1ToI] + have hc1 : contourNeg1ToI 1 = I := by simp only [contourNeg1ToI, ofReal_one, mul_one, + neg_add_cancel_left] rw [hc1] at htd have htv := ftc_tail_vert r G hG δ hδ hδ1 - have hv1 : (-1 : ℂ) + I * (1 : ℝ) = -1 + I := by push_cast; ring + have hv1 : (-1 : ℂ) + I * (1 : ℝ) = -1 + I := by push_cast; ac_rfl rw [hv1] at htv have hhoriz := horizontal_eq_primitive_sub r G hG - have hcomm : (-1 : ℂ) + ↑δ * I = -1 + I * ↑δ := by ring + have hcomm : (-1 : ℂ) + ↑δ * I = -1 + I * ↑δ := by ac_rfl rw [hcomm] linear_combination hsd + htd - hsv - htv - hhoriz @@ -908,12 +918,12 @@ private theorem head_integral_tendsto_zero {f : ℝ → ℂ} apply intervalIntegral.norm_integral_le_of_norm_le_const intro t ht; rcases Set.mem_uIoc.mp ht with ⟨h1, h2⟩ | ⟨h1, h2⟩ · exact (hC t ⟨by linarith, by linarith [lt_of_lt_of_le hball (min_le_right _ _)]⟩).trans - (by linarith) - · linarith + (by linarith only []) + · linarith only [hδ_pos, h1, h2] _ < (C + 1) * (ε / (C + 1)) := by rw [sub_zero, abs_of_pos hδ_pos] exact mul_lt_mul_of_pos_left - (lt_of_lt_of_le hball (min_le_left _ _)) (by linarith) + (lt_of_lt_of_le hball (min_le_left _ _)) (by linarith only [hC_nn]) _ = ε := by field_simp /-- The norm of the integrand on the connecting segment from `-1+delta(1+I)` to @@ -1035,7 +1045,7 @@ private theorem G_diff_tendsto_zero (r : ℝ) (G : ℂ → ℂ) have hδ1 : δ ≤ 1 := le_of_lt (lt_of_lt_of_le hball_δ (min_le_right _ _ |>.trans (min_le_right _ _))) -- Express G-diff as segment integral via FTC - have hcδ : contourNeg1ToI δ = -1 + ↑δ * ((1 : ℂ) + I) := by simp [contourNeg1ToI]; ring + have hcδ : contourNeg1ToI δ = -1 + ↑δ * ((1 : ℂ) + I) := by simp [contourNeg1ToI]; ac_rfl rw [dist_zero_right, hcδ] set a : ℂ := -1 + ↑δ * ((1 : ℂ) + I) set dir : ℂ := -(↑δ : ℂ) @@ -1044,7 +1054,7 @@ private theorem G_diff_tendsto_zero (r : ℝ) (G : ℂ → ℂ) Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, Complex.add_re, Complex.one_re, Complex.I_re, Complex.I_im]; nlinarith only [hδ_pos] have hb_uhp := neg_one_add_delta_I_mem_uhp hδ_pos - have hdir_eq : (-1 + ↑δ * I : ℂ) - a = dir := by simp [a, dir]; ring + have hdir_eq : (-1 + ↑δ * I : ℂ) - a = dir := by simp only [add_sub_add_left_eq_sub, a, dir]; ring have hG_seg : G (-1 + ↑δ * I) - G a = ∫ t in (0 : ℝ)..1, viazovskaIntegrandLeft r (a + ↑t • dir) * dir := by rw [show dir = (-1 + ↑δ * I : ℂ) - a from hdir_eq.symm] @@ -1056,11 +1066,11 @@ private theorem G_diff_tendsto_zero (r : ℝ) (G : ℂ → ℂ) ‖viazovskaIntegrandLeft r (a + ↑t • dir) * dir‖ ≤ δ := by intro t ht rcases Set.mem_uIoc.mp ht with ⟨ht1, ht2⟩ | ⟨ht1, ht2⟩ - swap; · linarith + swap; · linarith only [ht1, ht2] exact segment_integrand_norm_bound r hδ_pos hδ1 hMA hM_nn hδ_lt_A hδ_lt_sqrt ht1 ht2 have hbound := intervalIntegral.norm_integral_le_of_norm_le_const hpt_bound simp only [sub_zero, abs_one, mul_one] at hbound - linarith + linarith only [hδ_lt_ε, hbound] /-- **Full contour equivalence**: the diagonal integral `I12` from `-1` to `I` equals the sum of the vertical integral `I12Vert` (from `-1` to `-1+I`) diff --git a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Basic.lean b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Basic.lean index 2a85c1e81c..0296558591 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Basic.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Basic.lean @@ -120,7 +120,8 @@ lemma fdBoundary_at_three : rw [h, exp_mul_I, ← ofReal_cos, ← ofReal_sin, show (2 * Real.pi / 3 : ℝ) = Real.pi - Real.pi / 3 by ring, Real.cos_pi_sub, Real.cos_pi_div_three, Real.sin_pi_sub, Real.sin_pi_div_three] - simp [ellipticPointRho, ellipticPointRho', UpperHalfPlane.coe_mk] + simp only [one_div, ofReal_neg, ofReal_inv, ofReal_ofNat, ofReal_div, ellipticPointRho, + ellipticPointRho', UpperHalfPlane.coe_mk, add_left_inj] ring lemma fdBoundary_at_four : @@ -221,7 +222,8 @@ lemma fdBoundary_H_at_three (H : ℝ) : rw [h, exp_mul_I, ← ofReal_cos, ← ofReal_sin, show (2 * Real.pi / 3 : ℝ) = Real.pi - Real.pi / 3 by ring, Real.cos_pi_sub, Real.cos_pi_div_three, Real.sin_pi_sub, Real.sin_pi_div_three] - simp [ellipticPointRho, ellipticPointRho', UpperHalfPlane.coe_mk] + simp only [one_div, ofReal_neg, ofReal_inv, ofReal_ofNat, ofReal_div, ellipticPointRho, + ellipticPointRho', UpperHalfPlane.coe_mk, add_left_inj] ring lemma fdBoundary_H_at_four (H : ℝ) : diff --git a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Bounds.lean b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Bounds.lean index 2cd67b58b9..b704f0aa0c 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Bounds.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Bounds.lean @@ -68,8 +68,8 @@ private lemma seg2_angle_in_range {t : ℝ} (ht1 : 1 ≤ t) (ht2 : t ≤ 2) : · nlinarith only [ht1, hpi, mul_nonneg (show (0 : ℝ) ≤ t - 1 by linarith) (show (0 : ℝ) ≤ Real.pi / 6 by linarith)] · nlinarith only [ht2, hpi, - mul_le_mul_of_nonneg_right (show t - 1 ≤ 1 by linarith) - (show (0 : ℝ) ≤ Real.pi / 6 by linarith)] + mul_le_mul_of_nonneg_right (show t - 1 ≤ 1 by linarith only [ht2]) + (show (0 : ℝ) ≤ Real.pi / 6 by linarith only [hpi])] private lemma seg3_angle_in_range {t : ℝ} (ht2 : 2 ≤ t) (ht3 : t ≤ 3) : Real.pi / 3 ≤ Real.pi / 2 + (t - 2) * (2 * Real.pi / 3 - Real.pi / 2) ∧ @@ -79,8 +79,8 @@ private lemma seg3_angle_in_range {t : ℝ} (ht2 : 2 ≤ t) (ht3 : t ≤ 3) : constructor · nlinarith only [hpi, h_nonneg] · nlinarith only [ht3, hpi, - mul_le_mul_of_nonneg_right (show t - 2 ≤ 1 by linarith) - (show (0 : ℝ) ≤ Real.pi / 6 by linarith)] + mul_le_mul_of_nonneg_right (show t - 2 ≤ 1 by linarith only [ht3]) + (show (0 : ℝ) ≤ Real.pi / 6 by linarith only [hpi])] private lemma sin_pos_of_angle_in_range {θ : ℝ} (h1 : Real.pi / 3 ≤ θ) (h2 : θ ≤ 2 * Real.pi / 3) : 0 < Real.sin θ := @@ -113,14 +113,15 @@ private lemma seg4_H_im {H t : ℝ} : simp [fdBoundarySeg4H, add_im, ofReal_im, mul_im, I_re, I_im] private lemma seg5_H_im {H t : ℝ} : (fdBoundarySeg5H H t).im = H := by - simp [fdBoundarySeg5H, add_im, ofReal_im, mul_im, I_re, I_im] + simp only [fdBoundarySeg5H, add_im, sub_im, ofReal_im, div_ofNat_im, im_ofNat, zero_div, sub_self, + mul_im, ofReal_re, I_im, mul_one, I_re, mul_zero, add_zero, zero_add] private lemma seg2_as_trig (t : ℝ) : fdBoundarySeg2 t = ↑(Real.cos (Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3))) + ↑(Real.sin (Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3))) * I := by unfold fdBoundarySeg2 conv_lhs => rw [show (↑Real.pi / 3 + (↑t - 1) * (↑Real.pi / 2 - ↑Real.pi / 3) : ℂ) * I = - ↑(Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3)) * I from by push_cast; ring] + ↑(Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3)) * I from by push_cast; ac_rfl] rw [exp_mul_I, ← ofReal_cos, ← ofReal_sin] private lemma seg3_as_trig (t : ℝ) : @@ -130,7 +131,7 @@ private lemma seg3_as_trig (t : ℝ) : conv_lhs => rw [show (↑Real.pi / 2 + (↑t - 2) * (2 * ↑Real.pi / 3 - ↑Real.pi / 2) : ℂ) * I = - ↑(Real.pi / 2 + (t - 2) * (2 * Real.pi / 3 - Real.pi / 2)) * I from by push_cast; ring] + ↑(Real.pi / 2 + (t - 2) * (2 * Real.pi / 3 - Real.pi / 2)) * I from by push_cast; ac_rfl] rw [exp_mul_I, ← ofReal_cos, ← ofReal_sin] private lemma seg2_im {t : ℝ} : @@ -161,7 +162,7 @@ lemma fdBoundary_H_im_pos (H : ℝ) have hsqrt : 0 < Real.sqrt 3 / 2 := by positivity by_cases h1 : t ≤ 1 · rw [fdBoundary_H_eq_seg1_H h1, seg1_H_im ht0 h1] - nlinarith + nlinarith only [hH, hsqrt, h1] · push Not at h1 by_cases h2 : t ≤ 2 · rw [fdBoundary_H_eq_seg2_H H h1 h2, fdBoundarySeg2H, seg2_im] @@ -174,9 +175,9 @@ lemma fdBoundary_H_im_pos (H : ℝ) (seg3_angle_in_range (le_of_lt h2) h3).2 · push Not at h3 by_cases h4 : t ≤ 4 - · rw [fdBoundary_H_eq_seg4_H h3 h4, seg4_H_im]; nlinarith + · rw [fdBoundary_H_eq_seg4_H h3 h4, seg4_H_im]; nlinarith only [hH, hsqrt, h3] · push Not at h4 - rw [fdBoundary_H_eq_seg5_H h4, seg5_H_im]; linarith + rw [fdBoundary_H_eq_seg5_H h4, seg5_H_im]; linarith only [hH, hsqrt] lemma fdBoundary_H_im_ge_sqrt3_div_2 (H : ℝ) (hH : Real.sqrt 3 / 2 ≤ H) : @@ -185,7 +186,7 @@ lemma fdBoundary_H_im_ge_sqrt3_div_2 (H : ℝ) intro t ⟨ht0, ht5⟩ by_cases h1 : t ≤ 1 · rw [fdBoundary_H_eq_seg1_H h1, seg1_H_im ht0 h1] - nlinarith + nlinarith only [hH, h1] · push Not at h1 by_cases h2 : t ≤ 2 · rw [fdBoundary_H_eq_seg2_H H h1 h2, fdBoundarySeg2H, seg2_im] @@ -199,7 +200,7 @@ lemma fdBoundary_H_im_ge_sqrt3_div_2 (H : ℝ) · push Not at h3 by_cases h4 : t ≤ 4 · rw [fdBoundary_H_eq_seg4_H h3 h4, seg4_H_im] - nlinarith + nlinarith only [hH, h3] · push Not at h4 rw [fdBoundary_H_eq_seg5_H h4, seg5_H_im]; exact hH @@ -210,7 +211,8 @@ private lemma seg4_H_re {H t : ℝ} : (fdBoundarySeg4H H t).re = -1 / 2 := by simp [fdBoundarySeg4H, add_re, ofReal_re, mul_re, I_re, I_im, ofReal_im] private lemma seg5_H_re {H t : ℝ} : (fdBoundarySeg5H H t).re = t - 9 / 2 := by - simp [fdBoundarySeg5H, add_re, ofReal_re, mul_re, I_re, I_im, ofReal_im] + simp only [fdBoundarySeg5H, add_re, sub_re, ofReal_re, div_ofNat_re, re_ofNat, mul_re, I_re, + mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero] lemma fdBoundary_H_re_abs_le_half (H : ℝ) : ∀ t ∈ Icc (0 : ℝ) 5, @@ -276,7 +278,7 @@ lemma fdBoundary_H_im_le_H {H : ℝ} (hH : 1 ≤ H) : intro t ⟨ht0, ht5⟩ have hH_sqrt3 : Real.sqrt 3 / 2 < H := by nlinarith [Real.sq_sqrt (show (0 : ℝ) ≤ 3 by norm_num)] by_cases h1 : t ≤ 1 - · rw [fdBoundary_H_eq_seg1_H h1, seg1_H_im ht0 h1]; nlinarith + · rw [fdBoundary_H_eq_seg1_H h1, seg1_H_im ht0 h1]; nlinarith only [ht0, hH_sqrt3] · push Not at h1 by_cases h2 : t ≤ 2 · rw [fdBoundary_H_eq_seg2_H H h1 h2, fdBoundarySeg2H, seg2_im] @@ -288,7 +290,7 @@ lemma fdBoundary_H_im_le_H {H : ℝ} (hH : 1 ≤ H) : (Real.pi / 2 + (t - 2) * (2 * Real.pi / 3 - Real.pi / 2))] · push Not at h3 by_cases h4 : t ≤ 4 - · rw [fdBoundary_H_eq_seg4_H h3 h4, seg4_H_im]; nlinarith + · rw [fdBoundary_H_eq_seg4_H h3 h4, seg4_H_im]; nlinarith only [hH_sqrt3, h4] · push Not at h4 rw [fdBoundary_H_eq_seg5_H h4, seg5_H_im] diff --git a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Smooth.lean b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Smooth.lean index 88a9f8e81a..fbe264ac22 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Smooth.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Smooth.lean @@ -115,7 +115,7 @@ lemma fdBoundary_H_differentiableAt_off_partition filter_upwards [Ioi_mem_nhds (lt_of_le_of_ne (not_lt.mp h4) (Ne.symm ht4))] with s (hs4 : 4 < s) simp only [fdBoundaryH, show ¬s ≤ 1 from by linarith, show ¬s ≤ 2 from by linarith, - show ¬s ≤ 3 from by linarith, show ¬s ≤ 4 from by linarith, ite_false] + show ¬s ≤ 3 from by linarith only [hs4], show ¬s ≤ 4 from by linarith, ite_false] exact (DifferentiableAt.add (Complex.ofRealCLM.differentiable.differentiableAt |>.sub (differentiableAt_const _)) (differentiableAt_const _)).congr_of_eventuallyEq heq @@ -149,9 +149,9 @@ lemma fdBoundary_H_hasDerivAt_seg4' (H : ℝ) (t : ℝ) have heq : fdBoundaryH H =ᶠ[𝓝 t] fun s : ℝ => (-1 : ℂ) / 2 + (↑(Real.sqrt 3) / 2 + (↑s - 3) * (↑H - ↑(Real.sqrt 3) / 2)) * I := by filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s ⟨hs1, hs2⟩ - simp only [fdBoundaryH, show ¬s ≤ 1 from by linarith, - show ¬s ≤ 2 from by linarith, show ¬s ≤ 3 from by linarith, - show s ≤ 4 from by linarith, ite_true, ite_false] + simp only [fdBoundaryH, show ¬s ≤ 1 from by linarith only [hs1, hs2], + show ¬s ≤ 2 from by linarith only [hs1, hs2], show ¬s ≤ 3 from by linarith only [hs1], + show s ≤ 4 from by exact le_of_lt hs2, ite_true, ite_false] have hd : HasDerivAt (fun s : ℝ => (-1 : ℂ) / 2 + (↑(Real.sqrt 3) / 2 + (↑s - 3) * (↑H - ↑(Real.sqrt 3) / 2)) * I) ((↑H - ↑(Real.sqrt 3) / 2) * I) t := by @@ -167,7 +167,7 @@ lemma fdBoundary_H_hasDerivAt_seg4' (H : ℝ) (t : ℝ) have h_timesI : HasDerivAt (fun s : ℝ => (↑(Real.sqrt 3) / 2 + ((↑s : ℂ) - 3) * (↑H - ↑(Real.sqrt 3) / 2)) * I) ((0 + 1 * (↑H - ↑(Real.sqrt 3) / 2)) * I) t := h_shifted.mul_const _ - simp_all + simp_all only [mem_Ioo, hasDerivAt_sub_const_iff, one_mul, zero_add, hasDerivAt_const_add_iff] exact hd.congr_of_eventuallyEq heq private lemma hasDerivAt_seg5_fun (H : ℝ) (t : ℝ) : @@ -181,9 +181,9 @@ lemma fdBoundary_H_hasDerivAt_seg5' (H : ℝ) (t : ℝ) HasDerivAt (fdBoundaryH H) 1 t := by have heq : fdBoundaryH H =ᶠ[𝓝 t] fun s : ℝ => (↑s - 9/2 : ℂ) + ↑H * I := by filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s ⟨hs1, hs2⟩ - simp only [fdBoundaryH, show ¬s ≤ 1 from by linarith, - show ¬s ≤ 2 from by linarith, show ¬s ≤ 3 from by linarith, - show ¬s ≤ 4 from by linarith, ite_false] + simp only [fdBoundaryH, show ¬s ≤ 1 from by linarith only [hs1, hs2], + show ¬s ≤ 2 from by linarith only [hs1, hs2], show ¬s ≤ 3 from by linarith only [hs1, hs2], + show ¬s ≤ 4 from by linarith only [hs1], ite_false] exact (hasDerivAt_seg5_fun H t).congr_of_eventuallyEq heq lemma fdBoundary_H_deriv_ne_zero_off_fullPartition @@ -201,7 +201,7 @@ lemma fdBoundary_H_deriv_ne_zero_off_fullPartition rw [show deriv (fdBoundaryH H) t = _ from hd.deriv] simp only [neg_mul, ne_eq, neg_eq_zero, mul_eq_zero, sub_eq_zero, I_ne_zero, or_false] intro h; apply_fun Complex.re at h - simp [ofReal_re] at h; linarith + simp only [ofReal_re, div_ofNat_re] at h; linarith only [hH, h] · push Not at h1 have h1' : 1 < t := lt_of_le_of_ne h1 (Ne.symm ht1) by_cases h3 : t < 3 @@ -216,7 +216,7 @@ lemma fdBoundary_H_deriv_ne_zero_off_fullPartition rw [show deriv (fdBoundaryH H) t = _ from hd.deriv] simp only [ne_eq, mul_eq_zero, sub_eq_zero, I_ne_zero, or_false] intro h; apply_fun Complex.re at h - simp [ofReal_re] at h; linarith + simp only [ofReal_re, div_ofNat_re] at h; linarith only [hH, h] · push Not at h4 have hd := (fdBoundary_H_hasDerivAt_seg5' H t ⟨lt_of_le_of_ne h4 (Ne.symm ht4), ht'.2⟩) @@ -305,7 +305,7 @@ lemma fdBoundary_H_left_deriv_limit (H : ℝ) (𝓝 L) := by simp only [fdBoundaryFullPartition, Finset.mem_insert, Finset.mem_singleton] at hp rcases hp with rfl | rfl | rfl | rfl | rfl | rfl - · linarith + · linarith only [hp'] · refine ⟨-(↑H - ↑(Real.sqrt 3) / 2) * I, ?_, ?_⟩ · rw [neg_mul]; exact neg_ne_zero.mpr (seg_vertical_deriv_ne_zero hH) · exact tendsto_of_eventually_const_left (show (0 : ℝ) < 1 from by norm_num) @@ -466,8 +466,8 @@ lemma fdBoundary_H_not_differentiableAt_3 {H : ℝ} (_hH : Real.sqrt 3 / 2 < H) ((arc_hasDerivAt 3).hasDerivWithinAt.congr_deriv (by have h1 : (↑Real.pi * (↑(3 : ℝ) + 1) / 6 : ℂ) * I = ↑(Real.pi * 4 / 6) * I := by congr 1; push_cast; ring - have h2 : (↑Real.pi / 6 : ℂ) = ↑(Real.pi / 6) := by push_cast; ring - rw [h1, h2]; ring)) + have h2 : (↑Real.pi / 6 : ℂ) = ↑(Real.pi / 6) := by push_cast; ac_rfl + rw [h1, h2]; ac_rfl)) have hright : HasDerivWithinAt (fdBoundaryH H) ((↑(H - Real.sqrt 3 / 2) : ℂ) * I) (Ici 3) 3 := ((seg4_eventuallyEq_right_3 H).hasDerivWithinAt_iff hval_seg4).mp @@ -478,7 +478,9 @@ lemma fdBoundary_H_not_differentiableAt_3 {H : ℝ} (_hH : Real.sqrt 3 / 2 < H) have heq : ↑(Real.pi / 6) * I * exp (↑(Real.pi * 4 / 6) * I) = (↑(H - Real.sqrt 3 / 2) : ℂ) * I := eq1.trans eq2.symm have hre := congr_arg Complex.re heq - have hre_rhs : ((↑(H - Real.sqrt 3 / 2) : ℂ) * I).re = 0 := by simp [mul_re] + have hre_rhs : ((↑(H - Real.sqrt 3 / 2) : ℂ) * I).re = 0 := by simp only [ofReal_sub, ofReal_div, + ofReal_ofNat, mul_re, sub_re, ofReal_re, div_ofNat_re, I_re, mul_zero, sub_im, ofReal_im, + div_ofNat_im, zero_div, sub_self, I_im, mul_one] have hre_lhs : (↑(Real.pi / 6) * I * exp (↑(Real.pi * 4 / 6) * I)).re = -(Real.pi / 6) * Real.sin (Real.pi * 4 / 6) := by rw [mul_assoc, mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero, @@ -530,15 +532,17 @@ lemma fdBoundary_H_not_differentiableAt_1 {H : ℝ} (_hH : Real.sqrt 3 / 2 < H) ((arc_hasDerivAt 1).hasDerivWithinAt.congr_deriv (by have h1 : (↑Real.pi * (↑(1 : ℝ) + 1) / 6) * I = ↑(Real.pi * 2 / 6) * I := by congr 1; push_cast; ring - have h2 : (↑Real.pi / 6 : ℂ) = ↑(Real.pi / 6) := by push_cast; ring - rw [h1, h2]; ring)) + have h2 : (↑Real.pi / 6 : ℂ) = ↑(Real.pi / 6) := by push_cast; ac_rfl + rw [h1, h2]; ac_rfl)) have hd := hdiff.hasDerivAt have heq : -(↑(H - Real.sqrt 3 / 2) : ℂ) * I = ↑(Real.pi / 6) * I * exp (↑(Real.pi * 2 / 6) * I) := ((uniqueDiffWithinAt_Iic (1 : ℝ)).eq_deriv _ hleft hd.hasDerivWithinAt).trans ((uniqueDiffWithinAt_Ici (1 : ℝ)).eq_deriv _ hright hd.hasDerivWithinAt).symm have hre := congr_arg Complex.re heq - have hre_lhs : (-(↑(H - Real.sqrt 3 / 2) : ℂ) * I).re = 0 := by simp [mul_re] + have hre_lhs : (-(↑(H - Real.sqrt 3 / 2) : ℂ) * I).re = 0 := by simp only [ofReal_sub, ofReal_div, + ofReal_ofNat, neg_sub, mul_re, sub_re, div_ofNat_re, ofReal_re, I_re, mul_zero, sub_im, + div_ofNat_im, ofReal_im, zero_div, sub_self, I_im, mul_one] have hre_rhs : (↑(Real.pi / 6) * I * exp (↑(Real.pi * 2 / 6) * I)).re = -(Real.pi / 6) * Real.sin (Real.pi * 2 / 6) := by rw [mul_assoc, mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero, @@ -571,7 +575,7 @@ lemma fdBoundary_H_right_deriv_limit (H : ℝ) · exact ⟨1, one_ne_zero, tendsto_of_eventually_const_right (show (4 : ℝ) < 5 from by norm_num) (fun s hs => (fdBoundary_H_hasDerivAt_seg5' H s hs).deriv)⟩ - · linarith + · linarith only [hp'] /-- The H-parameterized boundary as a `PiecewiseC1Curve`. -/ noncomputable def fdBoundaryHCurve (H : ℝ) : @@ -720,9 +724,9 @@ private lemma notMem_fullPartition_of_lt {t : ℝ} (h0 : 0 < t) (h1 : t ≠ 1) ( lemma fdBoundary_H_deriv_continuousOn_Ioo_01 (H : ℝ) : ContinuousOn (deriv (fdBoundaryH H)) (Ioo 0 1) := by intro t ⟨h0, h1⟩ - exact (fdBoundary_H_deriv_continuousAt_off_fullPartition H t ⟨h0, by linarith⟩ - (notMem_fullPartition_of_lt h0 (by linarith) (by linarith) (by linarith) - (by linarith) (by linarith))).continuousWithinAt + exact (fdBoundary_H_deriv_continuousAt_off_fullPartition H t ⟨h0, by linarith only [h0, h1]⟩ + (notMem_fullPartition_of_lt h0 (by exact ne_of_lt h1) (by linarith only [h0, h1]) (by linarith) + (by linarith only [h0, h1]) (by linarith only [h0, h1]))).continuousWithinAt lemma fdBoundary_H_deriv_continuousOn_Ioo_13 (H : ℝ) : ContinuousOn (deriv (fdBoundaryH H)) (Ioo 1 3) := by @@ -758,7 +762,7 @@ lemma fdBoundary_H_deriv_continuousOn_Ioo_45 (H : ℝ) : private lemma norm_cast_sub_eq {H : ℝ} (hH : Real.sqrt 3 / 2 < H) : ‖(↑H - ↑(Real.sqrt 3) / 2 : ℂ)‖ = H - Real.sqrt 3 / 2 := by - have hcast : (↑H - ↑(Real.sqrt 3) / 2 : ℂ) = ↑(H - Real.sqrt 3 / 2) := by push_cast; ring + have hcast : (↑H - ↑(Real.sqrt 3) / 2 : ℂ) = ↑(H - Real.sqrt 3 / 2) := by push_cast; ac_rfl rw [hcast, Complex.norm_real, Real.norm_of_nonneg (by linarith only [hH])] lemma fdBoundary_H_deriv_bound_ex {H : ℝ} @@ -783,12 +787,12 @@ lemma fdBoundary_H_deriv_bound_ex {H : ℝ} simp only [norm_mul, Complex.norm_I, mul_one] have hexp : ‖exp ((↑Real.pi * (↑t + 1) / 6) * I)‖ = 1 := by rw [show (↑Real.pi * (↑t + 1) / 6 : ℂ) * I = - ↑(Real.pi * (t + 1) / 6) * I from by push_cast; ring] + ↑(Real.pi * (t + 1) / 6) * I from by push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ rw [hexp, one_mul] have hpi : ‖(↑Real.pi / 6 : ℂ)‖ = Real.pi / 6 := by rw [show (↑Real.pi / 6 : ℂ) = ↑(Real.pi / 6) from by - push_cast; ring, + push_cast; ac_rfl, Complex.norm_real, Real.norm_of_nonneg (by positivity)] rw [hpi] exact le_max_of_le_right (by linarith only [Real.pi_le_four]) diff --git a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/LeftEdge.lean b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/LeftEdge.lean index 5bbbae64d7..c4dfa9de6a 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/LeftEdge.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/LeftEdge.lean @@ -7,6 +7,7 @@ module public import LeanPool.LeanModularForms.GeneralizedResidueTheory.Basic public import LeanPool.LeanModularForms.ValenceFormula.Boundary.Basic +import LeanPool.LeanModularForms.GeneralizedResidueTheory.LogDerivFTC import LeanPool.LeanModularForms.ContourIntegral.CrossingLimit import LeanPool.LeanModularForms.ContourIntegral.WindingNumber import LeanPool.LeanModularForms.ValenceFormula.Boundary.Smooth @@ -15,7 +16,6 @@ import LeanPool.LeanModularForms.ValenceFormula.TrigLemmas import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Generalized Winding Number at Left Edge Points @@ -39,7 +39,7 @@ private lemma leftEdge_t₀_mem_Ioo (H : ℝ) (_hH_sqrt : Real.sqrt 3 / 2 < H) ( have hα_pos : 0 < H - Real.sqrt 3 / 2 := by linarith only [hs_im_lower, hs_im] constructor · linarith only [hs_im_lower, hα_pos, - div_pos (by linarith : (0 : ℝ) < s.im - Real.sqrt 3 / 2) hα_pos] + div_pos (by exact sub_pos.mpr hs_im_lower : (0 : ℝ) < s.im - Real.sqrt 3 / 2) hα_pos] · have : (s.im - Real.sqrt 3 / 2) / (H - Real.sqrt 3 / 2) < 1 := (div_lt_one hα_pos).mpr (by linarith only [hs_im]) linarith only [this] @@ -55,7 +55,7 @@ private lemma leftEdge_h₃_eq {H : ℝ} {s : ℂ} (hs_re : s.re = -1 / 2) (t : private lemma leftEdge_dist_from_rightVertical (s : ℂ) (hs_re : s.re = -1 / 2) (z : ℂ) (hz_re : z.re = 1 / 2) : 1 ≤ ‖z - s‖ := by - have hre : (z - s).re = 1 := by simp [Complex.sub_re, hz_re, hs_re]; ring + have hre : (z - s).re = 1 := by simp only [sub_re, hz_re, one_div, hs_re]; ring calc 1 = |(z - s).re| := by rw [hre]; norm_num _ ≤ ‖z - s‖ := abs_re_le_norm (z - s) @@ -81,14 +81,14 @@ private lemma leftEdge_min_dist_from_non_seg4 (H : ℝ) (s : ℂ) (hs_re : s.re · rw [fdBoundary_H_eq_seg2_H H h1 h2] simp only [fdBoundarySeg2H, fdBoundarySeg2] rw [show (↑Real.pi / 3 + (↑t - 1) * (↑Real.pi / 2 - ↑Real.pi / 3)) * I = - ↑(Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3)) * I from by push_cast; ring] + ↑(Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3)) * I from by push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ · push Not at h2 rw [fdBoundary_H_eq_seg3_H H h2 h3] simp only [fdBoundarySeg3H, fdBoundarySeg3] rw [show (↑Real.pi / 2 + (↑t - 2) * (2 * ↑Real.pi / 3 - ↑Real.pi / 2)) * I = ↑(Real.pi / 2 + (t - 2) * (2 * Real.pi / 3 - Real.pi / 2)) * I - from by push_cast; ring] + from by push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ calc d ≤ ‖s‖ - 1 := le_trans (min_le_left _ _) (min_le_left _ _) _ ≤ _ := rightEdge_dist_from_arc s _ h_on_arc @@ -214,12 +214,12 @@ private lemma leftEdge_slit_seg5 (H : ℝ) (s : ℂ) (hs_re : s.re = -1 / 2) subst ht4_eq simp [Complex.sub_im, Complex.add_im, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, Complex.I_re, Complex.I_im] - linarith + linarith only [hs_im] · left have : 4 < t := lt_of_le_of_ne ht4 (Ne.symm ht4_eq) simp only [sub_re, add_re, ofReal_re, div_ofNat_re, re_ofNat, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, sub_pos, gt_iff_lt] - rw [hs_re]; linarith + rw [hs_re]; linarith only [this] private lemma leftEdge_norm_gt_of_seg4_left (H : ℝ) (s : ℂ) (hs_re : s.re = -1 / 2) (α : ℝ) (hα_pos : 0 < α) (hα_def : α = H - Real.sqrt 3 / 2) @@ -279,7 +279,7 @@ private lemma mem_Ioo_of_uIoc_sdiff_endpoints {a b t : ℝ} (hab : a ≤ b) refine ⟨?_, ?_⟩ · simp_all · rcases eq_or_lt_of_le ht_mem.2 with h | h - · exact absurd (by simp only [mem_insert_iff, mem_singleton_iff]; right; linarith) ht_ne + · exact absurd (by simp only [mem_insert_iff, mem_singleton_iff]; right; exact h) ht_ne · exact h private lemma ae_endpoints_compl (a b : ℝ) : ({a, b} : Set ℝ)ᶜ ∈ ae volume := @@ -480,7 +480,7 @@ private lemma leftEdge_ftc_telescope (H : ℝ) (_hH_sqrt : Real.sqrt 3 / 2 < H) hasDerivAt_arc_rep s have hd₃ : ∀ t : ℝ, HasDerivAt h₃ ((↑α : ℂ) * I) t := fun t => (hasDerivAt_fdBoundary_seg4_H H t).sub (hasDerivAt_const t s) - |>.congr_deriv (by simp [hα_def]) + |>.congr_deriv (by simp only [ofReal_sub, ofReal_div, ofReal_ofNat, sub_zero, hα_def]) have hd₅ : ∀ t : ℝ, HasDerivAt h₅ 1 t := fun t => (hasDerivAt_fdBoundary_seg5_H H t).sub (hasDerivAt_const t s) |>.congr_deriv (by simp only [sub_zero]) @@ -553,23 +553,25 @@ private lemma leftEdge_ftc_telescope (H : ℝ) (_hH_sqrt : Real.sqrt 3 / 2 < H) (fun t ⟨ht4, ht5⟩ => leftEdge_slit_seg5 H s hs_re hs_im t ht4 ht5) obtain ⟨h_ae₀, h_ae_arc, h_ae₃, h_ae₅⟩ := leftEdge_ae_seg_eq g h₀ h_arc h₃ h₅ hg_h₀ hg_arc hg_h₃ hg_h₅ hderiv_01 hderiv_arc hderiv_3 hderiv_5 + have transported₀ := LogDerivFTC.intervalIntegrable_integral_eq_congr_ae piece₀ h_ae₀ + have transported₁ := LogDerivFTC.intervalIntegrable_integral_eq_congr_ae piece₁ h_ae_arc + have transported₂ := LogDerivFTC.intervalIntegrable_integral_eq_congr_ae piece₂ + (h_ae₃ 3 (t₀ - δ) le_rfl (by linarith only [hεα_lt_t₀m3]) + ((sub_le_self t₀ hδ_pos.le).trans _ht₀_lt4.le)) + have transported₃ := LogDerivFTC.intervalIntegrable_integral_eq_congr_ae piece₃ + (h_ae₃ (t₀ + δ) 4 (_ht₀_gt3.le.trans (le_add_of_nonneg_right hδ_pos.le)) + (by linarith only [hεα_lt_4mt₀]) le_rfl) + have transported₄ := LogDerivFTC.intervalIntegrable_integral_eq_congr_ae piece₄ h_ae₅ have hint₀ : IntervalIntegrable (fun t => deriv g t / g t) volume 0 1 := - piece₀.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr - (h_ae₀.mono (fun t ht hm => ht hm))) + transported₀.1 have hint_arc : IntervalIntegrable (fun t => deriv g t / g t) volume 1 3 := - piece₁.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr - (h_ae_arc.mono (fun t ht hm => ht hm))) + transported₁.1 have hint₃_left : IntervalIntegrable (fun t => deriv g t / g t) volume 3 (t₀ - δ) := - piece₂.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr - ((h_ae₃ 3 (t₀ - δ) le_rfl (by linarith) (by linarith)).mono - (fun t ht hm => ht hm))) + transported₂.1 have hint₃_right : IntervalIntegrable (fun t => deriv g t / g t) volume (t₀ + δ) 4 := - piece₃.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr - ((h_ae₃ (t₀ + δ) 4 (by linarith) (by linarith) le_rfl).mono - (fun t ht hm => ht hm))) + transported₃.1 have hint₅ : IntervalIntegrable (fun t => deriv g t / g t) volume 4 5 := - piece₄.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr - (h_ae₅.mono (fun t ht hm => ht hm))) + transported₄.1 -- Convert deriv g / g to the inverse-times-deriv form for the statement have h_congr : ∀ t, deriv g t / g t = (fdBoundaryH H t - s)⁻¹ * deriv (fun u => fdBoundaryH H u - s) t := fun t => by @@ -582,26 +584,20 @@ private lemma leftEdge_ftc_telescope (H : ℝ) (_hH_sqrt : Real.sqrt 3 / 2 < H) (intervalIntegrable_congr (fun t _ => h_congr t)).mp (hint₃_right.trans hint₅) -- FTC for each segment have h_ftc₀ : ∫ t in (0 : ℝ)..(1 : ℝ), deriv g t / g t = - Complex.log (h₀ 1) - Complex.log (h₀ 0) := by - rw [← piece₀.2, intervalIntegral.integral_congr_ae (h_ae₀.mono (fun t ht hm => ht hm))] + Complex.log (h₀ 1) - Complex.log (h₀ 0) := + transported₀.2 have h_ftc_arc : ∫ t in (1 : ℝ)..(3 : ℝ), deriv g t / g t = - Complex.log (h_arc 3) - Complex.log (h_arc 1) := by - rw [← piece₁.2, intervalIntegral.integral_congr_ae - (h_ae_arc.mono (fun t ht hm => ht hm))] + Complex.log (h_arc 3) - Complex.log (h_arc 1) := + transported₁.2 have h_ftc₃_left : ∫ t in (3 : ℝ)..(t₀ - δ), deriv g t / g t = - Complex.log (h₃ (t₀ - δ)) - Complex.log (h₃ 3) := by - rw [← piece₂.2, intervalIntegral.integral_congr_ae - ((h_ae₃ 3 (t₀ - δ) le_rfl (by linarith) (by linarith)).mono - (fun t ht hm => ht hm))] + Complex.log (h₃ (t₀ - δ)) - Complex.log (h₃ 3) := + transported₂.2 have h_ftc₃_right : ∫ t in (t₀ + δ)..(4 : ℝ), deriv g t / g t = - Complex.log (h₃ 4) - Complex.log (h₃ (t₀ + δ)) := by - rw [← piece₃.2, intervalIntegral.integral_congr_ae - ((h_ae₃ (t₀ + δ) 4 (by linarith) (by linarith) le_rfl).mono - (fun t ht hm => ht hm))] + Complex.log (h₃ 4) - Complex.log (h₃ (t₀ + δ)) := + transported₃.2 have h_ftc₅ : ∫ t in (4 : ℝ)..(5 : ℝ), deriv g t / g t = - Complex.log (h₅ 5) - Complex.log (h₅ 4) := by - rw [← piece₄.2, intervalIntegral.integral_congr_ae - (h_ae₅.mono (fun t ht hm => ht hm))] + Complex.log (h₅ 5) - Complex.log (h₅ 4) := + transported₄.2 -- Assemble the telescoping sum have h_left_sum : (∫ t in (0 : ℝ)..(t₀ - δ), deriv g t / g t) = Complex.log (h₀ 1) - Complex.log (h₀ 0) + diff --git a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/RightEdge.lean b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/RightEdge.lean index cf84bf502a..b79855145d 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/RightEdge.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/RightEdge.lean @@ -15,7 +15,6 @@ import LeanPool.LeanModularForms.ValenceFormula.TrigLemmas import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Generalized Winding Number at Right Edge Points @@ -90,7 +89,7 @@ lemma rightEdge_unique_crossing (H : ℝ) (_hH : heightCutoff ≤ H) (s : ℂ) have : ‖s‖ = 1 := by rw [← hs_eq] rw [show (↑π / 3 + (↑t - 1) * (↑π / 2 - ↑π / 3)) * I = - ↑(π / 3 + (t - 1) * (π / 2 - π / 3)) * I from by push_cast; ring] + ↑(π / 3 + (t - 1) * (π / 2 - π / 3)) * I from by push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ linarith only [hs_norm, this] · push Not at h2 @@ -100,7 +99,7 @@ lemma rightEdge_unique_crossing (H : ℝ) (_hH : heightCutoff ≤ H) (s : ℂ) have : ‖s‖ = 1 := by rw [← hs_eq] rw [show (↑π / 2 + (↑t - 2) * (2 * ↑π / 3 - ↑π / 2)) * I = - ↑(π / 2 + (t - 2) * (2 * π / 3 - π / 2)) * I from by push_cast; ring] + ↑(π / 2 + (t - 2) * (2 * π / 3 - π / 2)) * I from by push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ linarith only [hs_norm, this] · push Not at h3 @@ -134,21 +133,21 @@ lemma rightEdge_dist_from_arc (s : ℂ) (z : ℂ) (hz : ‖z‖ = 1) : lemma rightEdge_dist_from_leftVertical (s : ℂ) (hs_re : s.re = 1 / 2) (z : ℂ) (hz_re : z.re = -1 / 2) : 1 ≤ ‖z - s‖ := by - have hre : (z - s).re = -1 := by simp [Complex.sub_re, hz_re, hs_re]; ring + have hre : (z - s).re = -1 := by simp only [sub_re, hz_re, hs_re, one_div]; ring calc 1 = |(z - s).re| := by rw [hre]; norm_num _ ≤ ‖z - s‖ := abs_re_le_norm (z - s) /-- Points on seg5 (horizontal at height H) are at distance ≥ H - s.im from s with s.im < H. -/ lemma rightEdge_dist_from_horizontal (s : ℂ) (hs_im : s.im < H) (z : ℂ) (hz_im : z.im = H) : H - s.im ≤ ‖z - s‖ := by - have him : (z - s).im = H - s.im := by simp [Complex.sub_im, hz_im] + have him : (z - s).im = H - s.im := by simp only [sub_im, hz_im] calc H - s.im = |(z - s).im| := by rw [him]; rw [abs_of_pos (by linarith only [hs_im])] _ ≤ ‖z - s‖ := abs_im_le_norm (z - s) /-- Minimum distance from s (on right edge) to the non-seg1 parts of the boundary. -/ lemma rightEdge_min_dist_pos (s : ℂ) (hs_norm : ‖s‖ > 1) (hs_im : s.im < H) : 0 < min (min (‖s‖ - 1) 1) (H - s.im) := by - simpa only [lt_min_iff] using ⟨⟨by linarith, by norm_num⟩, by linarith⟩ + simpa only [lt_min_iff] using ⟨⟨by exact sub_pos.mpr hs_norm, by norm_num⟩, by linarith⟩ /-- FTC on a smooth segment: `∫ f'/f = log(−f(b)) − log(−f(a))` when `−f` stays in `slitPlane`. Delegates to `LogDerivFTC.ftc_log_neg_on_segment`. -/ @@ -187,7 +186,8 @@ lemma log_div_of_re_pos {a b : ℂ} (ha : 0 < a.re) (hb : 0 < b.re) : rw [div_eq_mul_inv] have hb_arg_ne_pi : b.arg ≠ Real.pi := by intro h; have := Complex.arg_eq_pi_iff.mp h; linarith only [hb, this, this.1] - have hb_inv_arg : b⁻¹.arg = -b.arg := by rw [Complex.arg_inv]; simp [hb_arg_ne_pi] + have hb_inv_arg : b⁻¹.arg = -b.arg := by rw [Complex.arg_inv]; simp only [hb_arg_ne_pi, + ↓reduceIte] have ha_abs_arg : |a.arg| < Real.pi / 2 := Complex.abs_arg_lt_pi_div_two_iff.mpr (Or.inl ha) have hb_abs_arg : |b.arg| < Real.pi / 2 := @@ -196,7 +196,7 @@ lemma log_div_of_re_pos {a b : ℂ} (ha : 0 < a.re) (hb : 0 < b.re) : have h_sum : a.arg + b⁻¹.arg ∈ Set.Ioc (-Real.pi) Real.pi := ⟨by linarith only [ha_abs_arg, hbi_abs_arg, abs_lt.mp ha_abs_arg, abs_lt.mp hbi_abs_arg], by linarith only [ha_abs_arg, hbi_abs_arg, abs_lt.mp ha_abs_arg, abs_lt.mp hbi_abs_arg]⟩ - rw [Complex.log_mul ha_ne hb_inv_ne h_sum, Complex.log_inv b hb_arg_ne_pi]; ring + rw [Complex.log_mul ha_ne hb_inv_ne h_sum, Complex.log_inv b hb_arg_ne_pi]; ac_rfl private lemma rightEdge_h₀_eq {H : ℝ} {s : ℂ} (hs_re : s.re = 1 / 2) (t : ℝ) : fdBoundarySeg1H H t - s = (↑(H - t * (H - Real.sqrt 3 / 2) - s.im) : ℂ) * I := by @@ -214,12 +214,12 @@ lemma hasDerivAt_arc_rep (s : ℂ) (t : ℝ) : (↑(Real.pi / 6) * I * exp (↑(Real.pi * (1 + t) / 6) * I)) t := by have hf : HasDerivAt (fun s : ℝ => Real.pi * (1 + s) / 6) (Real.pi / 6) t := ((hasDerivAt_id t).add_const (1 : ℝ) |>.const_mul (Real.pi / 6)).congr_of_eventuallyEq - (Eventually.of_forall fun s => show _ from by simp [id]; ring) - |>.congr_deriv (by ring) + (Eventually.of_forall fun s => show _ from by simp only [id]; ring) + |>.congr_deriv (by ac_rfl) have hci : HasDerivAt (fun s : ℝ => (↑(Real.pi * (1 + s) / 6) : ℂ) * I) ((↑(Real.pi / 6) : ℂ) * I) t := (hf.ofReal_comp.mul_const I).congr_deriv (by norm_num [smul_eq_mul]) - exact (hci.cexp.sub (hasDerivAt_const t s)).congr_deriv (by simp only [sub_zero]; ring) + exact (hci.cexp.sub (hasDerivAt_const t s)).congr_deriv (by simp only [sub_zero]; ac_rfl) private lemma norm_fdBoundary_H_arc (H : ℝ) (t : ℝ) (ht1 : 1 < t) (ht3 : t < 3) : ‖fdBoundaryH H t‖ = 1 := by @@ -380,11 +380,11 @@ private lemma rightEdge_neg_seg5_slitPlane (s : ℂ) (hs_re : s.re = 1 / 2) · right; subst ht5_eq simp [Complex.sub_im, Complex.add_im, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, Complex.I_re, Complex.I_im] - linarith + linarith only [hs_im] · left; have : t < 5 := lt_of_le_of_ne ht5 ht5_eq simp only [sub_re, add_re, ofReal_re, div_ofNat_re, re_ofNat, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, sub_pos, gt_iff_lt] - rw [hs_re]; linarith + rw [hs_re]; linarith only [this] private lemma rightEdge_neg_seg1_slitPlane_left (H : ℝ) (s : ℂ) (hs_re : s.re = 1 / 2) (_hs_im : s.im < H) (hH_sqrt : Real.sqrt 3 / 2 < H) @@ -548,7 +548,7 @@ lemma rightEdge_ftc_telescope (H : ℝ) (_hH_sqrt : Real.sqrt 3 / 2 < H) hasDerivAt_arc_rep s have hd₃ : ∀ t : ℝ, HasDerivAt h₃ ((↑α : ℂ) * I) t := by intro t; exact (hasDerivAt_fdBoundary_seg4_H H t).sub (hasDerivAt_const t s) - |>.congr_deriv (by simp [hα_def]) + |>.congr_deriv (by simp only [ofReal_sub, ofReal_div, ofReal_ofNat, sub_zero, hα_def]) have hd₅ : ∀ t : ℝ, HasDerivAt h₅ 1 t := by intro t; exact (hasDerivAt_fdBoundary_seg5_H H t).sub (hasDerivAt_const t s) |>.congr_deriv (by simp only [sub_zero]) @@ -624,44 +624,42 @@ lemma rightEdge_ftc_telescope (H : ℝ) (_hH_sqrt : Real.sqrt 3 / 2 < H) hslit₅ obtain ⟨h_ae₀, h_ae_arc, h_ae₃, h_ae₅⟩ := rightEdge_ae_seg_eq g h₀ h_arc h₃ h₅ hg_h₀ hg_arc hg_h₃ hg_h₅ hderiv_01 hderiv_arc hderiv_3 hderiv_5 + have transported₀ := LogDerivFTC.intervalIntegrable_integral_eq_congr_ae piece₀ + (h_ae₀ 0 (t₀ - δ) le_rfl (sub_pos.mpr hδ_lt_t₀) + ((sub_le_self t₀ hδ_pos.le).trans ht₀_lt.le)) + have transported₁ := LogDerivFTC.intervalIntegrable_integral_eq_congr_ae piece₁ + (h_ae₀ (t₀ + δ) 1 (add_nonneg ht₀_pos.le hδ_pos.le) + (by linarith only [hδ_lt_1mt₀]) le_rfl) + have transported₂ := LogDerivFTC.intervalIntegrable_integral_eq_congr_ae piece₂ h_ae_arc + have transported₃ := LogDerivFTC.intervalIntegrable_integral_eq_congr_ae piece₃ h_ae₃ + have transported₄ := LogDerivFTC.intervalIntegrable_integral_eq_congr_ae piece₄ h_ae₅ have hint₀ : IntervalIntegrable (fun t => deriv g t / g t) volume 0 (t₀ - δ) := - piece₀.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr - ((h_ae₀ 0 (t₀ - δ) le_rfl (by linarith) (by linarith)).mono - (fun t ht hm => ht hm))) + transported₀.1 have hint₁ : IntervalIntegrable (fun t => deriv g t / g t) volume (t₀ + δ) 1 := - piece₁.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr - ((h_ae₀ (t₀ + δ) 1 (by linarith) (by linarith) le_rfl).mono - (fun t ht hm => ht hm))) + transported₁.1 have hint_arc : IntervalIntegrable (fun t => deriv g t / g t) volume 1 3 := - piece₂.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr - (h_ae_arc.mono (fun t ht hm => ht hm))) + transported₂.1 have hint₃ : IntervalIntegrable (fun t => deriv g t / g t) volume 3 4 := - piece₃.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr - (h_ae₃.mono (fun t ht hm => ht hm))) + transported₃.1 have hint₅ : IntervalIntegrable (fun t => deriv g t / g t) volume 4 5 := - piece₄.1.congr_ae ((ae_restrict_iff' measurableSet_uIoc).mpr - (h_ae₅.mono (fun t ht hm => ht hm))) + transported₄.1 have hint_right : IntervalIntegrable (fun t => deriv g t / g t) volume (t₀ + δ) 5 := hint₁.trans hint_arc |>.trans hint₃ |>.trans hint₅ have h_ftc₀ : ∫ t in (0 : ℝ)..(t₀ - δ), deriv g t / g t = - Complex.log (-(h₀ (t₀ - δ))) - Complex.log (-(h₀ 0)) := by - rw [← piece₀.2, intervalIntegral.integral_congr_ae - ((h_ae₀ 0 (t₀ - δ) le_rfl (by linarith) (by linarith)).mono - (fun t ht hm => ht hm))] + Complex.log (-(h₀ (t₀ - δ))) - Complex.log (-(h₀ 0)) := + transported₀.2 have h_ftc₁ : ∫ t in (t₀ + δ)..(1 : ℝ), deriv g t / g t = - Complex.log (-(h₀ 1)) - Complex.log (-(h₀ (t₀ + δ))) := by - rw [← piece₁.2, intervalIntegral.integral_congr_ae - ((h_ae₀ (t₀ + δ) 1 (by linarith) (by linarith) le_rfl).mono - (fun t ht hm => ht hm))] + Complex.log (-(h₀ 1)) - Complex.log (-(h₀ (t₀ + δ))) := + transported₁.2 have h_ftc_arc : ∫ t in (1 : ℝ)..(3 : ℝ), deriv g t / g t = - Complex.log (-(h_arc 3)) - Complex.log (-(h_arc 1)) := by - rw [← piece₂.2, intervalIntegral.integral_congr_ae (h_ae_arc.mono (fun t ht hm => ht hm))] + Complex.log (-(h_arc 3)) - Complex.log (-(h_arc 1)) := + transported₂.2 have h_ftc₃ : ∫ t in (3 : ℝ)..(4 : ℝ), deriv g t / g t = - Complex.log (-(h₃ 4)) - Complex.log (-(h₃ 3)) := by - rw [← piece₃.2, intervalIntegral.integral_congr_ae (h_ae₃.mono (fun t ht hm => ht hm))] + Complex.log (-(h₃ 4)) - Complex.log (-(h₃ 3)) := + transported₃.2 have h_ftc₅ : ∫ t in (4 : ℝ)..(5 : ℝ), deriv g t / g t = - Complex.log (-(h₅ 5)) - Complex.log (-(h₅ 4)) := by - rw [← piece₄.2, intervalIntegral.integral_congr_ae (h_ae₅.mono (fun t ht hm => ht hm))] + Complex.log (-(h₅ 5)) - Complex.log (-(h₅ 4)) := + transported₄.2 have h_right_total : ∫ t in (t₀ + δ)..(5 : ℝ), deriv g t / g t = Complex.log (-(h₀ 1)) - Complex.log (-(h₀ (t₀ + δ))) + (Complex.log (-(h_arc 3)) - Complex.log (-(h_arc 1))) + @@ -670,21 +668,10 @@ lemma rightEdge_ftc_telescope (H : ℝ) (_hH_sqrt : Real.sqrt 3 / 2 < H) have h_split_right : (∫ t in (t₀ + δ)..(5 : ℝ), deriv g t / g t) = (∫ t in (t₀ + δ)..(1 : ℝ), deriv g t / g t) + (∫ t in (1 : ℝ)..(3 : ℝ), deriv g t / g t) + (∫ t in (3 : ℝ)..(4 : ℝ), deriv g t / g t) + (∫ t in (4 : ℝ)..(5 : ℝ), deriv g t / g t) := by - have h1 : (∫ t in (t₀ + δ)..(1 : ℝ), deriv g t / g t) + - (∫ t in (1 : ℝ)..(3 : ℝ), deriv g t / g t) = - ∫ t in (t₀ + δ)..(3 : ℝ), deriv g t / g t := by - rw [← intervalIntegral.integral_add_adjacent_intervals hint₁ hint_arc] - have h2 : (∫ t in (t₀ + δ)..(3 : ℝ), deriv g t / g t) + - (∫ t in (3 : ℝ)..(4 : ℝ), deriv g t / g t) = - ∫ t in (t₀ + δ)..(4 : ℝ), deriv g t / g t := by - rw [← intervalIntegral.integral_add_adjacent_intervals - (hint₁.trans hint_arc) hint₃] - have h3 : (∫ t in (t₀ + δ)..(4 : ℝ), deriv g t / g t) + - (∫ t in (4 : ℝ)..(5 : ℝ), deriv g t / g t) = - ∫ t in (t₀ + δ)..(5 : ℝ), deriv g t / g t := by - rw [← intervalIntegral.integral_add_adjacent_intervals - ((hint₁.trans hint_arc).trans hint₃) hint₅] - rw [← h3, ← h2, ← h1] + rw [← intervalIntegral.integral_add_adjacent_intervals + ((hint₁.trans hint_arc).trans hint₃) hint₅, + ← intervalIntegral.integral_add_adjacent_intervals (hint₁.trans hint_arc) hint₃, + ← intervalIntegral.integral_add_adjacent_intervals hint₁ hint_arc] rw [h_split_right, h_ftc₁, h_ftc_arc, h_ftc₃, h_ftc₅] have h_telescope : Complex.log (-(h₀ (t₀ - δ))) - Complex.log (-(h₀ 0)) + (Complex.log (-(h₀ 1)) - Complex.log (-(h₀ (t₀ + δ))) + diff --git a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/UnitArc.lean b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/UnitArc.lean index c6618a30c3..ea12118d11 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/UnitArc.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/UnitArc.lean @@ -15,7 +15,6 @@ import LeanPool.LeanModularForms.ValenceFormula.TrigLemmas import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Unit Arc Winding Number @@ -51,9 +50,9 @@ private lemma unitArc_re_pos_at_offsets (s : ℂ) (t₀ δ' : ℝ) simp only [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.ofReal_im, Complex.I_re, Complex.I_im, mul_zero, zero_mul, sub_self, add_zero] - have hθ_m_lt : θ_m < θ₀' := by simp [θ_m, θ₀']; nlinarith only [_hδ'_pos, Real.pi_pos] - have hθ_m_nn : 0 ≤ θ_m := by simp [θ_m]; nlinarith only [hδ'_left, Real.pi_pos] - have hθ₀_le_pi : θ₀' ≤ Real.pi := by simp [θ₀']; nlinarith only [_hδ'_pos, hδ'_left, + have hθ_m_lt : θ_m < θ₀' := by simp only [θ_m, θ₀']; nlinarith only [_hδ'_pos, Real.pi_pos] + have hθ_m_nn : 0 ≤ θ_m := by simp only [θ_m]; nlinarith only [hδ'_left, Real.pi_pos] + have hθ₀_le_pi : θ₀' ≤ Real.pi := by simp only [θ₀']; nlinarith only [_hδ'_pos, hδ'_left, hδ'_right, Real.pi_pos] linarith only [hθ_m_lt, hθ_m_nn, hθ₀_le_pi, Real.cos_lt_cos_of_nonneg_of_le_pi hθ_m_nn hθ₀_le_pi hθ_m_lt] @@ -63,9 +62,9 @@ private lemma unitArc_re_pos_at_offsets (s : ℂ) (t₀ δ' : ℝ) simp only [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.ofReal_im, Complex.I_re, Complex.I_im, mul_zero, zero_mul, sub_self, add_zero, neg_sub] - have hθ_gt : θ₀' < θ_p := by simp [θ₀', θ_p]; nlinarith only [_hδ'_pos, Real.pi_pos] - have hθ₀_nn : 0 ≤ θ₀' := by simp [θ₀']; nlinarith only [_hδ'_pos, hδ'_left, Real.pi_pos] - have hθ_p_le_pi : θ_p ≤ Real.pi := by simp [θ_p]; nlinarith only [_hδ'_pos, hδ'_left, + have hθ_gt : θ₀' < θ_p := by simp only [θ₀', θ_p]; nlinarith only [_hδ'_pos, Real.pi_pos] + have hθ₀_nn : 0 ≤ θ₀' := by simp only [θ₀']; nlinarith only [_hδ'_pos, hδ'_left, Real.pi_pos] + have hθ_p_le_pi : θ_p ≤ Real.pi := by simp only [θ_p]; nlinarith only [_hδ'_pos, hδ'_left, hδ'_right, Real.pi_pos] linarith only [hθ_gt, hθ₀_nn, hθ_p_le_pi, Real.cos_lt_cos_of_nonneg_of_le_pi hθ₀_nn hθ_p_le_pi hθ_gt] @@ -117,7 +116,7 @@ private lemma unitArc_log_diff_tendsto (s : ℂ) have hδ_lt1 : δ < t₀ - 1 := lt_of_lt_of_le hδ_small (min_le_left _ _) have hδ_lt2 : δ < 3 - t₀ := lt_of_lt_of_le hδ_small (min_le_right _ _) obtain ⟨h_re_a, h_re_b⟩ := unitArc_re_pos_at_offsets s t₀ δ ht₀_Ioo h_s_arc hδ_pos - (by linarith) (by linarith) + (by linarith only [hδ_lt1]) (by linarith only [hδ_lt2]) exact (log_div_of_re_pos h_re_a h_re_b).symm exact h_ratio.congr' (h_ev_agree.mono fun _ h => h.symm) @@ -300,7 +299,7 @@ private lemma unitArc_limit_aux (H : ℝ) (s : ℂ) · have hcont : Continuous δ_fn := by rw [hδ_fn_def] exact continuous_const.mul (Real.continuous_arcsin.comp (continuous_id'.div_const 2)) - have h0 : δ_fn 0 = 0 := by simp [hδ_fn_def, Real.arcsin_zero] + have h0 : δ_fn 0 = 0 := by simp only [hδ_fn_def, zero_div, Real.arcsin_zero, mul_zero] simpa [h0] using hcont.tendsto 0 |>.mono_left nhdsWithin_le_nhds · exact eventually_nhdsWithin_of_forall fun ε hε => Set.mem_Ioi.mpr (by simp only [hδ_fn_def] @@ -414,8 +413,8 @@ private lemma unitArc_winding_aux (H : ℝ) (hH : 1 < H) (s : ℂ) (Real.arcsin_sin (by nlinarith only [hhw_pos, Real.pi_pos]) (by nlinarith only [hhw_le_t₀_sub_one, hhw_le_three_sub_t₀, Real.pi_pos])).symm rw [hπhw12] - apply Real.arcsin_lt_arcsin (by linarith) - · linarith + apply Real.arcsin_lt_arcsin (by linarith only [hε_pos]) + · linarith only [hε_lt_2sin] · exact Real.sin_le_one _ simp only [hδ_fn_def] calc 12 / Real.pi * Real.arcsin (ε / 2) < 12 / Real.pi * (Real.pi * hw / 12) := @@ -436,8 +435,8 @@ private lemma unitArc_winding_aux (H : ℝ) (hH : 1 < H) (s : ℂ) have hδ_lt := hδ_lt_hw ε hε_pos hε_lt have hδ_lt_t₀m1 : δ_fn ε < t₀ - 1 := lt_of_lt_of_le hδ_lt hhw_le_t₀_sub_one have hδ_lt_3mt₀ : δ_fn ε < 3 - t₀ := lt_of_lt_of_le hδ_lt hhw_le_three_sub_t₀ - have hδ_left : 1 < t₀ - δ_fn ε := by linarith - have hδ_right : t₀ + δ_fn ε < 3 := by linarith + have hδ_left : 1 < t₀ - δ_fn ε := by linarith only [hhw_le_t₀_sub_one, hδ_lt] + have hδ_right : t₀ + δ_fn ε < 3 := by linarith only [hhw_le_three_sub_t₀, hδ_lt] have hδ_pos' := hδ_pos ε hε_pos hε_lt have h_arc_left : 1 < t₀ + δ_fn ε := by linarith [ht₀_Ioo.1, hδ_pos'] rw [Complex.norm_def, @@ -457,11 +456,11 @@ private lemma unitArc_winding_aux (H : ℝ) (hH : 1 < H) (s : ℂ) nlinarith only [hhw_le_t₀_sub_one, hhw_le_three_sub_t₀, hδ_lt, Real.pi_pos] have hε_half_bounds : -1 ≤ ε / 2 ∧ ε / 2 ≤ 1 := by constructor - · linarith + · linarith only [hhw_le_t₀_sub_one, hhw_le_three_sub_t₀, hε_pos, hδ_lt, hδ_pos'] · have hthresh_le : threshold ≤ 2 * Real.sin (Real.pi * hw / 12) := min_le_right _ _ nlinarith only [hε_lt, hthresh_le, Real.sin_le_one (Real.pi * hw / 12)] - rw [h2sin, Real.sqrt_sq_eq_abs, abs_of_pos (by linarith), hangle, + rw [h2sin, Real.sqrt_sq_eq_abs, abs_of_pos (by linarith only [hsin_pos]), hangle, Real.sin_arcsin hε_half_bounds.1 hε_half_bounds.2] ring have h_far : ∀ ε, 0 < ε → ε < threshold → @@ -472,19 +471,19 @@ private lemma unitArc_winding_aux (H : ℝ) (hH : 1 < H) (s : ℂ) have hδ_pos' := hδ_pos ε hε_pos hε_lt have hδ_lt_t₀m1 : δ_fn ε < t₀ - 1 := lt_of_lt_of_le hδ_lt hhw_le_t₀_sub_one have hδ_lt_3mt₀ : δ_fn ε < 3 - t₀ := lt_of_lt_of_le hδ_lt hhw_le_three_sub_t₀ - have hδ_left : 1 < t₀ - δ_fn ε := by linarith - have hδ_right : t₀ + δ_fn ε < 3 := by linarith + have hδ_left : 1 < t₀ - δ_fn ε := by linarith only [hhw_le_t₀_sub_one, hδ_lt] + have hδ_right : t₀ + δ_fn ε < 3 := by linarith only [hhw_le_three_sub_t₀, hδ_lt] have hδ_eq := hδ_norm_eq ε hε_pos hε_lt rcases lt_or_ge t (t₀ - δ_fn ε) with ht_left | ht_right · exact unitArc_norm_gt_left s H hH t₀ (δ_fn ε) ε ht₀_Ioo h_s_arc hs_re hδ_pos' hδ_left hδ_right hδ_eq hε_lt_d t ⟨ht_mem.1, le_of_lt ht_left⟩ ht_left · have ht_right' : t₀ + δ_fn ε < t := by rcases le_or_gt t₀ t with h_t_ge | h_t_lt - · rw [abs_of_nonneg (by linarith)] at habs; linarith + · rw [abs_of_nonneg (by exact sub_nonneg.mpr h_t_ge)] at habs; linarith only [habs] · exfalso have h_abs_eq : |t - t₀| = t₀ - t := by rw [abs_of_neg (sub_neg.mpr h_t_lt)]; ring have habs' : δ_fn ε < t₀ - t := h_abs_eq ▸ habs - linarith + linarith only [habs, ht_right, h_abs_eq] exact unitArc_norm_gt_right s H hH t₀ (δ_fn ε) ε ht₀_Ioo h_s_arc hs_re hs_norm hs_im_pos hδ_pos' hδ_left hδ_right hδ_eq hε_lt_d t ht_right' ht_mem.2 have h_near : ∀ ε, 0 < ε → ε < threshold → @@ -531,4 +530,4 @@ theorem gWN_fdBoundary_H_eq_neg_half_of_unitArc (H : ℝ) (hH : 1 < H) (s : ℂ) generalizedWindingNumber' (fdBoundaryH H) 0 5 s = -1/2 := by apply ContourIntegral.gWN_eq_neg_half_of_pv_tendsto convert unitArc_winding_tendsto H hH s hs_norm hs_re hs_im_pos using 2 - simp [sub_zero, gt_iff_lt] + simp only [sub_zero, deriv_sub_const_fun, gt_iff_lt] diff --git a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/UnitArcHelpers.lean b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/UnitArcHelpers.lean index 231491fc91..6336a50ca5 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/UnitArcHelpers.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/Boundary/Winding/UnitArcHelpers.lean @@ -12,7 +12,6 @@ import LeanPool.LeanModularForms.ValenceFormula.TrigLemmas import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Unit Arc Winding Number Helpers @@ -101,14 +100,14 @@ lemma unitArc_fdBoundary_eq (H : ℝ) (s : ℂ) private lemma unitArc_dist_from_seg1 (s : ℂ) (hs_re : |s.re| < 1 / 2) (z : ℂ) (hz_re : z.re = 1 / 2) : 1/2 - s.re ≤ ‖z - s‖ := by - have hd : (z - s).re = 1/2 - s.re := by simp [Complex.sub_re, hz_re] + have hd : (z - s).re = 1/2 - s.re := by simp only [sub_re, hz_re, one_div] calc 1/2 - s.re = |(z - s).re| := by rw [hd, abs_of_pos (by linarith only [hs_re, (abs_lt.mp hs_re).2])] _ ≤ ‖z - s‖ := Complex.abs_re_le_norm _ private lemma unitArc_dist_from_seg4 (s : ℂ) (hs_re : |s.re| < 1 / 2) (z : ℂ) (hz_re : z.re = -1 / 2) : s.re + 1/2 ≤ ‖z - s‖ := by - have hd : (z - s).re = -1/2 - s.re := by simp [Complex.sub_re, hz_re] + have hd : (z - s).re = -1/2 - s.re := by simp only [sub_re, hz_re] calc s.re + 1/2 = |(-1/2 - s.re)| := by rw [abs_of_nonpos (by linarith only [hs_re, (abs_lt.mp hs_re).1])]; ring _ = |(z - s).re| := by rw [hd] @@ -117,7 +116,7 @@ private lemma unitArc_dist_from_seg4 (s : ℂ) (hs_re : |s.re| < 1 / 2) (z : ℂ private lemma unitArc_dist_from_seg5 (s : ℂ) (hs_norm : ‖s‖ = 1) (H : ℝ) (hH : 1 < H) (z : ℂ) (hz_im : z.im = H) : H - 1 ≤ ‖z - s‖ := by have hs_im_le : s.im ≤ 1 := unitArc_im_le_one hs_norm - have hd : (z - s).im = H - s.im := by simp [Complex.sub_im, hz_im] + have hd : (z - s).im = H - s.im := by simp only [sub_im, hz_im] calc H - 1 ≤ H - s.im := by linarith only [hs_im_le] _ = |(z - s).im| := by rw [hd, abs_of_pos (by linarith only [hH, hs_im_le])] _ ≤ ‖z - s‖ := Complex.abs_im_le_norm _ @@ -128,7 +127,7 @@ lemma unitArc_min_dist_pos (s : ℂ) (_hs_norm : ‖s‖ = 1) (hs_re : |s.re| < 0 < min (min (1/2 - s.re) (s.re + 1/2)) (H - 1) := by simp only [lt_min_iff] exact ⟨⟨by linarith [(abs_lt.mp hs_re).2], by linarith [(abs_lt.mp hs_re).1]⟩, - by linarith⟩ + by exact sub_pos.mpr hH⟩ /-- Non-arc segments of fdBoundaryH stay at distance ≥ d from arc point s. -/ lemma unitArc_min_dist_from_non_arc (H : ℝ) (hH : 1 < H) (s : ℂ) @@ -181,12 +180,14 @@ private lemma unitArc_g_slitPlane_before (s : ℂ) (↑(Real.cos θ) + ↑(Real.sin θ) * I) - (↑(Real.cos θ₀') + ↑(Real.sin θ₀') * I) = ↑(Real.cos θ - Real.cos θ₀') + ↑(Real.sin θ - Real.sin θ₀') * I from by push_cast; ring] - have hθ_lt : θ < θ₀' := by simp [hθ_def, hθ₀_def]; nlinarith only [htt₀, Real.pi_pos] + have hθ_lt : θ < θ₀' := by simp only [hθ_def, hθ₀_def]; nlinarith only [htt₀, Real.pi_pos] have hθ_range : θ ∈ Icc (0 : ℝ) Real.pi := by - constructor <;> simp [hθ_def] <;> nlinarith only [ht1, Real.pi_pos, ht₀_Ioo.2, ht₀_Ioo, htt₀, + constructor <;> simp only [ + hθ_def] <;> nlinarith only [ht1, Real.pi_pos, ht₀_Ioo.2, ht₀_Ioo, htt₀, hθ_def, hθ₀_def, hθ_lt] have hθ₀_range : θ₀' ∈ Icc (0 : ℝ) Real.pi := by - constructor <;> simp [hθ₀_def] <;> nlinarith only [ht1, hθ_def, hθ₀_def, hθ_lt, Real.pi_pos, + constructor <;> simp only [ + hθ₀_def] <;> nlinarith only [ht1, hθ_def, hθ₀_def, hθ_lt, Real.pi_pos, ht₀_Ioo.2, ht₀_Ioo, htt₀] have h_cos_lt : Real.cos θ > Real.cos θ₀' := Real.cos_lt_cos_of_nonneg_of_le_pi hθ_range.1 hθ₀_range.2 hθ_lt @@ -207,18 +208,19 @@ private lemma unitArc_neg_g_slitPlane_after (s : ℂ) ↑(Real.cos θ₀' - Real.cos θ) + ↑(Real.sin θ₀' - Real.sin θ) * I from by push_cast; ring] - have hθ_gt : θ₀' < θ := by simp [hθ_def, hθ₀_def]; nlinarith only [htt₀, Real.pi_pos] + have hθ_gt : θ₀' < θ := by simp only [hθ₀_def, hθ_def]; nlinarith only [htt₀, Real.pi_pos] have hθ_range : θ ∈ Icc (0 : ℝ) Real.pi := by constructor - · simp [hθ_def]; nlinarith only [ht₀_Ioo, htt₀, ht3, hθ_def, hθ₀_def, hθ_gt, Real.pi_pos, + · simp only [hθ_def]; nlinarith only [ht₀_Ioo, htt₀, ht3, hθ_def, hθ₀_def, hθ_gt, Real.pi_pos, ht₀_Ioo.1] - · simp [hθ_def]; have : 1 + t ≤ 4 := by linarith only [ht3] + · simp only [hθ_def]; have : 1 + t ≤ 4 := by linarith only [ht3] nlinarith only [htt₀, ht3, hθ_def, hθ₀_def, hθ_gt, Real.pi_pos] have hθ₀_range : θ₀' ∈ Icc (0 : ℝ) Real.pi := by constructor - · simp [hθ₀_def]; nlinarith only [ht₀_Ioo, htt₀, ht3, hθ_def, hθ₀_def, hθ_gt, Real.pi_pos, + · simp only [hθ₀_def]; nlinarith only [ht₀_Ioo, htt₀, ht3, hθ_def, hθ₀_def, hθ_gt, Real.pi_pos, ht₀_Ioo.1] - · simp [hθ₀_def]; nlinarith only [htt₀, ht3, hθ_def, hθ₀_def, hθ_gt, Real.pi_pos, ht₀_Ioo.2] + · simp only [ + hθ₀_def]; nlinarith only [htt₀, ht3, hθ_def, hθ₀_def, hθ_gt, Real.pi_pos, ht₀_Ioo.2] have h_cos_lt : Real.cos θ₀' > Real.cos θ := Real.cos_lt_cos_of_nonneg_of_le_pi hθ₀_range.1 hθ_range.2 hθ_gt simp only [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, @@ -255,10 +257,10 @@ lemma unitArc_ratio_eq (t₀ δ : ℝ) (hδ_pos : 0 < δ) (hδ_small : δ < 6) : set θ₀ := Real.pi * (1 + t₀) / 6 set φ := Real.pi * δ / 6 with hφ_def have hφ_pos : 0 < φ := by positivity - have hφ_lt_pi : φ < Real.pi := by simp [hφ_def]; nlinarith only [hδ_pos, hδ_small, hφ_def, + have hφ_lt_pi : φ < Real.pi := by simp only [hφ_def]; nlinarith only [hδ_pos, hδ_small, hφ_def, hφ_pos, Real.pi_pos] - rw [show Real.pi * (1 + (t₀ - δ)) / 6 = θ₀ - φ from by simp [θ₀, hφ_def]; ring, - show Real.pi * (1 + (t₀ + δ)) / 6 = θ₀ + φ from by simp [θ₀, hφ_def]; ring] + rw [show Real.pi * (1 + (t₀ - δ)) / 6 = θ₀ - φ from by simp only [hφ_def, θ₀]; ring, + show Real.pi * (1 + (t₀ + δ)) / 6 = θ₀ + φ from by simp only [hφ_def, θ₀]; ring] rw [show (↑(θ₀ - φ) * I : ℂ) = ↑θ₀ * I - ↑φ * I from by push_cast; ring, show (↑(θ₀ + φ) * I : ℂ) = ↑θ₀ * I + ↑φ * I from by push_cast; ring] set z := exp (↑θ₀ * I) @@ -295,7 +297,7 @@ private lemma unitArc_far_endpoint_correction (H : ℝ) (hH : 1 < H) (s : ℂ) Complex.ofReal_re, Complex.ofReal_im, Complex.I_re, Complex.I_im] have hg₀_im_pos : 0 < g₀.im := by rw [hg₀_im]; linarith only [hH, hs_im_le] have hg₀_ne : g₀ ≠ 0 := by - intro h; simp_all + intro h; simp_all only [one_div, zero_re, zero_im, lt_self_iff_false] simp only [Complex.log] rw [norm_neg, arg_neg_eq_arg_sub_pi_iff.mpr (Or.inl hg₀_im_pos)] push_cast; ring @@ -321,9 +323,9 @@ private lemma unitArc_log_final (s : ℂ) (t₀ δ : ℝ) rw [h_s_arc, exp_real_angle_I, exp_real_angle_I] simp only [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.ofReal_im, Complex.I_re, Complex.I_im, mul_zero, zero_mul, sub_self, add_zero, Complex.sub_re] - have hθ_lt : θ_m < θ₀' := by simp [θ_m, θ₀']; nlinarith only [hδ_pos, Real.pi_pos] - have hθ_m_nn : 0 ≤ θ_m := by simp [θ_m]; nlinarith only [hδ_left, Real.pi_pos, _ht₀_Ioo.1] - have hθ₀_le_pi : θ₀' ≤ Real.pi := by simp [θ₀']; nlinarith only [hδ_left, hδ_right, hδ_pos, + have hθ_lt : θ_m < θ₀' := by simp only [θ_m, θ₀']; nlinarith only [hδ_pos, Real.pi_pos] + have hθ_m_nn : 0 ≤ θ_m := by simp only [θ_m]; nlinarith only [hδ_left, Real.pi_pos, _ht₀_Ioo.1] + have hθ₀_le_pi : θ₀' ≤ Real.pi := by simp only [θ₀']; nlinarith only [hδ_left, hδ_right, hδ_pos, Real.pi_pos, _ht₀_Ioo.2] linarith only [hθ_lt, hθ_m_nn, hθ₀_le_pi, Real.cos_lt_cos_of_nonneg_of_le_pi hθ_m_nn hθ₀_le_pi hθ_lt] @@ -334,10 +336,10 @@ private lemma unitArc_log_final (s : ℂ) (t₀ δ : ℝ) simp only [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.ofReal_im, Complex.I_re, Complex.I_im, mul_zero, zero_mul, sub_self, add_zero, neg_sub] - have hθ_gt : θ₀' < θ_p := by simp [θ₀', θ_p]; nlinarith only [hδ_pos, Real.pi_pos] - have hθ₀_nn : 0 ≤ θ₀' := by simp [θ₀']; nlinarith only [hδ_left, hδ_right, hδ_pos, + have hθ_gt : θ₀' < θ_p := by simp only [θ₀', θ_p]; nlinarith only [hδ_pos, Real.pi_pos] + have hθ₀_nn : 0 ≤ θ₀' := by simp only [θ₀']; nlinarith only [hδ_left, hδ_right, hδ_pos, Real.pi_pos, _ht₀_Ioo.1] - have hθ_p_le_pi : θ_p ≤ Real.pi := by simp [θ_p]; nlinarith only [hδ_right, Real.pi_pos, + have hθ_p_le_pi : θ_p ≤ Real.pi := by simp only [θ_p]; nlinarith only [hδ_right, Real.pi_pos, _ht₀_Ioo.2] linarith only [hθ_gt, hθ₀_nn, hθ_p_le_pi, Real.cos_lt_cos_of_nonneg_of_le_pi hθ₀_nn hθ_p_le_pi hθ_gt] @@ -471,13 +473,13 @@ lemma unitArc_ftc_value (H : ℝ) (hH : 1 < H) (s : ℂ) hslit_seg1 have h_arc_cont : Continuous h_arc := by simp only [h_arc]; exact (Continuous.cexp (by fun_prop)).sub continuous_const - have piece₁ := ftc_log (f := h_arc) (by linarith : (1 : ℝ) ≤ t₀ - δ) + have piece₁ := ftc_log (f := h_arc) (by exact le_of_lt hδ_left : (1 : ℝ) ≤ t₀ - δ) h_arc_cont.continuousOn (fun t _ => (hd_arc t).differentiableAt) (by rw [show deriv h_arc = fun t => ↑(Real.pi / 6) * I * exp (↑(Real.pi * (1 + t) / 6) * I) from funext fun t => (hd_arc t).deriv] exact (Continuous.mul continuous_const (Continuous.cexp (by fun_prop))).continuousOn) hslit_arc_before - have piece₂ := ftc_log_neg (f := h_arc) (by linarith : t₀ + δ ≤ 3) + have piece₂ := ftc_log_neg (f := h_arc) (by exact le_of_lt hδ_right : t₀ + δ ≤ 3) h_arc_cont.continuousOn (fun t _ => (hd_arc t).differentiableAt) (by rw [show deriv h_arc = fun t => ↑(Real.pi / 6) * I * exp (↑(Real.pi * (1 + t) / 6) * I) from funext fun t => (hd_arc t).deriv] @@ -498,10 +500,10 @@ lemma unitArc_ftc_value (H : ℝ) (hH : 1 < H) (s : ℂ) hslit_seg5 have h_ae_01 := unitArc_logDeriv_ae_eq (by norm_num : (0 : ℝ) ≤ 1) g h₀ (fun t _ ht1 => hg_h₀ t (le_of_lt ht1)) hderiv_01 - have h_ae_1_td := unitArc_logDeriv_ae_eq (by linarith : (1 : ℝ) ≤ t₀ - δ) g h_arc + have h_ae_1_td := unitArc_logDeriv_ae_eq (by exact le_of_lt hδ_left : (1 : ℝ) ≤ t₀ - δ) g h_arc (fun t ht1 ht2 => hg_arc t ht1 (by linarith)) (fun t ht => hderiv_arc t ⟨ht.1, by linarith [ht.2]⟩) - have h_ae_arc_after := unitArc_logDeriv_ae_eq (by linarith : t₀ + δ ≤ 3) g h_arc + have h_ae_arc_after := unitArc_logDeriv_ae_eq (by exact le_of_lt hδ_right : t₀ + δ ≤ 3) g h_arc (fun t ht1 ht3 => hg_arc t (by linarith) ht3) (fun t ht => hderiv_arc t ⟨by linarith [ht.1], ht.2⟩) have h_ae_34 := unitArc_logDeriv_ae_eq (by norm_num : (3 : ℝ) ≤ 4) g h₃ @@ -575,9 +577,9 @@ lemma unitArc_ftc_value (H : ℝ) (hH : 1 < H) (s : ℂ) exact unitArc_far_endpoint_correction H hH s hs_norm hs_re hs_im_pos rw [h_far_corr] have h_td_arc : g (t₀ - δ) = h_arc (t₀ - δ) := by - simp only [hg_def, h_arc]; rw [fdBoundary_H_eq_arc (by linarith) (by linarith)] + simp only [hg_def, h_arc]; rw [fdBoundary_H_eq_arc (by exact hδ_left) (by linarith)] have h_pd_arc : g (t₀ + δ) = h_arc (t₀ + δ) := by - simp only [hg_def, h_arc]; rw [fdBoundary_H_eq_arc (by linarith) (by linarith)] + simp only [hg_def, h_arc]; rw [fdBoundary_H_eq_arc (by linarith) (by exact hδ_right)] rw [h_td_arc, h_pd_arc] obtain ⟨h_re_before, h_re_after⟩ := unitArc_log_final s t₀ δ ht₀_Ioo h_s_arc hδ_left hδ_right hδ_pos diff --git a/LeanPool/LeanModularForms/ValenceFormula/CoreIdentity.lean b/LeanPool/LeanModularForms/ValenceFormula/CoreIdentity.lean index 5135cb3f32..b812d27bd1 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/CoreIdentity.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/CoreIdentity.lean @@ -16,8 +16,6 @@ import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Rho import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.RhoPlusOne import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Core Identity for the Valence Formula @@ -90,9 +88,11 @@ private lemma elliptic_finset_sum_eq_three (S : Finset UpperHalfPlane) · exact ellipticPointRhoPlusOne_mem_fd exact hS_complete_zero x hx_fd hx_not_S rw [Finset.sum_subset h_ell_sub h_zero_outside, - Finset.sum_insert (by simp [ellipticPointI_ne_rho, ellipticPoint_ne_iρ1]), - Finset.sum_insert (by simp [ellipticPoint_ne_ρρ1]), Finset.sum_singleton] - ring + Finset.sum_insert (by simp only [Finset.mem_insert, ellipticPointI_ne_rho, Finset.mem_singleton, + ellipticPoint_ne_iρ1, or_self, not_false_eq_true]), + Finset.sum_insert (by simp only [Finset.mem_singleton, ellipticPoint_ne_ρρ1, + not_false_eq_true]), Finset.sum_singleton] + ac_rfl include hf in private theorem explicit_coefficients (S : Finset UpperHalfPlane) (hS : ∀ p ∈ S, p ∈ 𝒟) @@ -377,7 +377,8 @@ private theorem bdry_ne_eq_union (S : Finset UpperHalfPlane) (hS : ∀ p ∈ S, fun h => by rw [h] at hn; linarith [h_rho1_norm]⟩, fun ⟨_, h⟩ => by have := (abs_lt.mp h).1; linarith⟩ · exact ⟨⟨hs, - fun h => by rw [h] at hre; simp [ellipticPointI'] at hre, + fun h => by rw [h] at hre; simp only [ellipticPointI', I_re, gt_iff_lt, + lt_self_iff_false] at hre, fun h => by rw [h] at hre; linarith [ellipticPointRho_re_neg], hne⟩, fun ⟨h, _⟩ => by linarith⟩ diff --git a/LeanPool/LeanModularForms/ValenceFormula/Definitions.lean b/LeanPool/LeanModularForms/ValenceFormula/Definitions.lean index a5f7c528e0..d29a20d0de 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/Definitions.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/Definitions.lean @@ -56,7 +56,7 @@ theorem ellipticPointRho_add_one_eq : private lemma normSq_half_add_sqrt3_half_I (a : ℝ) (ha : a ^ 2 = 1 / 4) : Complex.normSq ((a : ℂ) + (Real.sqrt 3 / 2) * I) = 1 := by have h1 : ((a : ℝ) : ℂ) + (Real.sqrt 3 / 2) * I = - ((a : ℝ) : ℂ) + ((Real.sqrt 3 / 2 : ℝ) : ℂ) * I := by push_cast; ring + ((a : ℝ) : ℂ) + ((Real.sqrt 3 / 2 : ℝ) : ℂ) * I := by push_cast; ac_rfl rw [h1, Complex.normSq_add_mul_I, ha, show (Real.sqrt 3 / 2) ^ 2 = 3 / 4 from by rw [div_pow, Real.sq_sqrt (by norm_num : (3 : ℝ) ≥ 0)]; norm_num] @@ -65,14 +65,14 @@ private lemma normSq_half_add_sqrt3_half_I (a : ℝ) (ha : a ^ 2 = 1 / 4) : private lemma rho_normSq_eq_one : Complex.normSq (ellipticPointRho' : ℂ) = 1 := by change Complex.normSq (-1/2 + (Real.sqrt 3 / 2) * I : ℂ) = 1 rw [show (-1/2 + (Real.sqrt 3 / 2) * I : ℂ) = ((-1/2 : ℝ) : ℂ) + (Real.sqrt 3 / 2) * I from by - push_cast; ring] + push_cast; ac_rfl] exact normSq_half_add_sqrt3_half_I (-1/2) (by norm_num) private lemma rho_plus_one_normSq_eq_one : Complex.normSq (ellipticPointRhoPlusOne' : ℂ) = 1 := by change Complex.normSq (1/2 + (Real.sqrt 3 / 2) * I : ℂ) = 1 rw [show (1/2 + (Real.sqrt 3 / 2) * I : ℂ) = ((1/2 : ℝ) : ℂ) + (Real.sqrt 3 / 2) * I from by - push_cast; ring] + push_cast; ac_rfl] exact normSq_half_add_sqrt3_half_I (1/2) (by norm_num) theorem ellipticPointRhoPlusOne_norm : ‖ellipticPointRhoPlusOne‖ = 1 := by diff --git a/LeanPool/LeanModularForms/ValenceFormula/InteriorWinding.lean b/LeanPool/LeanModularForms/ValenceFormula/InteriorWinding.lean index fd1350d02e..aa6252c737 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/InteriorWinding.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/InteriorWinding.lean @@ -12,8 +12,6 @@ import LeanPool.LeanModularForms.GeneralizedResidueTheory.Residue import LeanPool.LeanModularForms.ValenceFormula.Boundary.Smooth import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.MainTheorem import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Interior Winding Number @@ -43,12 +41,12 @@ private lemma fdBoundary_H_norm_eq_one_arc {H t : ℝ} (h1 : 1 < t) (h3 : t < 3) by_cases h2 : t ≤ 2 · rw [fdBoundary_H_eq_seg2_H H h1 h2]; simp only [fdBoundarySeg2H, fdBoundarySeg2] rw [show (↑Real.pi / 3 + (↑t - 1) * (↑Real.pi / 2 - ↑Real.pi / 3)) * I = - ↑(Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3)) * I from by push_cast; ring] + ↑(Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3)) * I from by push_cast; ac_rfl] exact norm_exp_ofReal_mul_I _ · push Not at h2 rw [fdBoundary_H_eq_seg3_H H h2 (le_of_lt h3)]; simp only [fdBoundarySeg3H, fdBoundarySeg3] rw [show (↑Real.pi / 2 + (↑t - 2) * (2 * ↑Real.pi / 3 - ↑Real.pi / 2)) * I = - ↑(Real.pi / 2 + (t - 2) * (2 * Real.pi / 3 - Real.pi / 2)) * I from by push_cast; ring] + ↑(Real.pi / 2 + (t - 2) * (2 * Real.pi / 3 - Real.pi / 2)) * I from by push_cast; ac_rfl] exact norm_exp_ofReal_mul_I _ /-- The boundary at height H avoids any strict interior point p @@ -113,15 +111,15 @@ private lemma arc_hasDerivAt' (s : ℝ) : simp only [zero_mul, zero_add] at this; exact this have h4 : HasDerivAt (fun s : ℝ => ↑Real.pi * ((s : ℂ) + 1) / 6 * I) (↑Real.pi * 1 / 6 * I) s := (h3.div_const _).mul_const _ - convert h4 using 1; ring + convert h4 using 1; ac_rfl private lemma fdBoundary_H_hasDerivAt_arc' (H : ℝ) {t : ℝ} (ht1 : 1 < t) (ht3 : t < 3) : HasDerivAt (fdBoundaryH H) (↑(Real.pi / 6) * I * Complex.exp (↑(Real.pi * (1 + t) / 6) * I)) t := by have heq : fdBoundaryH H =ᶠ[𝓝 t] (fun s => Complex.exp ((↑Real.pi * (↑s + 1) / 6) * I)) := Filter.eventuallyEq_iff_exists_mem.mpr ⟨Set.Ioo 1 3, Ioo_mem_nhds ht1 ht3, - fun s hs => (fdBoundary_H_eq_arc' hs.1 hs.2).trans (by congr 1; congr 1; push_cast; ring)⟩ - exact (heq.hasDerivAt_iff.mpr (arc_hasDerivAt' t)).congr_deriv (by push_cast; ring) + fun s hs => (fdBoundary_H_eq_arc' hs.1 hs.2).trans (by congr 1; congr 1; push_cast; ac_rfl)⟩ + exact (heq.hasDerivAt_iff.mpr (arc_hasDerivAt' t)).congr_deriv (by push_cast; ac_rfl) private def heightSens : ℝ → ℂ := fun t => if t ≤ 1 then ↑(1 - t) * I @@ -183,7 +181,7 @@ private lemma fdHomot_deriv_continuousOn_piece (H₀ H₁ : ℝ) (p₁ p₂ : continuous_const).continuousOn · intro q hq convert (fdBoundary_H_hasDerivAt_seg1 _ (lt_of_lt_of_le hq.1.2 h_le1)).deriv using 1 - push_cast; ring + push_cast; ac_rfl · push Not at h_le1 have hp1_ge1 : 1 ≤ p₁ := by by_contra h; push Not at h @@ -210,7 +208,7 @@ private lemma fdHomot_deriv_continuousOn_piece (H₀ H₁ : ℝ) (p₁ p₂ : · intro q hq convert (fdBoundary_H_hasDerivAt_seg4 _ (lt_of_le_of_lt hp1_ge3 hq.1.1) (lt_of_lt_of_le hq.1.2 h_le4)).deriv using 1 - push_cast; ring + push_cast; ac_rfl · push Not at h_le4 have hp1_ge4 : 4 ≤ p₁ := by by_contra h; push Not at h @@ -245,9 +243,9 @@ private lemma fdHomot_deriv_bound (H : ℝ) (hH : heightCutoff ≤ H) : rw [neg_mul, norm_neg, norm_mul, Complex.norm_I, mul_one, show (↑H_s : ℂ) - ↑(Real.sqrt 3) / 2 = ↑(H_s - Real.sqrt 3 / 2) from by - push_cast; ring, + push_cast; ac_rfl, Complex.norm_real, Real.norm_eq_abs, abs_of_pos (sub_pos.mpr hH_s_sqrt)] - exact le_trans (by linarith) (le_max_left _ _) + exact le_trans (by linarith only [hH_s_le]) (le_max_left _ _) · push Not at ht1 have ht1' : 1 < t := lt_of_le_of_ne ht1 (Ne.symm h1) by_cases ht3 : t < 3 @@ -255,7 +253,7 @@ private lemma fdHomot_deriv_bound (H : ℝ) (hH : heightCutoff ≤ H) : rw [norm_mul, norm_mul, Complex.norm_of_nonneg (le_of_lt (by positivity : (0 : ℝ) < Real.pi / 6)), Complex.norm_I, mul_one, Complex.norm_exp_ofReal_mul_I, mul_one] - exact le_trans (by have := Real.pi_le_four; linarith) (le_max_right _ _) + exact le_trans (by have := Real.pi_le_four; linarith only [this]) (le_max_right _ _) · push Not at ht3 have ht3' : 3 < t := lt_of_le_of_ne ht3 (Ne.symm h3) by_cases ht4 : t < 4 @@ -263,9 +261,9 @@ private lemma fdHomot_deriv_bound (H : ℝ) (hH : heightCutoff ≤ H) : rw [norm_mul, Complex.norm_I, mul_one, show (↑H_s : ℂ) - ↑(Real.sqrt 3) / 2 = ↑(H_s - Real.sqrt 3 / 2) from by - push_cast; ring, + push_cast; ac_rfl, Complex.norm_real, Real.norm_eq_abs, abs_of_pos (sub_pos.mpr hH_s_sqrt)] - exact le_trans (by linarith) (le_max_left _ _) + exact le_trans (by linarith only [hH_s_le]) (le_max_left _ _) · push Not at ht4 have ht4' : 4 < t := lt_of_le_of_ne ht4 (Ne.symm h4) erw [(fdBoundary_H_hasDerivAt_seg5 H_s ht4').deriv]; rw [norm_one] @@ -352,7 +350,7 @@ theorem gWN_fdBoundary_H_eq_neg_one_of_strictInterior simp only [q, add_re, ofReal_re, mul_re, ofReal_im, I_re, I_im]; ring have hq_im : q.im = Hmid := by simp only [q, add_im, ofReal_im, mul_im, ofReal_re, I_re, I_im]; ring - have hq_im_pos : 0 < q.im := hq_im ▸ by linarith + have hq_im_pos : 0 < q.im := hq_im ▸ by linarith only [hHmid_gt1] have hq_norm : ‖q‖ > 1 := by linarith [Complex.abs_im_le_norm q, abs_of_pos hq_im_pos] have hq_re_bound : |q.re| < 1 / 2 := hq_re ▸ hp_re have hq_im_lt : q.im < heightCutoff := hq_im ▸ hHmid_lt @@ -383,8 +381,8 @@ theorem gWN_fdBoundary_H_eq_neg_one_of_strictInterior rw [hzs_im]; nlinarith [hs.1, hs.2, hp_low, hHmid_lt] exact fdBoundary_H_avoids_interior (zPath s) (by linarith [Complex.abs_im_le_norm (zPath s), - abs_of_pos (show 0 < (zPath s).im by linarith)]) - (by rw [hzs_re]; exact hp_re) (by linarith) + abs_of_pos (show 0 < (zPath s).im by linarith only [hHmid_gt1, hzs_im_ge])]) + (by rw [hzs_re]; exact hp_re) (by linarith only [hHmid_gt1, hzs_im_ge]) (by rw [hzs_im]; nlinarith [hs.1, hs.2, hp_im, hHmid_lt, hH]) t ht · intro t _ ht_not_P s _ @@ -424,7 +422,7 @@ theorem gWN_fdBoundary_H_eq_neg_one_of_strictInterior exact hM t ht · have hnd : ¬DifferentiableAt ℝ (fun t' => fdBoundaryH H t' - zPath s) t := by erw [show (fun t' => fdBoundaryH H t' - zPath s) = - fun t' => fdBoundaryH H t' + (-zPath s) from by ext; ring, + fun t' => fdBoundaryH H t' + (-zPath s) from by ext; ac_rfl, differentiableAt_add_const_iff] exact hd erw [deriv_zero_of_not_differentiableAt hnd]; rw [norm_zero] diff --git a/LeanPool/LeanModularForms/ValenceFormula/ModularInvariance.lean b/LeanPool/LeanModularForms/ValenceFormula/ModularInvariance.lean index d6c7f77a42..772b549791 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/ModularInvariance.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/ModularInvariance.lean @@ -119,7 +119,7 @@ private lemma neg_inv_finite_order_witness (g : ℂ → ℂ) (p : ℂ) (hp : p simp only [smul_eq_mul] at hz_eq ⊢ rw [hz_eq, show -z⁻¹ - -p⁻¹ = (z - p) * (z * p)⁻¹ from by field_simp; ring, mul_zpow] calc (z - p) ^ n * (z * p)⁻¹ ^ n * h (-z⁻¹) = (z - p) ^ n * ((z * p) ^ (-n) * h (-z⁻¹)) := by - rw [inv_zpow, zpow_neg]; ring + rw [inv_zpow, zpow_neg]; ac_rfl private lemma meromorphicOrderAt_comp_neg_inv (g : ℂ → ℂ) (p : ℂ) (hp : p ≠ 0) : meromorphicOrderAt (fun z => g (-z⁻¹)) p = meromorphicOrderAt g (-p⁻¹) := by @@ -142,7 +142,7 @@ lemma ord_add_one_eq (p : ℍ) : unfold orderOfVanishingAt' set G : ℂ → ℂ := fun w => if h : 0 < w.im then f ⟨w, h⟩ else 0 with hG_def set p_cplx : ℂ := (p : ℂ) with hp_def - conv_lhs => rw [show (((1 : ℝ) +ᵥ p : ℍ) : ℂ) = p_cplx + 1 by simp [hp_def]; ring] + conv_lhs => rw [show (((1 : ℝ) +ᵥ p : ℍ) : ℂ) = p_cplx + 1 by simp [hp_def]; ac_rfl] have hG_eq_near : G =ᶠ[𝓝[≠] (p_cplx + 1)] (fun w => G (w - 1)) := by rw [Filter.EventuallyEq, eventually_nhdsWithin_iff] filter_upwards [isOpen_lt continuous_const continuous_im |>.mem_nhds @@ -173,7 +173,8 @@ lemma modform_comp_ofComplex_S_identity (z : ℂ) (hz : 0 < z.im) : have hz_ne : z ≠ 0 := by intro h; simp [h] at hz have h_neg_inv_im : 0 < (-(1 : ℂ)/z).im := by rw [show -(1 : ℂ)/z = (-z)⁻¹ from by field_simp, Complex.inv_im] - exact div_pos (by simp [hz]) (Complex.normSq_pos.mpr (neg_ne_zero.mpr hz_ne)) + exact div_pos (by simp only [neg_im, neg_neg, + hz]) (Complex.normSq_pos.mpr (neg_ne_zero.mpr hz_ne)) rw [UpperHalfPlane.ofComplex_apply_of_im_pos hz, UpperHalfPlane.ofComplex_apply_of_im_pos h_neg_inv_im] set z_uhp : UpperHalfPlane := ⟨z, hz⟩ @@ -195,7 +196,8 @@ private lemma modform_G_S_identity have hz_ne : z ≠ 0 := by intro h; simp [h] at hz have h_neg_inv_im : 0 < (-z⁻¹).im := by rw [neg_inv, Complex.inv_im] - exact div_pos (by simp [hz]) (Complex.normSq_pos.mpr (neg_ne_zero.mpr hz_ne)) + exact div_pos (by simp only [neg_im, neg_neg, + hz]) (Complex.normSq_pos.mpr (neg_ne_zero.mpr hz_ne)) simp only [dite_eq_left h_neg_inv_im, dite_eq_left hz] have h_eq := modform_comp_ofComplex_S_identity f z hz rw [show -(1 : ℂ)/z = -z⁻¹ from by field_simp] at h_eq @@ -254,7 +256,8 @@ lemma ord_S_eq (p : ℍ) : _ = meromorphicOrderAt (fun z : ℂ => z ^ k) p_cplx + meromorphicOrderAt G p_cplx := meromorphicOrderAt_mul (analyticAt_id.zpow hp_ne).meromorphicAt (modform_G_meromorphicAt f G hG_def p) - _ = meromorphicOrderAt G p_cplx := by simp [meromorphicOrderAt_zpow_eq_zero p_cplx hp_ne] + _ = meromorphicOrderAt G p_cplx := by simp only [meromorphicOrderAt_zpow_eq_zero p_cplx hp_ne, + zero_add] /-- An open box containing the truncated fundamental domain. -/ def fdBox (M : ℝ) : Set ℂ := {z : ℂ | -1 < z.re ∧ z.re < 1 ∧ (1 : ℝ)/2 < z.im ∧ z.im < M} @@ -301,7 +304,8 @@ theorem cuspFunction_not_eventually_zero (hf : f ≠ 0) : have h_diff : DifferentiableOn ℂ (UpperHalfPlane.cuspFunction (1 : ℝ) (⇑f)) (Metric.ball 0 1) := fun q hq => (ModularFormClass.differentiableAt_cuspFunction f - (by norm_num : (0 : ℝ) < 1) (by simp) + (by norm_num : (0 : ℝ) < 1) (by simp only [strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) (by rwa [Metric.mem_ball, dist_zero_right] at hq)).differentiableWithinAt have h_anal : AnalyticOnNhd ℂ (UpperHalfPlane.cuspFunction (1 : ℝ) (⇑f)) (Metric.ball 0 1) := h_diff.analyticOnNhd Metric.isOpen_ball @@ -310,7 +314,8 @@ theorem cuspFunction_not_eventually_zero (hf : f ≠ 0) : (convex_ball 0 1).isPreconnected (Metric.mem_ball_self (by norm_num : (0 : ℝ) < 1)) h_freq apply hf; ext τ simp only [FunLike.coe_zero, Pi.zero_apply] - rw [← SlashInvariantFormClass.eq_cuspFunction f τ (by simp) + rw [← SlashInvariantFormClass.eq_cuspFunction f τ (by simp only [strictPeriods_Gamma, + Nat.cast_one, AddSubgroup.mem_zmultiples]) (by norm_num : (1 : ℝ) ≠ 0)] have h_qmem : Function.Periodic.qParam (1 : ℝ) (↑τ : ℂ) ∈ Metric.ball (0 : ℂ) 1 := by @@ -324,7 +329,8 @@ theorem cuspFunction_eventually_ne_zero (hf : f ≠ 0) : UpperHalfPlane.cuspFunction (1 : ℝ) (⇑f) q ≠ 0 := by have h_anal : AnalyticAt ℂ (UpperHalfPlane.cuspFunction (1 : ℝ) (⇑f)) 0 := ModularFormClass.analyticAt_cuspFunction_zero f - (by norm_num : (0 : ℝ) < 1) (by simp) + (by norm_num : (0 : ℝ) < 1) (by simp only [strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) exact h_anal.eventually_eq_zero_or_eventually_ne_zero.resolve_left (cuspFunction_not_eventually_zero f hf) diff --git a/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/Basic.lean b/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/Basic.lean index f2af6d891d..24fa06036f 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/Basic.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/Basic.lean @@ -15,8 +15,6 @@ import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Rho import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.RhoPlusOne import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # On-Curve PV: Infrastructure diff --git a/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/EndpointCorner.lean b/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/EndpointCorner.lean index 422927d1b3..9aced33826 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/EndpointCorner.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/EndpointCorner.lean @@ -13,8 +13,6 @@ import LeanPool.LeanModularForms.ValenceFormula.OnCurvePV.Basic import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # On-Curve PV: Endpoint and Corner CPV @@ -52,10 +50,11 @@ private lemma integral_inv_eq_log_sub (a : ℝ) (ha : 0 < a) (ha1 : a ≤ 1) : intro t ht; rw [Set.uIcc_of_le ha1] at ht exact Real.hasDerivAt_log (by linarith [ht.1] : t ≠ 0) have hint : IntervalIntegrable (fun t : ℝ => t⁻¹) MeasureTheory.volume a 1 := by - simp_all + simp_all only [uIcc_of_le, mem_Icc, and_imp, intervalIntegrable_inv_iff, zero_le_one, and_true, + not_le, or_true] rw [intervalIntegral.integral_eq_sub_of_hasDerivAt hderiv hint, Real.log_one, Complex.ofReal_one, Complex.log_one, ← Complex.ofReal_log ha.le] - push_cast; ring + push_cast; ac_rfl /-- `∫ t in 4..(5 - η), (t - 5)⁻¹ = log η` for `0 < η < 1`. -/ private lemma integral_shifted_inv_eq_log (η : ℝ) (hη : 0 < η) (hη1 : η < 1) : @@ -71,7 +70,8 @@ private lemma integral_shifted_inv_eq_log (η : ℝ) (hη : 0 < η) (hη1 : η < have h1 := (Real.hasDerivAt_log this).comp t ((hasDerivAt_id t).sub_const 5) simp only [Function.comp_def, mul_one] at h1; exact h1 have hint : IntervalIntegrable (fun t => (t - 5)⁻¹) MeasureTheory.volume 4 (5 - η) := by - simp_all + simp_all only [uIcc_of_le, mem_Icc, and_imp, intervalIntegrable_sub_inv_iff, le_sub_self_iff, + not_and, not_le, implies_true, or_true] rw [intervalIntegral.integral_eq_sub_of_hasDerivAt hderiv hint] simp only [show 5 - η - 5 = -η from by ring, show (4 : ℝ) - 5 = -(1 : ℝ) from by ring] rw [Real.log_neg_eq_log, Real.log_neg_eq_log, Real.log_one, sub_zero] @@ -176,7 +176,7 @@ private lemma endpoint_integrand_seg1 (H : ℝ) (s : ℂ) (hs_def : s = (1 / 2 : (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t = (↑t : ℂ)⁻¹ := by rw [endpoint_diff_seg1 H s hs_def c hc_def t ht0.le ht1.le] erw [(fdBoundary_H_hasDerivAt_seg1 H ht1).deriv] - have hc_eq : (↑H - ↑(Real.sqrt 3) / 2 : ℂ) = ↑c := by push_cast [hc_def]; ring + have hc_eq : (↑H - ↑(Real.sqrt 3) / 2 : ℂ) = ↑c := by push_cast [hc_def]; ac_rfl have hrw1 : (-(↑H - ↑(Real.sqrt 3) / 2 : ℂ)) * I = -(↑c : ℂ) * I := by rw [hc_eq] have hrw2 : (↑(-t * c) : ℂ) * I = ↑t * (-(↑c : ℂ) * I) := by push_cast; ring rw [hrw1, hrw2] @@ -213,13 +213,14 @@ lemma cpv_at_endpoint (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : have hε_1 : ε < 1 := by have := min_le_right c (min 1 δ); have := min_le_left 1 δ; linarith have hε_δ : ε < δ := by have := min_le_right c (min 1 δ); have := min_le_right 1 δ; linarith have hε₀2_pos : 0 < ε₀ / 2 := by positivity - have hε₀2_c : ε₀ / 2 < c := by have := min_le_left c (min 1 δ); linarith + have hε₀2_c : ε₀ / 2 < c := by have := min_le_left c (min 1 δ); linarith only [hε, hε_c, this] have hε₀2_1 : ε₀ / 2 < 1 := by have := min_le_right c (min 1 δ); have := min_le_left 1 δ; linarith have hε₀2_δ : ε₀ / 2 < δ := by have := min_le_right c (min 1 δ); have := min_le_right 1 δ; linarith suffices h_formula : ∀ η, 0 < η → η < c → η < 1 → η < δ → F η = ↑(Real.log c) + C by - simp_all + simp_all only [one_div, sub_pos, ne_eq, gt_iff_lt, mem_Icc, and_imp, lt_min_iff, zero_lt_one, + and_self, and_true, div_pos_iff_of_pos_left, Nat.ofNat_pos] intro η hη hη_c hη_1 hη_δ have hη_div_c_pos : 0 < η / c := div_pos hη hc have hη_div_c_lt_1 : η / c < 1 := (div_lt_one hc).mpr hη_c @@ -279,13 +280,13 @@ lemma cpv_at_endpoint (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : then (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t else 0) = ∫ t in (η / c)..1, (↑t : ℂ)⁻¹ := by rw [← intervalIntegral.integral_add_adjacent_intervals (hii.mono_set (by - rw [Set.uIcc_of_le (by linarith : (0 : ℝ) ≤ η / c), + rw [Set.uIcc_of_le (by exact le_of_lt hη_div_c_pos : (0 : ℝ) ≤ η / c), Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 5)] - exact Set.Icc_subset_Icc_right (by linarith))) + exact Set.Icc_subset_Icc_right (by linarith only [hε, hε_1, hη_div_c_lt_1]))) (hii.mono_set (by - rw [Set.uIcc_of_le (by linarith : η / c ≤ 1), + rw [Set.uIcc_of_le (by exact le_of_lt hη_div_c_lt_1 : η / c ≤ 1), Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 5)] - exact Set.Icc_subset_Icc (by linarith) (by norm_num)))] + exact Set.Icc_subset_Icc (by exact le_of_lt hη_div_c_pos) (by norm_num)))] have h_zero : (∫ t in (0 : ℝ)..(η / c), if η < ‖fdBoundaryH H t - s‖ then (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t else 0) = 0 := by @@ -293,7 +294,7 @@ lemma cpv_at_endpoint (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : then (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t else 0) = ∫ _ in (0 : ℝ)..(η / c), (0 : ℂ) := intervalIntegral.integral_congr (fun t ht => by - rw [Set.uIcc_of_le (by linarith : (0 : ℝ) ≤ η / c)] at ht + rw [Set.uIcc_of_le (by exact le_of_lt hη_div_c_pos : (0 : ℝ) ≤ η / c)] at ht rw [ite_eq_right]; push Not rw [h_norm_seg1 t ht.1 (by linarith [ht.2])] calc t * c ≤ (η / c) * c := mul_le_mul_of_nonneg_right ht.2 hc.le @@ -319,13 +320,13 @@ lemma cpv_at_endpoint (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : then (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t else 0) = ∫ t in (4 : ℝ)..(5 - η), (↑(t - 5) : ℂ)⁻¹ := by rw [← intervalIntegral.integral_add_adjacent_intervals (hii.mono_set (by - rw [Set.uIcc_of_le (by linarith : (4 : ℝ) ≤ 5 - η), + rw [Set.uIcc_of_le (by linarith only [hη_1] : (4 : ℝ) ≤ 5 - η), Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 5)] - exact Set.Icc_subset_Icc (by norm_num) (by linarith))) + exact Set.Icc_subset_Icc (by norm_num) (by linarith only [hη]))) (hii.mono_set (by - rw [Set.uIcc_of_le (by linarith : 5 - η ≤ 5), + rw [Set.uIcc_of_le (by linarith only [hη] : 5 - η ≤ 5), Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 5)] - exact Set.Icc_subset_Icc_left (by linarith)))] + exact Set.Icc_subset_Icc_left (by linarith only [hε, hε_1, hη_1])))] have h_zero : (∫ t in (5 - η)..5, if η < ‖fdBoundaryH H t - s‖ then (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t else 0) = 0 := by @@ -333,7 +334,7 @@ lemma cpv_at_endpoint (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : then (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t else 0) = ∫ _ in (5 - η)..5, (0 : ℂ) := intervalIntegral.integral_congr (fun t ht => by - rw [Set.uIcc_of_le (by linarith : 5 - η ≤ 5)] at ht + rw [Set.uIcc_of_le (by linarith only [hη] : 5 - η ≤ 5)] at ht rw [ite_eq_right]; push Not by_cases ht5 : t = 5 · rw [ht5, fdBoundary_H_at_five, hs_def, sub_self, norm_zero]; exact hη.le @@ -354,7 +355,7 @@ lemma cpv_at_endpoint (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : have ht_strict : t < 5 - η := lt_of_le_of_ne ht.2 (fun h => ht_ne_high (Set.mem_singleton_iff.mpr h)) rw [ite_eq_left, h_integrand_seg5 t ht4] - rw [h_norm_seg5 t ht4 (by linarith)]; linarith + rw [h_norm_seg5 t ht4 (by linarith only [hη, ht_strict])]; linarith only [ht_strict] have h_int1 : ∫ t in (η / c)..1, (↑t : ℂ)⁻¹ = Complex.log ↑(1 : ℝ) - Complex.log ↑(η / c) := integral_inv_eq_log_sub (η / c) hη_div_c_pos hη_div_c_lt_1.le @@ -416,7 +417,7 @@ private lemma integral_inv_shift_four (a b : ℝ) : (∫ t in a..b, (↑(t - 4) : ℂ)⁻¹) = ∫ u in (a - 4)..(b - 4), (↑u : ℂ)⁻¹ := by simp_rw [← Complex.ofReal_inv] rw [intervalIntegral.integral_ofReal, intervalIntegral.integral_ofReal] - simp_all + simp_all only [intervalIntegral.integral_comp_sub_right] private lemma integral_inv_neg_axis (r : ℝ) : (∫ u in (-1 : ℝ)..(-r), (↑u : ℂ)⁻¹) = -(∫ u in r..1, (↑u : ℂ)⁻¹) := by @@ -425,7 +426,7 @@ private lemma integral_inv_neg_axis (r : ℝ) : ← Complex.ofReal_neg, Complex.ofReal_inj] have key : (∫ x in r..(1 : ℝ), (-x)⁻¹) = ∫ x in (-1 : ℝ)..-r, x⁻¹ := intervalIntegral.integral_comp_neg (fun u : ℝ => u⁻¹) (a := r) (b := 1) - simp_all + simp_all only [inv_neg, intervalIntegral.integral_neg] lemma cpv_at_corner (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : CauchyPrincipalValueExists' (fun z => (z - (-(1/2 : ℂ) + ↑H * I))⁻¹) @@ -481,14 +482,14 @@ lemma cpv_at_corner (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : ‖fdBoundaryH H t - s‖ = t - 4 := by intro t ht4 rw [h_diff_seg5 t ht4, Complex.norm_real, Real.norm_eq_abs, - abs_of_pos (by linarith)] + abs_of_pos (by exact sub_pos.mpr ht4)] have h_integrand_seg4 : ∀ t, 3 < t → t < 4 → (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t = (↑(t - 4) : ℂ)⁻¹ := by intro t ht3 ht4 rw [h_diff_seg4 t ht3 ht4.le]; erw [(fdBoundary_H_hasDerivAt_seg4 H ht3 ht4).deriv] - have hc_eq : (↑H - ↑(Real.sqrt 3) / 2 : ℂ) = ↑c := by push_cast [hc_def]; ring + have hc_eq : (↑H - ↑(Real.sqrt 3) / 2 : ℂ) = ↑c := by push_cast [hc_def]; ac_rfl have hrw1 : (↑H - ↑(Real.sqrt 3) / 2 : ℂ) * I = (↑c : ℂ) * I := by rw [hc_eq] - have hrw2 : (↑((t - 4) * c) : ℂ) * I = ↑(t - 4) * (↑c * I) := by push_cast; ring + have hrw2 : (↑((t - 4) * c) : ℂ) * I = ↑(t - 4) * (↑c * I) := by push_cast; ac_rfl rw [hrw1, hrw2] exact inv_mul_mul_cancel ↑(t - 4) _ (mul_ne_zero (Complex.ofReal_ne_zero.mpr hc.ne') I_ne_zero) @@ -517,13 +518,13 @@ lemma cpv_at_corner (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : have h_4mc_le : 4 - η / c ≤ 4 := by linarith [hη_div_c_pos] rw [← intervalIntegral.integral_add_adjacent_intervals (IntervalIntegrable.mono_set (fdBoundary_H_cutout_ii H hH s η hη) - (by rw [Set.uIcc_of_le (by linarith : (3 : ℝ) ≤ 4 - η / c), + (by rw [Set.uIcc_of_le (by exact le_of_lt h_4mc : (3 : ℝ) ≤ 4 - η / c), Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 5)] - exact Set.Icc_subset_Icc (by norm_num) (by linarith))) + exact Set.Icc_subset_Icc (by norm_num) (by linarith only [hε, hε_1, hη_div_c_pos]))) (IntervalIntegrable.mono_set (fdBoundary_H_cutout_ii H hH s η hη) - (by rw [Set.uIcc_of_le (by linarith : 4 - η / c ≤ 4), + (by rw [Set.uIcc_of_le (by exact h_4mc_le : 4 - η / c ≤ 4), Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 5)] - exact Set.Icc_subset_Icc (by linarith) (by norm_num)))] + exact Set.Icc_subset_Icc (by linarith only [hε, hε_1, hη_div_c_lt_1]) (by norm_num)))] have h_zero : (∫ t in (4 - η / c)..4, if η < ‖fdBoundaryH H t - s‖ then (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t else 0) = 0 := by @@ -554,22 +555,22 @@ lemma cpv_at_corner (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : have ht4 : t < 4 := by linarith [hη_div_c_pos] rw [ite_eq_left, h_integrand_seg4 t ht3 ht4] rw [h_norm_seg4 t ht3 ht4.le] - have : η / c < 4 - t := by linarith + have : η / c < 4 - t := by linarith only [ht4_strict] calc η = (η / c) * c := by field_simp _ < (4 - t) * c := mul_lt_mul_of_pos_right this hc have h_I45 : (∫ t in (4 : ℝ)..5, if η < ‖fdBoundaryH H t - s‖ then (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t else 0) = ∫ t in (4 + η)..5, (↑(t - 4) : ℂ)⁻¹ := by - have h_4ph : 4 + η ≤ 5 := by linarith + have h_4ph : 4 + η ≤ 5 := by linarith only [hη_1] rw [← intervalIntegral.integral_add_adjacent_intervals (IntervalIntegrable.mono_set (fdBoundary_H_cutout_ii H hH s η hη) - (by rw [Set.uIcc_of_le (by linarith : (4 : ℝ) ≤ 4 + η), + (by rw [Set.uIcc_of_le (by linarith only [hη] : (4 : ℝ) ≤ 4 + η), Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 5)] - exact Set.Icc_subset_Icc (by norm_num) (by linarith))) + exact Set.Icc_subset_Icc (by norm_num) (by exact h_4ph))) (IntervalIntegrable.mono_set (fdBoundary_H_cutout_ii H hH s η hη) (by rw [Set.uIcc_of_le h_4ph, Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 5)] - exact Set.Icc_subset_Icc (by linarith) (by norm_num)))] + exact Set.Icc_subset_Icc (by linarith only [hε, hε_1, hη]) (by norm_num)))] have h_zero : (∫ t in (4 : ℝ)..(4 + η), if η < ‖fdBoundaryH H t - s‖ then (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t else 0) = 0 := by @@ -578,13 +579,13 @@ lemma cpv_at_corner (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : then (fdBoundaryH H t - s)⁻¹ * deriv (fdBoundaryH H) t else 0) = ∫ _ in (4 : ℝ)..(4 + η), (0 : ℂ) := intervalIntegral.integral_congr (fun t ht => by - rw [Set.uIcc_of_le (by linarith : (4 : ℝ) ≤ 4 + η)] at ht + rw [Set.uIcc_of_le (by linarith only [hη] : (4 : ℝ) ≤ 4 + η)] at ht rw [ite_eq_right]; push Not by_cases ht4 : t = 4 · subst ht4 rw [fdBoundary_H_at_four H, hs_def] norm_num - linarith + exact le_of_lt hη · have ht4' : 4 < t := lt_of_le_of_ne ht.1 (Ne.symm ht4) rw [h_norm_seg5 t ht4']; linarith [ht.2]) rw [this, intervalIntegral.integral_zero] diff --git a/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/Main.lean b/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/Main.lean index c97bea2cb5..15c0ce266c 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/Main.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/OnCurvePV/Main.lean @@ -14,8 +14,6 @@ import LeanPool.LeanModularForms.ValenceFormula.OnCurvePV.EndpointCorner import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # On-Curve PV: Main Theorem @@ -177,13 +175,13 @@ private theorem cpv_exists_generic_seg1 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s apply cpv_extend_to_full_interval H hH s (t₀ / 2) ((t₀ + 1) / 2) (by linarith only [ht₀_mem]) (by linarith only [ht₀_mem]) (by linarith only []) · apply cpv_exists_on_smooth_subinterval H hH s - ⟨by linarith, by linarith⟩ hγt₀ + ⟨by linarith only [ht₀_gt_0], by linarith only [ht₀_lt_1]⟩ hγt₀ · have heq : fdBoundaryH H =ᶠ[𝓝 t₀] (fun t => (1/2 : ℂ) + ↑(H - t * (H - Real.sqrt 3 / 2)) * I) := Filter.eventuallyEq_iff_exists_mem.mpr ⟨Set.Iio 1, Iio_mem_nhds ht₀_lt_1, fun t ht => by rw [fdBoundary_H_eq_seg1_H (le_of_lt ht)] - simp [fdBoundarySeg1H]⟩ + simp only [fdBoundarySeg1H, one_div, ofReal_sub, ofReal_mul, ofReal_div, ofReal_ofNat]⟩ apply ContDiffAt.congr_of_eventuallyEq _ heq exact contDiffAt_const.add ((Complex.ofRealCLM.contDiff.contDiffAt.comp t₀ (contDiffAt_const.sub (contDiffAt_id.mul contDiffAt_const))).mul contDiffAt_const) @@ -205,7 +203,7 @@ private theorem cpv_exists_generic_seg1 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s mul_eq_mul_right_iff] at h_im rcases h_im with rfl | h_abs · rfl - · linarith + · linarith only [hH, h_abs] · intro t ht h_eq have ht1 : t ≤ 1 := by linarith [ht.2] rw [fdBoundary_H_eq_seg1_H ht1, @@ -218,7 +216,7 @@ private theorem cpv_exists_generic_seg1 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s mul_eq_mul_right_iff] at h_im rcases h_im with rfl | h_abs · linarith [ht.2] - · linarith + · linarith only [hH, h_abs] · have h_re_s : s.re = 1/2 := by rw [← hγt₀] exact fdBoundary_H_seg1_re' H (le_of_lt ht₀_gt_0) (le_of_lt ht₀_lt_1) @@ -226,14 +224,14 @@ private theorem cpv_exists_generic_seg1 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s rw [← hγt₀, fdBoundary_H_eq_seg1_H (le_of_lt ht₀_lt_1)] simp [fdBoundarySeg1H, Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.I_re, Complex.I_im, Complex.ofReal_re] - nlinarith + nlinarith only [hH, ht₀_gt_0] have h_norm_s_gt : 1 < Complex.normSq s := by rw [Complex.normSq_apply, h_re_s] have h_im_s_gt : Real.sqrt 3 / 2 < s.im := by rw [← hγt₀, fdBoundary_H_eq_seg1_H (le_of_lt ht₀_lt_1)] simp [fdBoundarySeg1H, Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.I_re, Complex.I_im, Complex.ofReal_re] - nlinarith + nlinarith only [hH, ht₀_lt_1] nlinarith [Real.mul_self_sqrt (show (0 : ℝ) ≤ 3 from by norm_num), mul_self_lt_mul_self (by positivity : (0 : ℝ) ≤ Real.sqrt 3 / 2) h_im_s_gt] intro t ht h_eq @@ -248,23 +246,23 @@ private theorem cpv_exists_generic_seg1 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s mul_eq_mul_right_iff] at h_im rcases h_im with rfl | h_abs · linarith [ht.1] - · linarith + · linarith only [hH, h_abs] · push Not at ht1 by_cases ht3 : t < 3 · have h_norm_arc : Complex.normSq (fdBoundaryH H t) = 1 := by rw [fdBoundary_H_eq_arc ht1 ht3, Complex.normSq_apply, Complex.exp_ofReal_mul_I_re, Complex.exp_ofReal_mul_I_im] linarith [Real.sin_sq_add_cos_sq (Real.pi * (1 + t) / 6)] - rw [h_eq] at h_norm_arc; linarith + rw [h_eq] at h_norm_arc; linarith only [h_norm_s_gt, h_norm_arc] · push Not at ht3 by_cases ht4 : t ≤ 4 · rcases eq_or_lt_of_le ht3 with rfl | ht3' · rw [fdBoundary_H_at_three] at h_eq; exact hs_rho h_eq.symm · have h_re_t := fdBoundary_H_seg4_re' H ht3' ht4 - rw [h_eq] at h_re_t; linarith + rw [h_eq] at h_re_t; linarith only [ht₀_lt_1, ht₀_gt_0, h_re_s, h_re_t] · push Not at ht4 have h_im_t := fdBoundary_H_seg5_im' H ht4 ht.2 - rw [h_eq] at h_im_t; linarith + rw [h_eq] at h_im_t; linarith only [h_im_s_lt, h_im_t] /-! ### Helper: generic case, t₀ on arc (1 < t₀ < 3) with seg5 crossing -/ @@ -278,8 +276,8 @@ private theorem cpv_exists_generic_arc_seg5_cross (H : ℝ) (hH : Real.sqrt 3 / (h_seg5_cross : s.im = H) : CauchyPrincipalValueExists' (fun z => (z - s)⁻¹) (fdBoundaryH H) 0 5 s := by set t₁ := s.re + 9/2 with ht₁_def - have ht₁_gt4 : 4 < t₁ := by simp [ht₁_def]; linarith only [h_re_s_gt] - have ht₁_lt5 : t₁ < 5 := by simp [ht₁_def]; linarith only [h_re_s_lt] + have ht₁_gt4 : 4 < t₁ := by simp only [ht₁_def]; linarith only [h_re_s_gt] + have ht₁_lt5 : t₁ < 5 := by simp only [ht₁_def]; linarith only [h_re_s_lt] have hγt₁ : fdBoundaryH H t₁ = s := by rw [fdBoundary_H_eq_seg5_H (by linarith only [ht₁_gt4] : 4 < t₁)] apply Complex.ext @@ -296,7 +294,7 @@ private theorem cpv_exists_generic_arc_seg5_cross (H : ℝ) (hH : Real.sqrt 3 / (↑(u - 9/2) : ℂ) + ↑H * I := by intro u (hu : 4 < u) rw [fdBoundary_H_eq_seg5_H hu] - simp [fdBoundarySeg5H] + simp only [fdBoundarySeg5H, ofReal_sub, ofReal_div, ofReal_ofNat] have heq : fdBoundaryH H =ᶠ[𝓝 t₁] (fun t => (↑(t - 9/2) : ℂ) + ↑H * I) := Filter.eventuallyEq_iff_exists_mem.mpr ⟨Set.Ioi 4, Ioi_mem_nhds ht₁_gt4, heq_fn⟩ @@ -355,7 +353,7 @@ private theorem cpv_exists_generic_arc_seg5_cross (H : ℝ) (hH : Real.sqrt 3 / · push Not at ht4 have := fdBoundary_H_seg5_re' H ht4 (by linarith only [ht₁_gt4, ht₁_lt5, ht, ht.2]) rw [h_eq] at this - simp [ht₁_def] at *; linarith only [ht4, this, ht, ht.2] + simp only [one_div, ht₁_def, mem_Icc] at *; linarith only [ht4, this, ht, ht.2] have h_cpv_mid : CauchyPrincipalValueExists' (fun z => (z - s)⁻¹) (fdBoundaryH H) ((t₀ + 3) / 2) ((t₁ + 5) / 2) s := by apply cpv_concat _ _ ((t₀ + 3) / 2) ((t₁ + 4) / 2) ((t₁ + 5) / 2) s @@ -384,7 +382,7 @@ private theorem cpv_exists_generic_arc_seg5_cross (H : ℝ) (hH : Real.sqrt 3 / have ht4 : 4 < t := by linarith only [ht₁_gt4, ht₁_lt5, ht, ht.1] have := fdBoundary_H_seg5_re' H ht4 ht.2 rw [h_eq] at this - simp [ht₁_def] at *; linarith only [this, h_re_s_lt, ht, ht.1] + simp only [one_div, ht₁_def, mem_Icc] at *; linarith only [this, h_re_s_lt, ht, ht.1] exact cpv_concat _ _ 0 ((t₁ + 5) / 2) 5 s h_cpv_0_t1h h_cpv_end (by linarith only [ht₁_gt4, ht₁_lt5]) (by linarith only [ht₁_lt5]) (fun ε hε => fdBoundary_H_cutout_ii H hH s ε hε) @@ -506,9 +504,9 @@ private theorem cpv_exists_generic_seg4 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s (ht₀_gt_3 : 3 < t₀) (ht₀_lt_4 : t₀ < 4) : CauchyPrincipalValueExists' (fun z => (z - s)⁻¹) (fdBoundaryH H) 0 5 s := by apply cpv_extend_to_full_interval H hH s ((t₀ + 3) / 2) ((t₀ + 4) / 2) - (by linarith) (by linarith) (by linarith only []) + (by linarith only [ht₀_gt_3, ht₀_lt_4]) (by linarith) (by linarith only []) · apply cpv_exists_on_smooth_subinterval H hH s - ⟨by linarith, by linarith⟩ hγt₀ + ⟨by linarith only [ht₀_gt_3], by linarith only [ht₀_lt_4]⟩ hγt₀ · have heq_fn : ∀ u ∈ Set.Ioo (3 : ℝ) 4, fdBoundaryH H u = (-(1/2 : ℂ) + ↑(Real.sqrt 3 / 2 + (u - 3) * (H - Real.sqrt 3 / 2)) * I) := by @@ -544,20 +542,20 @@ private theorem cpv_exists_generic_seg4 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s Complex.mul_im, Complex.I_re, Complex.I_im, Complex.ofReal_re] have h_im_eq : (fdBoundaryH H t).im = (fdBoundaryH H t₀).im := by rw [hγt] rw [h_im_t, h_im_t₀] at h_im_eq - have hH_pos : (0 : ℝ) < H - Real.sqrt 3 / 2 := by linarith + have hH_pos : (0 : ℝ) < H - Real.sqrt 3 / 2 := by linarith only [hH] have h_mul_eq : (t - 3) * (H - Real.sqrt 3 / 2) = - (t₀ - 3) * (H - Real.sqrt 3 / 2) := by linarith + (t₀ - 3) * (H - Real.sqrt 3 / 2) := by linarith only [h_im_eq] linarith [mul_right_cancel₀ hH_pos.ne' h_mul_eq] · have h_re_s : s.re = -1/2 := by rw [← hγt₀]; exact fdBoundary_H_seg4_re' H ht₀_gt_3 (le_of_lt ht₀_lt_4) have h_norm_s_gt : 1 < Complex.normSq s := by rw [Complex.normSq_apply, h_re_s] have h_im_s_gt : Real.sqrt 3 / 2 < s.im := by - rw [← hγt₀, fdBoundary_H_eq_seg4_H (by linarith : 3 < t₀) + rw [← hγt₀, fdBoundary_H_eq_seg4_H (by linarith only [ht₀_gt_3] : 3 < t₀) (le_of_lt ht₀_lt_4)] simp [fdBoundarySeg4H, Complex.add_im, Complex.neg_im, Complex.ofReal_im, Complex.mul_im, Complex.I_re, Complex.I_im, Complex.ofReal_re] - nlinarith + nlinarith only [hH, ht₀_gt_3] nlinarith [Real.mul_self_sqrt (show (0 : ℝ) ≤ 3 from by norm_num), mul_self_lt_mul_self (by positivity : (0 : ℝ) ≤ Real.sqrt 3 / 2) h_im_s_gt] intro t ht h_eq @@ -569,13 +567,13 @@ private theorem cpv_exists_generic_seg4 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s rw [fdBoundary_H_eq_arc ht1 ht3, Complex.normSq_apply, Complex.exp_ofReal_mul_I_re, Complex.exp_ofReal_mul_I_im] linarith [Real.sin_sq_add_cos_sq (Real.pi * (1 + t) / 6)] - rw [h_eq] at h_norm_arc; linarith + rw [h_eq] at h_norm_arc; linarith only [h_norm_s_gt, h_norm_arc] · push Not at ht3 by_cases ht4 : t ≤ 4 · rcases eq_or_lt_of_le ht3 with rfl | ht3' · rw [fdBoundary_H_at_three] at h_eq; exact hs_rho h_eq.symm - · rw [fdBoundary_H_eq_seg4_H (by linarith : 3 < t) ht4, - ← hγt₀, fdBoundary_H_eq_seg4_H (by linarith : 3 < t₀) + · rw [fdBoundary_H_eq_seg4_H (by linarith only [ht3'] : 3 < t) ht4, + ← hγt₀, fdBoundary_H_eq_seg4_H (by linarith only [ht₀_gt_3] : 3 < t₀) (le_of_lt ht₀_lt_4)] at h_eq simp only [fdBoundarySeg4H] at h_eq have h_im := congr_arg Complex.im h_eq @@ -585,14 +583,14 @@ private theorem cpv_exists_generic_seg4 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s add_right_inj, mul_eq_mul_right_iff, sub_left_inj] at h_im rcases h_im with rfl | h_abs · linarith [ht.2] - · linarith + · linarith only [hH, h_abs] · push Not at ht4; linarith [ht.2] · have h_re_s : s.re = -1/2 := by rw [← hγt₀]; exact fdBoundary_H_seg4_re' H ht₀_gt_3 (le_of_lt ht₀_lt_4) intro t ht h_eq by_cases ht4' : 4 < t · have := fdBoundary_H_seg5_re' H ht4' ht.2 - rw [h_eq] at this; linarith + rw [h_eq] at this; linarith only [h_re_s, ht4', this] · push Not at ht4' have ht3' : 3 < t := by linarith [ht.1] by_cases ht4_eq : t = 4 @@ -603,11 +601,11 @@ private theorem cpv_exists_generic_seg4 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s zero_div, mul_im, ofReal_re, I_im, mul_one, ofReal_im, I_re, mul_zero, add_zero, zero_add] rw [← hγt₀, - fdBoundary_H_eq_seg4_H (by linarith) (le_of_lt ht₀_lt_4)] at h_im_eq + fdBoundary_H_eq_seg4_H (by linarith only [ht₀_gt_3]) (le_of_lt ht₀_lt_4)] at h_im_eq simp [fdBoundarySeg4H] at h_im_eq - nlinarith - · rw [fdBoundary_H_eq_seg4_H (by linarith : 3 < t) (by linarith : t ≤ 4), - ← hγt₀, fdBoundary_H_eq_seg4_H (by linarith : 3 < t₀) + nlinarith only [hH, ht₀_lt_4, h_im_eq] + · rw [fdBoundary_H_eq_seg4_H (by linarith only [ht3'] : 3 < t) (by linarith : t ≤ 4), + ← hγt₀, fdBoundary_H_eq_seg4_H (by linarith only [ht₀_gt_3] : 3 < t₀) (le_of_lt ht₀_lt_4)] at h_eq simp only [fdBoundarySeg4H] at h_eq have h_im := congr_arg Complex.im h_eq @@ -617,7 +615,7 @@ private theorem cpv_exists_generic_seg4 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s mul_eq_mul_right_iff, sub_left_inj] at h_im rcases h_im with rfl | h_abs · linarith [ht.1] - · linarith + · linarith only [hH, h_abs] /-! ### Helper: generic case, t₀ on seg5 (4 < t₀ < 5) with normSq = 1 -/ @@ -850,7 +848,8 @@ private theorem cpv_exists_generic_seg5 (H : ℝ) (hH : Real.sqrt 3 / 2 < H) (s · have heq_fn : ∀ u ∈ Set.Ioi (4 : ℝ), fdBoundaryH H u = (↑(u - 9/2) : ℂ) + ↑H * I := by intro u (hu : 4 < u) - rw [fdBoundary_H_eq_seg5_H hu]; simp [fdBoundarySeg5H] + rw [fdBoundary_H_eq_seg5_H hu]; simp only [fdBoundarySeg5H, ofReal_sub, ofReal_div, + ofReal_ofNat] have heq : fdBoundaryH H =ᶠ[𝓝 t₀] (fun t => (↑(t - 9/2) : ℂ) + ↑H * I) := Filter.eventuallyEq_iff_exists_mem.mpr ⟨Set.Ioi 4, Ioi_mem_nhds ht₀_gt_4, heq_fn⟩ diff --git a/LeanPool/LeanModularForms/ValenceFormula/OrbitPairing.lean b/LeanPool/LeanModularForms/ValenceFormula/OrbitPairing.lean index 353db93289..9cac946af0 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/OrbitPairing.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/OrbitPairing.lean @@ -55,27 +55,31 @@ private lemma normSq_eq_one_of_norm_eq_one {z : ℂ} (h : ‖z‖ = 1) : /-- Coercion identity for T-translation: `((1 : ℝ) +ᵥ p : ℂ) = (p : ℂ) + 1`. -/ lemma vAdd_one_coe (p : ℍ) : ((1 : ℝ) +ᵥ p : ℂ) = (p : ℂ) + 1 := by - change ((1 : ℝ) : ℂ) + (p : ℂ) = (p : ℂ) + 1; push_cast; ring + change ((1 : ℝ) : ℂ) + (p : ℂ) = (p : ℂ) + 1; push_cast; ac_rfl /-- T-translation shifts real part by 1. -/ lemma vAdd_one_re (p : ℍ) : ((1 : ℝ) +ᵥ p : ℍ).re = p.re + 1 := by - change ((1 : ℝ) +ᵥ p : ℂ).re = p.re + 1; rw [vAdd_one_coe]; simp [add_re] + change ((1 : ℝ) +ᵥ p : ℂ).re = p.re + 1; rw [vAdd_one_coe]; simp only [add_re, + UpperHalfPlane.coe_re, one_re] /-- T-translation preserves imaginary part. -/ lemma vAdd_one_im_eq (p : ℍ) : ((1 : ℝ) +ᵥ p : ℍ).im = p.im := by - change ((1 : ℝ) +ᵥ p : ℂ).im = p.im; rw [vAdd_one_coe]; simp [add_im] + change ((1 : ℝ) +ᵥ p : ℂ).im = p.im; rw [vAdd_one_coe]; simp only [add_im, UpperHalfPlane.coe_im, + one_im, add_zero] /-- T⁻¹-translation coercion: `((-1 : ℝ) +ᵥ p : ℂ) = (p : ℂ) - 1`. -/ lemma vAdd_neg_one_coe (p : ℍ) : ((-1 : ℝ) +ᵥ p : ℂ) = (p : ℂ) - 1 := by - change ((-1 : ℝ) : ℂ) + (p : ℂ) = (p : ℂ) - 1; push_cast; ring + change ((-1 : ℝ) : ℂ) + (p : ℂ) = (p : ℂ) - 1; push_cast; ac_rfl /-- T⁻¹-translation shifts real part by -1. -/ lemma vAdd_neg_one_re (p : ℍ) : ((-1 : ℝ) +ᵥ p : ℍ).re = p.re - 1 := by - change ((-1 : ℝ) +ᵥ p : ℂ).re = p.re - 1; rw [vAdd_neg_one_coe]; simp [sub_re] + change ((-1 : ℝ) +ᵥ p : ℂ).re = p.re - 1; rw [vAdd_neg_one_coe]; simp only [sub_re, + UpperHalfPlane.coe_re, one_re] /-- T⁻¹-translation preserves imaginary part. -/ lemma vAdd_neg_one_im_eq (p : ℍ) : ((-1 : ℝ) +ᵥ p : ℍ).im = p.im := by - change ((-1 : ℝ) +ᵥ p : ℂ).im = p.im; rw [vAdd_neg_one_coe]; simp [sub_im] + change ((-1 : ℝ) +ᵥ p : ℂ).im = p.im; rw [vAdd_neg_one_coe]; simp only [sub_im, + UpperHalfPlane.coe_im, one_im, sub_zero] /-- T-translation preserves norm for left-vertical points (`re = -1/2`). -/ lemma norm_add_one_eq_of_re_neg_half (z : ℂ) (hre : z.re = -1 / 2) : @@ -130,7 +134,9 @@ theorem vAdd_neg_one_rho_plus_one_eq_rho : /-- ρ+1 is in the standard fundamental domain 𝒟. -/ theorem ellipticPointRhoPlusOne_mem_fd : ellipticPointRhoPlusOne' ∈ 𝒟 := vAdd_one_rho_eq_rho_plus_one ▸ vAdd_one_mem_fd_of_left_vert - ellipticPointRho' ellipticPointRho_mem_fd (by simp [ellipticPointRho']) + ellipticPointRho' ellipticPointRho_mem_fd (by simp only [ellipticPointRho', add_re, + div_ofNat_re, neg_re, one_re, mul_re, ofReal_re, I_re, mul_zero, div_ofNat_im, ofReal_im, + zero_div, I_im, mul_one, sub_self, add_zero]) variable {k : ℤ} (f : ModularForm (Gamma 1) k) @@ -267,7 +273,8 @@ theorem sum_ord_rightVert_eq_sum_ord_leftVert (S : Finset ℍ) · show ‖((1 : ℝ) +ᵥ q : ℂ)‖ > 1 rw [vAdd_one_norm_eq_of_re_neg_half q hre]; exact hnorm · rw [ord_add_one_eq f q]; exact hord - · simp_all + · simp_all only [ne_eq, Int.cast_eq_zero, Finset.coe_filter, mem_ofPred_eq, true_and, + not_false_eq_true, UpperHalfPlane.coe_re, gt_iff_lt, neg_vadd_vadd] · intro p _; rw [ord_vAdd_neg_one_eq f p] /-- Orders on right arc equal orders on left arc (via S-action). -/ @@ -296,7 +303,7 @@ theorem sum_ord_rightArc_eq_sum_ord_leftArc (S : Finset ℍ) (hS : ∀ p ∈ S, (by rw [ord_S_eq f q]; exact ord_ne_zero_of_cast_ne_zero hord), S_smul_norm_of_unit q hnorm, ?_⟩, ?_⟩, S_smul_S_smul q⟩ · change (ModularGroup.S • q : ℍ).re > 0 - rw [S_smul_re_neg_of_unit q hnorm, show q.re = (q : ℂ).re from rfl]; linarith + rw [S_smul_re_neg_of_unit q hnorm, show q.re = (q : ℂ).re from rfl]; linarith only [hre_neg] · rw [ord_S_eq f q]; exact hord · intro p _; rw [ord_S_eq f p] diff --git a/LeanPool/LeanModularForms/ValenceFormula/OrbitSum.lean b/LeanPool/LeanModularForms/ValenceFormula/OrbitSum.lean index 21e34248ce..ba38eea947 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/OrbitSum.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/OrbitSum.lean @@ -137,7 +137,8 @@ theorem orderOfVanishingAt'_ne_zero_of_eq_zero (hf : f ≠ 0) (p : ℍ) (hp : f have h_analOn : AnalyticOnNhd ℂ (fun w : ℂ => if h : 0 < w.im then f ⟨w, h⟩ else 0) {w | 0 < w.im} := fun w hw => G_analyticAt f ⟨w, hw⟩ have h_preconn : IsPreconnected {w : ℂ | 0 < w.im} := - ((convex_halfSpace_im_gt 0).isConnected ⟨I, by simp [I_im]⟩).isPreconnected + ((convex_halfSpace_im_gt 0).isConnected ⟨I, by simp only [mem_ofPred_eq, I_im, + zero_lt_one]⟩).isPreconnected apply hf; ext z change f z = 0 exact (G_eval_eq_f f z).symm.trans @@ -146,7 +147,8 @@ theorem orderOfVanishingAt'_ne_zero_of_eq_zero (hf : f ≠ 0) (p : ℍ) (hp : f private theorem modularFormCompOfComplex_eq' (p : ℍ) : modularFormCompOfComplex f (p : ℂ) = f p := by - simp [modularFormCompOfComplex, UpperHalfPlane.ofComplex_apply_of_im_pos p.im_pos] + simp only [modularFormCompOfComplex, Function.comp_apply, + UpperHalfPlane.ofComplex_apply_of_im_pos p.im_pos] theorem fd_im_gt_half (p : ℍ) (hp : p ∈ 𝒟) : (1 : ℝ)/2 < (p : ℂ).im := by by_contra h_le; push Not at h_le @@ -168,7 +170,7 @@ private theorem no_zeros_above_height' (hf : f ≠ 0) : obtain ⟨H₀, hH₀_gt, hH₀_nonvan⟩ := exists_height_cusp_nonvanishing f hf refine ⟨H₀, hH₀_gt, fun p hp hfp => ?_⟩ have h_eq := SlashInvariantFormClass.eq_cuspFunction f p - (by simp) one_ne_zero + (by simp only [strictPeriods_Gamma, Nat.cast_one, AddSubgroup.mem_zmultiples]) one_ne_zero have h_qParam_mem : Function.Periodic.qParam (1 : ℝ) (↑p : ℂ) ∈ Metric.closedBall (0 : ℂ) (Real.exp (-2 * Real.pi * H₀)) := by rw [Metric.mem_closedBall, dist_zero_right, Function.Periodic.norm_qParam] @@ -201,7 +203,7 @@ theorem finite_zeros_in_fd (hf : f ≠ 0) : · simp only [fdBox, Set.mem_ofPred_eq] refine ⟨by linarith [hre_bridge], by linarith [hre_bridge], him_gt, ?_⟩ by_contra h_ge; push Not at h_ge - have : H₀ ≤ (↑p : ℂ).im := by linarith + have : H₀ ≤ (↑p : ℂ).im := by linarith only [h_ge] exact absurd hp_zero (hH₀_no_zeros p this) · exact (modularFormCompOfComplex_eq' f p).symm ▸ hp_zero @@ -248,6 +250,7 @@ theorem orb_rho_plus_one_eq_orb_rho : rw [Quotient.eq'', MulAction.orbitRel_apply, MulAction.mem_orbit_iff] exact ⟨ModularGroup.T, by rw [UpperHalfPlane.modular_T_smul]; ext - simp [ellipticPointRho', ellipticPointRhoPlusOne', UpperHalfPlane.coe_vadd]; ring⟩ + simp only [ellipticPointRho', UpperHalfPlane.coe_vadd, ofReal_one, ellipticPointRhoPlusOne', + one_div]; ring⟩ end diff --git a/LeanPool/LeanModularForms/ValenceFormula/PVChain.lean b/LeanPool/LeanModularForms/ValenceFormula/PVChain.lean index 5456dacd92..a5d294228f 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/PVChain.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/PVChain.lean @@ -9,8 +9,6 @@ public import LeanPool.LeanModularForms.ValenceFormula.PVChain.Assembly public import LeanPool.LeanModularForms.ValenceFormula.PVChain.Assembly.ResidueSide import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # PV Chain: Residue Side and Modular Side diff --git a/LeanPool/LeanModularForms/ValenceFormula/PVChain/ArcContribution.lean b/LeanPool/LeanModularForms/ValenceFormula/PVChain/ArcContribution.lean index bcf35ef64a..f458904ad7 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/PVChain/ArcContribution.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/PVChain/ArcContribution.lean @@ -10,8 +10,6 @@ import LeanPool.LeanModularForms.ValenceFormula.Boundary.Smooth import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Arc Contribution to the PV Chain @@ -47,8 +45,8 @@ private lemma deriv_fdBoundary_H_arc (H : ℝ) {t : ℝ} (h1 : 1 < t) (h3 : t < deriv (fdBoundaryH H) t = ↑(Real.pi / 6) * I * fdBoundaryH H t := by rw [fdBoundary_H_eq_arc h1 h3]; erw [(fdBoundary_H_hasDerivAt_arc H h1 h3).deriv]; rw [mul_comm] congr 1 - · push_cast; ring - · congr 1; push_cast; ring + · push_cast; ac_rfl + · congr 1; push_cast; ac_rfl /-! ### LogDeriv S-transformation -/ @@ -73,7 +71,8 @@ lemma logDeriv_modform_S_transform (z : ℂ) (hz : 0 < z.im) (hz_ne : z ≠ 0) exact modform_comp_ofComplex_S_identity f w hw have h_neg_inv_im : 0 < (-(1 : ℂ)/z).im := by rw [show -(1 : ℂ)/z = (-z)⁻¹ from by field_simp] - rw [Complex.inv_im]; simp_all + rw [Complex.inv_im]; simp_all only [ne_eq, Function.comp_apply, neg_im, neg_neg, normSq_neg, + div_pos_iff_of_pos_left, normSq_pos, not_false_eq_true] have h_diffOn_g : DifferentiableOn ℂ g {w | 0 < w.im} := UpperHalfPlane.mdifferentiable_iff.mp f.holo' have h_logDeriv_comp : logDeriv (fun w => g (-(1 : ℂ)/w)) z = @@ -317,11 +316,11 @@ lemma arc_cpv_integral_S_identity (S : Finset UpperHalfPlane) have h_ind_1 : ind 1 := ⟨_, sArcOfS_rho_plus_one_in S, by rw [show γ 1 = ellipticPointRhoPlusOne from fdBoundary_H_at_one H, - sub_self, norm_zero]; linarith⟩ + sub_self, norm_zero]; exact le_of_lt hε⟩ have h_ind_3 : ind 3 := ⟨_, sArcOfS_rho_in S, by rw [show γ 3 = ellipticPointRho from fdBoundary_H_at_three H, - sub_self, norm_zero]; linarith⟩ + sub_self, norm_zero]; exact le_of_lt hε⟩ have h_cov : ∫ t in (1 : ℝ)..3, F (4 - t) = ∫ t in (1 : ℝ)..3, F t := by have h := @intervalIntegral.integral_comp_sub_left ℂ _ _ 1 3 F 4 simpa only [show (4 : ℝ) - 3 = 1 from by norm_num, @@ -360,7 +359,7 @@ lemma arc_cpv_integral_S_identity (S : Finset UpperHalfPlane) have h_F_4mt : F (4 - t) = 0 := by change cauchyPrincipalValueIntegrandOn _ _ _ _ _ = 0 rw [cauchyPrincipalValueIntegrandOn, ite_eq_left h_ind_4mt] - rw [h_F_4mt, h_F_t]; simp [h_near] + rw [h_F_4mt, h_F_t]; simp only [add_zero, h_near, ↓reduceIte, ofReal_zero, mul_zero] · have ht_ioo : t ∈ Set.Ioo (1 : ℝ) 3 := by constructor · exact lt_of_le_of_ne ht.1 (fun h => h_near (h ▸ h_ind_1)) @@ -380,7 +379,7 @@ lemma arc_cpv_integral_S_identity (S : Finset UpperHalfPlane) intro h_zero have h_in : (γ t : ℂ) ∈ (↑S_arc : Set ℂ) := h_oncurve t ht_ioo h_zero rw [Finset.mem_coe] at h_in - exact h_near ⟨γ t, h_in, by rw [sub_self, norm_zero]; linarith⟩ + exact h_near ⟨γ t, h_in, by rw [sub_self, norm_zero]; exact le_of_lt hε⟩ have h_logD := logDeriv_modform_S_transform f (γ t) (h_arc_im_pos t ht_ioo) (h_arc_ne_zero t ht_ioo) hg_ne simp only [← hg_def] at h_logD diff --git a/LeanPool/LeanModularForms/ValenceFormula/PVChain/Assembly.lean b/LeanPool/LeanModularForms/ValenceFormula/PVChain/Assembly.lean index d9b2a4aed6..ebedd5745c 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/PVChain/Assembly.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/PVChain/Assembly.lean @@ -13,8 +13,6 @@ import LeanPool.LeanModularForms.ValenceFormula.PVChain.Seg5CuspIntegral import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # PV Chain Assembly @@ -313,13 +311,15 @@ private theorem tendsto_pvIntegral_seg5 have h_seg5_im : ∀ t, 4 < t → (fdBoundaryH H t).im = H := by intro t ht rw [fdBoundary_H_eq_seg5_H ht] - simp [fdBoundarySeg5H, add_im, ofReal_im, mul_im, I_re, I_im] + simp only [fdBoundarySeg5H, add_im, sub_im, ofReal_im, div_ofNat_im, im_ofNat, zero_div, + sub_self, mul_im, ofReal_re, I_im, mul_one, I_re, mul_zero, add_zero, zero_add] have h_no_trunc : ∀ᶠ ε in 𝓝[>] (0 : ℝ), ∀ t, 4 < t → t ≤ 5 → ¬∃ s ∈ sArcOfS S ∪ sVertOfS S, ‖fdBoundaryH H t - s‖ ≤ ε := by rcases (sArcOfS S ∪ sVertOfS S).eq_empty_or_nonempty with h_empty | h_ne · filter_upwards [self_mem_nhdsWithin] with ε _ - intro t _ _; simp [h_empty] + intro t _ _; simp only [h_empty, Finset.notMem_empty, false_and, exists_const, + not_false_eq_true] · set δ := (sArcOfS S ∪ sVertOfS S).inf' h_ne (fun s => H - s.im) have hδ_pos : 0 < δ := (Finset.lt_inf'_iff h_ne).mpr (fun s hs => by linarith only [h_below, hs, h_below s hs]) @@ -357,7 +357,7 @@ private lemma norm_deriv_fdBoundary_H_le (ht_ne1 : t ≠ 1) (ht_ne3 : t ≠ 3) (ht_ne4 : t ≠ 4) : ‖deriv (fdBoundaryH H) t‖ ≤ max H 1 := by have h_norm_cast : ‖(↑H - ↑(Real.sqrt 3) / 2 : ℂ)‖ = H - Real.sqrt 3 / 2 := by - have hcast : (↑H - ↑(Real.sqrt 3) / 2 : ℂ) = ↑(H - Real.sqrt 3 / 2) := by push_cast; ring + have hcast : (↑H - ↑(Real.sqrt 3) / 2 : ℂ) = ↑(H - Real.sqrt 3 / 2) := by push_cast; ac_rfl rw [hcast, Complex.norm_real, Real.norm_of_nonneg (by linarith only [hH, Real.sqrt_pos_of_pos (by norm_num : (3 : ℝ) > 0)])] by_cases h1 : t < 1 @@ -372,11 +372,11 @@ private lemma norm_deriv_fdBoundary_H_le simp only [norm_mul, Complex.norm_I, mul_one] have hexp : ‖exp ((↑Real.pi * (↑t + 1) / 6 : ℂ) * I)‖ = 1 := by rw [show (↑Real.pi * (↑t + 1) / 6 : ℂ) * I = - ↑(Real.pi * (t + 1) / 6) * I from by push_cast; ring] + ↑(Real.pi * (t + 1) / 6) * I from by push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ rw [hexp, one_mul] have hpi : ‖(↑Real.pi / 6 : ℂ)‖ = Real.pi / 6 := by - rw [show (↑Real.pi / 6 : ℂ) = ↑(Real.pi / 6) from by push_cast; ring, + rw [show (↑Real.pi / 6 : ℂ) = ↑(Real.pi / 6) from by push_cast; ac_rfl, Complex.norm_real, Real.norm_of_nonneg (by positivity)] rw [hpi] exact le_max_of_le_right (by linarith only [Real.pi_le_four]) @@ -424,7 +424,7 @@ private lemma integrableOn_logDeriv_mul_deriv_farSet intro t ⟨ht_Icc, h_far⟩ h_zero have h_in := h_capture t ht_Icc h_zero rw [Finset.mem_coe] at h_in - have := h_far _ h_in; rw [sub_self, norm_zero] at this; linarith + have := h_far _ h_in; rw [sub_self, norm_zero] at this; linarith only [hε, this] have h_cont : ContinuousOn (fun t => logDeriv g (γ t)) K' := by intro t ht apply ContinuousAt.continuousWithinAt @@ -578,7 +578,8 @@ private lemma modFormComp_ne_zero_at_height Function.Periodic.qParam (1 : ℝ) (↑(⟨z, hz_pos⟩ : ℍ) : ℂ) ≠ 0 := by simpa only [Function.Periodic.qParam, ne_eq] using Complex.exp_ne_zero _ exact absurd ((SlashInvariantFormClass.eq_cuspFunction f ⟨z, hz_pos⟩ - (by simp) one_ne_zero).trans + (by simp only [strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) one_ne_zero).trans (h_bridge ▸ h_zero)) (hcusp _ h_qmem h_qne) include hf in @@ -625,7 +626,9 @@ private lemma modular_side_h_capture subst h_eq; exfalso have h_im : (fdBoundaryH H 0).im = H := by rw [fdBoundary_H_eq_seg1_H (show (0 : ℝ) ≤ 1 from by norm_num)] - simp [fdBoundarySeg1H, add_im, ofReal_im, mul_im, I_re, I_im] + simp only [fdBoundarySeg1H, one_div, ofReal_zero, zero_mul, sub_zero, add_im, inv_im, + im_ofNat, neg_zero, normSq_ofNat, zero_div, mul_im, ofReal_re, I_im, mul_one, ofReal_im, + I_re, mul_zero, add_zero, zero_add] exact modFormComp_ne_zero_at_height f hH_pos hcusp h_im h_zero · push Not at h1 by_cases h3 : t ≤ 3 @@ -646,7 +649,8 @@ private lemma modular_side_h_capture · subst h4'; exfalso have h_im : (fdBoundaryH H 4).im = H := by rw [fdBoundary_H_at_four] - simp [add_im, ofReal_im, mul_im, I_re, I_im] + simp only [add_im, div_ofNat_im, neg_im, one_im, neg_zero, zero_div, mul_im, ofReal_re, + I_im, mul_one, ofReal_im, I_re, mul_zero, add_zero, zero_add] exact modFormComp_ne_zero_at_height f hH_pos hcusp h_im h_zero · have ht_seg4 : fdBoundaryH H t = fdBoundaryH H (4 - t) - 1 := by rw [fdBoundary_H_eq_seg4_H h3 h4] @@ -657,7 +661,8 @@ private lemma modular_side_h_capture have h_F_per : Function.Periodic (modularFormCompOfComplex f) (1 : ℂ) := by have := SlashInvariantFormClass.periodic_comp_ofComplex f - (by simp : (1 : ℝ) ∈ + (by simp only [strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples] : (1 : ℝ) ∈ (Subgroup.map (Matrix.SpecialLinearGroup.mapGL ℝ) Γ(1)).strictPeriods) simpa only [Complex.ofReal_one] using this have h_F_zero_shifted : @@ -678,7 +683,8 @@ private lemma modular_side_h_capture · exfalso have h_im : (fdBoundaryH H t).im = H := by rw [fdBoundary_H_eq_seg5_H (by linarith only [h4] : (4 : ℝ) < t)] - simp [fdBoundarySeg5H, add_im, ofReal_im, mul_im, I_re, I_im] + simp only [fdBoundarySeg5H, add_im, sub_im, ofReal_im, div_ofNat_im, im_ofNat, zero_div, + sub_self, mul_im, ofReal_re, I_im, mul_one, I_re, mul_zero, add_zero, zero_add] exact modFormComp_ne_zero_at_height f hH_pos hcusp h_im h_zero include hf in @@ -757,7 +763,7 @@ theorem cpv_modular_side_tendsto rw [show -(2 * ↑Real.pi * I * ((k : ℂ) / 12 - ↑(orderAtCusp' f))) = 0 + (-(2 * ↑Real.pi * I * (↑k / 12)) + 2 * ↑Real.pi * I * ↑(orderAtCusp' f)) from by ring] - exact Filter.Tendsto.congr (fun ε => by ring) + exact Filter.Tendsto.congr (fun ε => by ac_rfl) (h_vert_tendsto.add (h_arc.add h_seg5)) exact h_sum.congr' (h_split.mono (fun ε h => h.symm)) diff --git a/LeanPool/LeanModularForms/ValenceFormula/PVChain/Assembly/ResidueSide.lean b/LeanPool/LeanModularForms/ValenceFormula/PVChain/Assembly/ResidueSide.lean index cca1c4c161..67df0cdcb8 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/PVChain/Assembly/ResidueSide.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/PVChain/Assembly/ResidueSide.lean @@ -13,8 +13,6 @@ import LeanPool.LeanModularForms.ValenceFormula.OnCurvePV.Main import LeanPool.LeanModularForms.ValenceFormula.PVChain.OnCurveCapture import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # PV Chain Assembly: Residue Side diff --git a/LeanPool/LeanModularForms/ValenceFormula/PVChain/Helpers.lean b/LeanPool/LeanModularForms/ValenceFormula/PVChain/Helpers.lean index bd5fa02358..a58e59f788 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/PVChain/Helpers.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/PVChain/Helpers.lean @@ -12,8 +12,6 @@ import LeanPool.LeanModularForms.ValenceFormula.OnCurvePV.Main import LeanPool.LeanModularForms.ValenceFormula.OrbitSum import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # PV Chain Helpers @@ -103,13 +101,21 @@ lemma sArcOfS_unit (S : Finset UpperHalfPlane) : omit f hf in private lemma neg_inv_rho_eq_rho_plus_one : -(1 : ℂ) / ellipticPointRho = ellipticPointRhoPlusOne := by - have hre : (ellipticPointRho : ℂ).re = -1/2 := by simp [ellipticPointRho, ellipticPointRho'] + have hre : (ellipticPointRho : ℂ).re = -1/2 := by simp only [ellipticPointRho, ellipticPointRho', + add_re, div_ofNat_re, neg_re, one_re, mul_re, ofReal_re, I_re, mul_zero, div_ofNat_im, + ofReal_im, zero_div, I_im, mul_one, sub_self, add_zero] have him : (ellipticPointRho : ℂ).im = Real.sqrt 3 / 2 := by - simp [ellipticPointRho, ellipticPointRho'] + simp only [ellipticPointRho, ellipticPointRho', add_im, div_ofNat_im, neg_im, one_im, neg_zero, + zero_div, mul_im, div_ofNat_re, ofReal_re, I_im, mul_one, ofReal_im, I_re, mul_zero, add_zero, + zero_add] have hre2 : (ellipticPointRhoPlusOne : ℂ).re = 1/2 := by - simp [ellipticPointRhoPlusOne, ellipticPointRhoPlusOne'] + simp only [ellipticPointRhoPlusOne, ellipticPointRhoPlusOne', one_div, add_re, inv_re, re_ofNat, + normSq_ofNat, div_self_mul_self', mul_re, div_ofNat_re, ofReal_re, I_re, mul_zero, + div_ofNat_im, ofReal_im, zero_div, I_im, mul_one, sub_self, add_zero] have him2 : (ellipticPointRhoPlusOne : ℂ).im = Real.sqrt 3 / 2 := by - simp [ellipticPointRhoPlusOne, ellipticPointRhoPlusOne'] + simp only [ellipticPointRhoPlusOne, ellipticPointRhoPlusOne', one_div, add_im, inv_im, im_ofNat, + neg_zero, normSq_ofNat, zero_div, mul_im, div_ofNat_re, ofReal_re, I_im, mul_one, + div_ofNat_im, ofReal_im, I_re, mul_zero, add_zero, zero_add] have hnormSq : -(1/2 : ℝ) * -(1/2) + Real.sqrt 3 / 2 * (Real.sqrt 3 / 2) = 1 := by nlinarith only [Real.sq_sqrt (show (0 : ℝ) ≤ 3 by norm_num)] @@ -125,12 +131,20 @@ omit f hf in private lemma neg_inv_rho_plus_one_eq_rho : -(1 : ℂ) / ellipticPointRhoPlusOne = ellipticPointRho := by have hre : (ellipticPointRhoPlusOne : ℂ).re = 1/2 := by - simp [ellipticPointRhoPlusOne, ellipticPointRhoPlusOne'] + simp only [ellipticPointRhoPlusOne, ellipticPointRhoPlusOne', one_div, add_re, inv_re, re_ofNat, + normSq_ofNat, div_self_mul_self', mul_re, div_ofNat_re, ofReal_re, I_re, mul_zero, + div_ofNat_im, ofReal_im, zero_div, I_im, mul_one, sub_self, add_zero] have him : (ellipticPointRhoPlusOne : ℂ).im = Real.sqrt 3 / 2 := by - simp [ellipticPointRhoPlusOne, ellipticPointRhoPlusOne'] - have hre2 : (ellipticPointRho : ℂ).re = -1/2 := by simp [ellipticPointRho, ellipticPointRho'] + simp only [ellipticPointRhoPlusOne, ellipticPointRhoPlusOne', one_div, add_im, inv_im, im_ofNat, + neg_zero, normSq_ofNat, zero_div, mul_im, div_ofNat_re, ofReal_re, I_im, mul_one, + div_ofNat_im, ofReal_im, I_re, mul_zero, add_zero, zero_add] + have hre2 : (ellipticPointRho : ℂ).re = -1/2 := by simp only [ellipticPointRho, ellipticPointRho', + add_re, div_ofNat_re, neg_re, one_re, mul_re, ofReal_re, I_re, mul_zero, div_ofNat_im, + ofReal_im, zero_div, I_im, mul_one, sub_self, add_zero] have him2 : (ellipticPointRho : ℂ).im = Real.sqrt 3 / 2 := by - simp [ellipticPointRho, ellipticPointRho'] + simp only [ellipticPointRho, ellipticPointRho', add_im, div_ofNat_im, neg_im, one_im, neg_zero, + zero_div, mul_im, div_ofNat_re, ofReal_re, I_im, mul_one, ofReal_im, I_re, mul_zero, add_zero, + zero_add] have hnormSq : (1/2 : ℝ) * (1/2) + Real.sqrt 3 / 2 * (Real.sqrt 3 / 2) = 1 := by nlinarith only [Real.sq_sqrt (show (0 : ℝ) ≤ 3 by norm_num)] apply Complex.ext @@ -149,7 +163,8 @@ lemma sArcOfS_closed (S : Finset UpperHalfPlane) : Finset.mem_filter, Finset.mem_insert, Finset.mem_singleton] at hs ⊢ rcases hs with ⟨⟨p, hp, rfl⟩ | ⟨p, hp, rfl⟩⟩ | hs · left; right; exact ⟨p, hp, rfl⟩ - · simp_all + · simp_all only [ne_eq, neg_eq_zero, one_ne_zero, not_false_eq_true, div_div_cancel₀, + UpperHalfPlane.coe_inj, exists_eq_right, and_self, true_or] · rcases hs with rfl | rfl · right; right; exact neg_inv_rho_eq_rho_plus_one · right; left; exact neg_inv_rho_plus_one_eq_rho @@ -172,9 +187,12 @@ lemma sVertOfS_pair_left (S : Finset UpperHalfPlane) : simp only [sVertOfS, Finset.mem_union, Finset.mem_image] at hs ⊢ obtain ((⟨p, hp, rfl⟩ | ⟨p, hp, rfl⟩) | ⟨p, hp, rfl⟩) | ⟨p, hp, rfl⟩ := hs · exact Or.inl (Or.inl (Or.inr ⟨p, hp, rfl⟩)) - · simp_all + · simp_all only [UpperHalfPlane.coe_re, one_div, gt_iff_lt, Finset.mem_filter, sub_re, one_re, + sub_eq_self, one_ne_zero] · exfalso; linarith [(Finset.mem_filter.mp hp).2.1, hre] - · simp_all + · simp_all only [UpperHalfPlane.coe_re, gt_iff_lt, Finset.mem_filter, add_re, one_re, one_div, + add_sub_cancel_right, UpperHalfPlane.coe_inj, exists_eq_right, and_true, true_and, and_self, + or_true, true_or] omit f hf in lemma sVertOfS_pair_right (S : Finset UpperHalfPlane) : @@ -183,9 +201,11 @@ lemma sVertOfS_pair_right (S : Finset UpperHalfPlane) : simp only [sVertOfS, Finset.mem_union, Finset.mem_image] at hs ⊢ obtain ((⟨p, hp, rfl⟩ | ⟨p, hp, rfl⟩) | ⟨p, hp, rfl⟩) | ⟨p, hp, rfl⟩ := hs · exfalso; linarith [(Finset.mem_filter.mp hp).2.1, hre] - · simp_all + · simp_all only [UpperHalfPlane.coe_re, one_div, gt_iff_lt, Finset.mem_filter, sub_re, one_re, + sub_add_cancel, UpperHalfPlane.coe_inj, exists_eq_right, and_self, true_or, and_true, true_and] · exact Or.inr ⟨p, hp, rfl⟩ - · simp_all + · simp_all only [UpperHalfPlane.coe_re, gt_iff_lt, Finset.mem_filter, add_re, one_re, add_eq_left, + one_ne_zero] omit f hf in /-- There exists a height above √3/2 exceeding all points in `S`. -/ @@ -193,7 +213,8 @@ theorem exists_height_bound_S (S : Finset UpperHalfPlane) : ∃ H₁ : ℝ, Real.sqrt 3 / 2 < H₁ ∧ 1 < H₁ ∧ ∀ s ∈ S, (s : ℂ).im < H₁ := by rcases S.eq_empty_or_nonempty with h_empty | h_ne · exact ⟨2, by nlinarith only [Real.sq_sqrt (show (0 : ℝ) ≤ 3 by norm_num)], - by norm_num, by simp [h_empty]⟩ + by norm_num, by simp only [h_empty, Finset.notMem_empty, UpperHalfPlane.coe_im, + IsEmpty.forall_iff, implies_true]⟩ · set M := S.sup' h_ne (fun s : ℍ => (s : ℂ).im) with hM_def have hM_pos : 0 < M := by obtain ⟨s, hs⟩ := h_ne @@ -338,7 +359,7 @@ lemma fdBox_of_on_curve (S : Finset UpperHalfPlane) (hS : ∀ p ∈ S, p ∈ Finset.mem_filter, Finset.mem_insert, Finset.mem_singleton] at h_arc rcases h_arc with ⟨⟨p, ⟨hp_mem, hp_norm⟩, rfl⟩ | ⟨p, ⟨hp_mem, hp_norm⟩, rfl⟩⟩ | h_ell · exact im_ge_sqrt3_half_of_re_half_and_norm_eq_one p (hS p hp_mem).2 hp_norm - · have hz_ne : (↑p : ℂ) ≠ 0 := by intro h; simp [h] at hp_norm + · have hz_ne : (↑p : ℂ) ≠ 0 := by intro h; simp only [h, norm_zero, zero_ne_one] at hp_norm have h_eq : (-(1 : ℂ) / (↑p : ℂ)).im = (↑p : ℂ).im := by rw [show -(1 : ℂ) / (↑p : ℂ) = (-(↑p : ℂ))⁻¹ from by field_simp, Complex.inv_im] simp only [neg_im, neg_neg] @@ -348,7 +369,7 @@ lemma fdBox_of_on_curve (S : Finset UpperHalfPlane) (hS : ∀ p ∈ S, p ∈ have : ‖(↑p : ℂ)‖ ^ 2 = (↑p : ℂ).re ^ 2 + (↑p : ℂ).im ^ 2 := by rw [Complex.sq_norm, Complex.normSq_apply] ring - have h_nsq : (↑p : ℂ).re ^ 2 + (↑p : ℂ).im ^ 2 = 1 := by linarith + have h_nsq : (↑p : ℂ).re ^ 2 + (↑p : ℂ).im ^ 2 = 1 := by linarith only [h_norm_sq, this] simp only [Complex.normSq_apply] nlinarith only [h_norm_sq, this, h_nsq] rw [h_nsq_val, div_one] @@ -374,6 +395,6 @@ lemma fdBox_of_on_curve (S : Finset UpperHalfPlane) (hS : ∀ p ∈ S, p ∈ rw [show (1 : ℝ) = Real.sqrt 1 from (Real.sqrt_one).symm] exact Real.sqrt_lt_sqrt (by norm_num) (by norm_num) exact ⟨by linarith [abs_le.mp h_re], by linarith [abs_le.mp h_re], - by linarith, by linarith⟩ + by linarith only [h_im_gt, sqrt3_gt_one], by linarith only [hH_lt_M, h_im_lt]⟩ end diff --git a/LeanPool/LeanModularForms/ValenceFormula/PVChain/OnCurveCapture.lean b/LeanPool/LeanModularForms/ValenceFormula/PVChain/OnCurveCapture.lean index 53c3330e53..4dc39eb963 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/PVChain/OnCurveCapture.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/PVChain/OnCurveCapture.lean @@ -11,8 +11,6 @@ import LeanPool.LeanModularForms.ValenceFormula.OrbitSum import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # On-Curve Capture Lemmas @@ -61,7 +59,7 @@ theorem oncurve_arc_capture have h_im_pos : 0 < z.im := by linarith [Real.sqrt_pos.mpr (show (0 : ℝ) < 3 by norm_num)] have h_normSq : z.re ^ 2 + z.im ^ 2 = 1 := by have : ‖z‖ ^ 2 = z.re ^ 2 + z.im ^ 2 := by rw [Complex.sq_norm, Complex.normSq_apply]; ring - rw [h_norm] at this; linarith + rw [h_norm] at this; linarith only [this] have h_im_sq_ge : z.im ^ 2 ≥ 3/4 := by nlinarith [mul_self_le_mul_self (by positivity : 0 ≤ Real.sqrt 3 / 2) h_im_ge, Real.sq_sqrt (show (0 : ℝ) ≤ 3 by norm_num)] @@ -71,7 +69,7 @@ theorem oncurve_arc_capture have hp_fd : p ∈ 𝒟 := by refine ⟨?_, h_abs_re⟩ change 1 ≤ Complex.normSq z - rw [Complex.normSq_apply]; nlinarith + rw [Complex.normSq_apply]; nlinarith only [h_normSq] have hp_zero : f p = 0 := modform_zero_to_uhp f h_im_pos h_zero have hp_in_S := hS_complete p hp_fd (orderOfVanishingAt'_ne_zero_of_eq_zero f hf p hp_zero) change z ∈ (↑(sArcOfS S) : Set ℂ) @@ -164,7 +162,8 @@ theorem oncurve_seg4_capture have h_seg_eq : z = fdBoundarySeg1H H s - 1 := by rw [hz_seg, ← h4s]; exact seg4_eq_seg1_minus_one_H H s hs_Icc have h_periodic : Function.Periodic (modularFormCompOfComplex f) (1 : ℂ) := - SlashInvariantFormClass.periodic_comp_ofComplex f (by simp) + SlashInvariantFormClass.periodic_comp_ofComplex f (by simp only [strictPeriods_Gamma, + Nat.cast_one, AddSubgroup.mem_zmultiples]) have h_z_plus_1 : z + 1 = fdBoundarySeg1H H s := by rw [h_seg_eq]; ring have h_zero_seg1 : modularFormCompOfComplex f (fdBoundarySeg1H H s) = 0 := by rw [← h_z_plus_1]; exact (h_periodic z).symm ▸ h_zero @@ -221,7 +220,9 @@ theorem oncurve_full_capture (S : Finset ℍ) (_hS : ∀ p ∈ S, p ∈ 𝒟) simp [fdBoundarySeg1H, add_re, mul_re, I_re, I_im, ofReal_re, ofReal_im] have h_im : (fdBoundaryH H 0).im = H := by rw [fdBoundary_H_eq_seg1_H (by norm_num : (0 : ℝ) ≤ 1)] - simp [fdBoundarySeg1H, add_im, mul_im, I_re, I_im, ofReal_re, ofReal_im] + simp only [fdBoundarySeg1H, one_div, ofReal_zero, zero_mul, sub_zero, add_im, inv_im, + im_ofNat, neg_zero, normSq_ofNat, zero_div, mul_im, ofReal_re, I_im, mul_one, ofReal_im, + I_re, mul_zero, add_zero, zero_add] exact height_contradiction f hf S hS_complete hH_ge1 hH_bound h_im h_re h_zero · rcases (eq_or_lt_of_le h1 : t = 1 ∨ t < 1) with rfl | h1s · left @@ -262,7 +263,8 @@ theorem oncurve_full_capture (S : Finset ℍ) (_hS : ∀ p ∈ S, p ∈ 𝒟) rw [abs_le]; constructor <;> linarith only [h4, ht.2, ht] have h_im : (fdBoundaryH H t).im = H := by rw [fdBoundary_H_eq_seg5_H (by linarith only [h4] : (4 : ℝ) < t)] - simp [fdBoundarySeg5H, add_im, sub_im, mul_im, I_re, I_im, ofReal_re, ofReal_im] + simp only [fdBoundarySeg5H, add_im, sub_im, ofReal_im, div_ofNat_im, im_ofNat, zero_div, + sub_self, mul_im, ofReal_re, I_im, mul_one, I_re, mul_zero, add_zero, zero_add] exact height_contradiction f hf S hS_complete hH_ge1 hH_bound h_im h_re h_zero end diff --git a/LeanPool/LeanModularForms/ValenceFormula/PVChain/ResidueSideInfra.lean b/LeanPool/LeanModularForms/ValenceFormula/PVChain/ResidueSideInfra.lean index 48e0c46f68..90dd822257 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/PVChain/ResidueSideInfra.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/PVChain/ResidueSideInfra.lean @@ -15,8 +15,6 @@ import LeanPool.LeanModularForms.ValenceFormula.OrbitSum import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Residue-Side Infrastructure for the PV Chain @@ -75,8 +73,10 @@ private lemma strict_convex_comb_ub {a b x y U : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ lemma fdBox_convex (M : ℝ) : Convex ℝ (fdBox M) := by intro x hx y hy a b ha hb hab simp only [fdBox, Set.mem_ofPred_eq] at hx hy ⊢ - have hre : (a • x + b • y).re = a * x.re + b * y.re := by simp [add_re] - have him : (a • x + b • y).im = a * x.im + b * y.im := by simp [add_im] + have hre : (a • x + b • y).re = a * x.re + b * y.re := by simp only [real_smul, add_re, mul_re, + ofReal_re, ofReal_im, zero_mul, sub_zero] + have him : (a • x + b • y).im = a * x.im + b * y.im := by simp only [real_smul, add_im, mul_im, + ofReal_re, ofReal_im, zero_mul, add_zero] exact ⟨hre ▸ strict_convex_comb_lb ha hb hab hx.1 hy.1, hre ▸ strict_convex_comb_ub ha hb hab hx.2.1 hy.2.1, him ▸ strict_convex_comb_lb ha hb hab hx.2.2.1 hy.2.2.1, @@ -137,7 +137,7 @@ theorem hasSimplePoleAt_logDeriv_of_zero_full (s : ℍ) (hs : f s = 0) : have h_analytic := analyticAt_modform f (s : ℂ) s.im_pos have h_order_ne_zero : analyticOrderAt (modularFormCompOfComplex f) (s : ℂ) ≠ 0 := by rw [h_analytic.analyticOrderAt_ne_zero] - simp_all + simp_all only [ne_eq, Function.comp_apply, UpperHalfPlane.ofComplex_apply] obtain ⟨g, hg_analytic, hg_ne_zero, hg_eq⟩ := h_analytic.analyticOrderAt_ne_top.mp (modform_not_locally_zero f hf s) set n : ℕ := analyticOrderNatAt (modularFormCompOfComplex f) (s : ℂ) with hn_def @@ -199,7 +199,8 @@ theorem hasSimplePoleAt_logDeriv_of_zero' (s : ℍ) (hs : f s = 0) : obtain ⟨n, g, _, hg_analytic, hg_ne_zero, _, h_formula⟩ := hasSimplePoleAt_logDeriv_of_zero_full f hf s hs exact ⟨(n : ℂ), logDeriv g, hg_analytic.deriv.fun_div hg_analytic hg_ne_zero, by - rw [eventually_nhdsWithin_iff]; simp_all⟩ + rw [eventually_nhdsWithin_iff]; simp_all only [ne_eq, Int.natCast_pos, Int.cast_natCast, + mem_compl_iff, mem_singleton_iff]⟩ omit hf in /-- `HasSimplePoleAt` of logDeriv at a non-zero point (trivial: c = 0, g = logDeriv f). -/ @@ -208,7 +209,7 @@ lemma hasSimplePoleAt_logDeriv_at_nonzero (z : ℂ) (hz_im : 0 < z.im) HasSimplePoleAt (logDeriv (modularFormCompOfComplex f)) z := by exact ⟨0, logDeriv (modularFormCompOfComplex f), analyticAt_logDeriv_off_zeros' f z hz_im hz_nz, by - filter_upwards with z; simp [zero_div, zero_add]⟩ + filter_upwards with z; simp only [zero_div, zero_add]⟩ include hf in /-- `HasSimplePoleAt` for any point with positive imaginary part. -/ @@ -255,7 +256,8 @@ theorem residueSimplePole_logDeriv_eq_order (s : ℍ) (hs : f s = 0) : hg_analytic.deriv.fun_div hg_analytic hg_ne_zero have h_decomp : ∀ᶠ z in 𝓝[≠] (s : ℂ), logDeriv (modularFormCompOfComplex f) z = (n : ℂ) / (z - (s : ℂ)) + logDeriv g z := by - rw [eventually_nhdsWithin_iff]; simp_all + rw [eventually_nhdsWithin_iff]; simp_all only [ne_eq, Int.natCast_pos, Int.cast_natCast, + mem_compl_iff, mem_singleton_iff] rw [residue_simple_pole_eq_laurent _ (s : ℂ) (n : ℂ) (logDeriv g) h_logDeriv_g_analytic h_decomp, hn_eq] exact_mod_cast (orderOfVanishingAt'_eq_analyticOrderNatAt f hf s hs).symm @@ -386,7 +388,8 @@ private lemma logDerivPatched_eventuallyEq_raw_punctured (F : ℂ → ℂ) (S0 : logDerivPatched F S0 hsp =ᶠ[𝓝[≠] s] F := by rw [Filter.EventuallyEq, eventually_nhdsWithin_iff] filter_upwards [(S0.erase s).finite_toSet.isClosed.isOpen_compl.mem_nhds - (by simp [Set.mem_compl_iff])] with z hz hzne + (by simp only [Finset.coe_erase, mem_compl_iff, Set.mem_sdiff, SetLike.mem_coe, + mem_singleton_iff, not_true_eq_false, and_false, not_false_eq_true])] with z hz hzne exact dite_eq_right (fun habs => hz (Finset.mem_coe.mpr (Finset.mem_erase.mpr ⟨hzne, habs⟩))) omit f hf in @@ -479,7 +482,7 @@ lemma fdBoundary_H_norm_ge_one {H : ℝ} (hH : 1 ≤ H) (t : ℝ) (ht : t ∈ Ic · change ‖fdBoundarySeg2 t‖ = 1 unfold fdBoundarySeg2 rw [show (↑Real.pi / 3 + (↑t - 1) * (↑Real.pi / 2 - ↑Real.pi / 3)) * I = - ↑(Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3)) * I from by push_cast; ring] + ↑(Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3)) * I from by push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ · change ‖fdBoundarySeg3 t‖ = 1 unfold fdBoundarySeg3 @@ -563,8 +566,12 @@ lemma ftc_integral_zero_of_closed_slit {γ : ℝ → ℂ} {z₀ : ℂ} {ω : ℂ change ContinuousWithinAt (fun t => (γ t - z₀)⁻¹ * deriv γ t) _ t have ht_Ioo : t ∈ Ioo (0 : ℝ) 5 := by refine ⟨lt_of_le_of_ne ht_Icc.1 ?_, lt_of_le_of_ne ht_Icc.2 ?_⟩ - · intro h; exact ht_not_P (by rw [← h]; simp [fdBoundaryFullPartition]) - · intro h; exact ht_not_P (by rw [h]; simp [fdBoundaryFullPartition]) + · intro h; exact ht_not_P (by rw [← h]; simp only [fdBoundaryFullPartition, + Finset.coe_insert, Finset.coe_singleton, mem_insert_iff, zero_ne_one, OfNat.zero_ne_ofNat, + mem_singleton_iff, or_self, or_false]) + · intro h; exact ht_not_P (by rw [h]; simp only [fdBoundaryFullPartition, Finset.coe_insert, + Finset.coe_singleton, mem_insert_iff, OfNat.ofNat_ne_zero, OfNat.ofNat_ne_one, + OfNat.ofNat_eq_ofNat, Nat.reduceEqDiff, Nat.succ_ne_self, mem_singleton_iff, or_true]) exact ((hγ_cont.continuousAt.sub continuousAt_const).inv₀ (sub_ne_zero.mpr (h_off t ht_Icc))).continuousWithinAt.mul (hγ_deriv_cont t ht_Ioo (Finset.mem_coe.not.mp ht_not_P)).continuousWithinAt @@ -581,7 +588,7 @@ lemma ftc_integral_zero_of_closed_slit {γ : ℝ → ℂ} {z₀ : ℂ} {ω : ℂ have hFTC := MeasureTheory.integral_eq_of_hasDerivAt_off_countable_of_le F F' (by norm_num : (0 : ℝ) ≤ 5) fdBoundaryFullPartition.countable_toSet hF_cont hF_deriv hF'_int - simp_all + simp_all only [ne_eq, mem_Icc, and_imp, mem_Ioo, Set.mem_sdiff, SetLike.mem_coe, sub_self] include hf in /-- Winding number = 0 for points in `fdBox` but NOT in the fundamental domain. -/ @@ -645,7 +652,7 @@ lemma winding_zero_for_non_fd_point_H_geo (S : Finset UpperHalfPlane) -((fdBoundaryH H t).re - z₀.re) := by simp [mul_im, neg_im, I_re, I_im, sub_re, sub_im] have h1 : (fdBoundaryH H t).im ≤ z₀.im := by linarith [h_re_neg_I ▸ h_not_slit.1] have h2 : (fdBoundaryH H t).re = z₀.re := by - have := h_not_slit.2; rw [h_im_neg_I] at this; linarith + have := h_not_slit.2; rw [h_im_neg_I] at this; linarith only [h_not_slit, h_im_neg_I] have h_sq_norm_z₀ := Complex.sq_norm z₀ rw [Complex.normSq_apply] at h_sq_norm_z₀ have h_sq_norm_curve := Complex.sq_norm (fdBoundaryH H t) diff --git a/LeanPool/LeanModularForms/ValenceFormula/PVChain/Seg5CuspIntegral.lean b/LeanPool/LeanModularForms/ValenceFormula/PVChain/Seg5CuspIntegral.lean index 49cfb6e035..63920208c2 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/PVChain/Seg5CuspIntegral.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/PVChain/Seg5CuspIntegral.lean @@ -11,8 +11,6 @@ import LeanPool.LeanModularForms.ForMathlib.QExpansion import LeanPool.LeanModularForms.ValenceFormula.Boundary.Smooth import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Seg5 Cusp Integral @@ -62,7 +60,7 @@ private lemma qExpFMS_ne_zero (hf : f ≠ 0) : UpperHalfPlane.qExpansionFormalMultilinearSeries 1 f ≠ 0 := by intro h have hp := ModularFormClass.hasFPowerSeries_cuspFunction - (f := f) one_pos (by simp) + (f := f) one_pos (by simp only [strictPeriods_Gamma, Nat.cast_one, AddSubgroup.mem_zmultiples]) have hp0 : HasFPowerSeriesOnBall (UpperHalfPlane.cuspFunction (1 : ℝ) f) (0 : FormalMultilinearSeries ℂ ℂ ℂ) 0 1 := h ▸ hp have hF_analytic : AnalyticOnNhd ℂ (UpperHalfPlane.cuspFunction (1 : ℝ) f) @@ -75,7 +73,8 @@ private lemma qExpFMS_ne_zero (hf : f ≠ 0) : have : ∀ τ : UpperHalfPlane, f τ = 0 := by intro τ have := SlashInvariantFormClass.eq_cuspFunction f τ - (by simp) (by norm_num : (1 : ℝ) ≠ 0) + (by simp only [strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) (by norm_num : (1 : ℝ) ≠ 0) rw [← this] exact hF_eq_zero (by simpa using τ.norm_qParam_lt_one 1) exact hf (ModularForm.ext (fun τ => this τ)) @@ -297,7 +296,7 @@ lemma circleIntegral_logDeriv_cuspFunction_of_radius (hf : f ≠ 0) change (↑((orderAtCusp' f).toNat) : ℂ) = ↑(orderAtCusp' f) unfold orderAtCusp' push_cast [Int.toNat_natCast]; rfl - rw [hm_cast]; ring + rw [hm_cast]; ac_rfl /-! ### Height-Parameterized Seg5 Helpers -/ @@ -345,7 +344,8 @@ private lemma logDeriv_modularForm_eq_logDeriv_cuspFn_mul_qderiv_H have h_rw : F (q_fn w) = F (q_fn (↑(UpperHalfPlane.ofComplex w))) := by rw [h_ofC] rw [h_rw] exact (SlashInvariantFormClass.eq_cuspFunction f - (UpperHalfPlane.ofComplex w) (by simp) + (UpperHalfPlane.ofComplex w) (by simp only [strictPeriods_Gamma, Nat.cast_one, + AddSubgroup.mem_zmultiples]) (by norm_num : (1 : ℝ) ≠ 0)).symm have hq_norm : ‖q_fn z‖ < 1 := by simp only [q_fn, Function.Periodic.norm_qParam] diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/AngleAnalysis.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/AngleAnalysis.lean index db59048183..f1b97ae791 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/AngleAnalysis.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/AngleAnalysis.lean @@ -9,7 +9,6 @@ public import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.RadialHomoto import LeanPool.LeanModularForms.GeneralizedResidueTheory.Homotopy.Invariance import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.PolygonSlope import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Angle analysis and winding number invariance @@ -101,8 +100,12 @@ lemma v1_quadrant (p : ℂ) (hp_norm : ‖p‖ > 1) (hp_re : |p.re| < 1 / 2) rw [fdPolygon_at_one] have hpre : p.re < 1/2 := (abs_lt.mp hp_re).2 have hbound := interior_point_im_bound p hp_norm hp_re hp_im_pos - have hre : (rho' - p).re = 1/2 - p.re := by simp [rho'] - have him : (rho' - p).im = Real.sqrt 3 / 2 - p.im := by simp [rho'] + have hre : (rho' - p).re = 1/2 - p.re := by simp only [rho', one_div, sub_re, add_re, inv_re, + re_ofNat, normSq_ofNat, div_self_mul_self', mul_re, div_ofNat_re, ofReal_re, I_re, mul_zero, + div_ofNat_im, ofReal_im, zero_div, I_im, mul_one, sub_self, add_zero] + have him : (rho' - p).im = Real.sqrt 3 / 2 - p.im := by simp only [rho', one_div, sub_im, add_im, + inv_im, im_ofNat, neg_zero, normSq_ofNat, zero_div, mul_im, div_ofNat_re, ofReal_re, I_im, + mul_one, div_ofNat_im, ofReal_im, I_re, mul_zero, add_zero, zero_add] exact ⟨by linarith only [hpre, hre], by linarith only [hbound, him]⟩ /-- Polygon vertex at t=3: rho. -/ @@ -116,8 +119,12 @@ lemma v3_quadrant (p : ℂ) (hp_norm : ‖p‖ > 1) (hp_re : |p.re| < 1 / 2) rw [fdPolygon_at_three] have hpre : -1/2 < p.re := by linarith only [hp_re, (abs_lt.mp hp_re).1] have hbound := interior_point_im_bound p hp_norm hp_re hp_im_pos - have hre : (rho - p).re = -1/2 - p.re := by simp [rho] - have him : (rho - p).im = Real.sqrt 3 / 2 - p.im := by simp [rho] + have hre : (rho - p).re = -1/2 - p.re := by simp only [rho, sub_re, add_re, div_ofNat_re, neg_re, + one_re, mul_re, ofReal_re, I_re, mul_zero, div_ofNat_im, ofReal_im, zero_div, I_im, mul_one, + sub_self, add_zero] + have him : (rho - p).im = Real.sqrt 3 / 2 - p.im := by simp only [rho, sub_im, add_im, + div_ofNat_im, neg_im, one_im, neg_zero, zero_div, mul_im, div_ofNat_re, ofReal_re, I_im, + mul_one, ofReal_im, I_re, mul_zero, add_zero, zero_add] exact ⟨by linarith only [hpre, hre], by linarith only [hbound, him]⟩ /-- Direction from p to fdPolygon 4 is in Q2 (re < 0, im > 0). -/ @@ -182,9 +189,9 @@ lemma tL_mem_Ioo (p : ℂ) (hp_norm : ‖p‖ > 1) (hp_re : |p.re| < 1 / 2) tL p ∈ Set.Ioo (3 : ℝ) 4 := by have hbound := interior_point_im_bound p hp_norm hp_re hp_im_pos have hH : HHeight = Real.sqrt 3 / 2 + 1 := rfl - have hdenom_pos : HHeight - Real.sqrt 3 / 2 > 0 := by rw [hH]; linarith - have hnum_pos : p.im - Real.sqrt 3 / 2 > 0 := by linarith - have hnum_lt : p.im - Real.sqrt 3 / 2 < HHeight - Real.sqrt 3 / 2 := by linarith + have hdenom_pos : HHeight - Real.sqrt 3 / 2 > 0 := by rw [hH]; linarith only [hp_im, hbound, hH] + have hnum_pos : p.im - Real.sqrt 3 / 2 > 0 := by exact sub_pos.mpr hbound + have hnum_lt : p.im - Real.sqrt 3 / 2 < HHeight - Real.sqrt 3 / 2 := by linarith only [hp_im] simp only [tL, Set.mem_Ioo] constructor · linarith [div_pos hnum_pos hdenom_pos] @@ -455,8 +462,8 @@ lemma winding_fdPolygon_center_invariant (p₁ p₂ : ℂ) continuous_const |>.add ((Complex.continuous_ofReal.comp continuous_snd).mul continuous_const)) - · intro t _ht; simp [H, γ₀] - · intro t _ht; simp [H, γ₁] + · intro t _ht; simp only [ofReal_zero, sub_zero, one_mul, zero_mul, add_zero, H, γ₀] + · intro t _ht; simp only [ofReal_one, sub_self, zero_mul, one_mul, zero_add, H, γ₁] · intro s _hs; simp only [H]; rw [fdPolygon_closed] · intro t ht s hs simp only [H]; rw [sub_ne_zero]; exact havoid s hs t ht diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopyDerivBounds.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopyDerivBounds.lean index 1cbd41b48b..405ab0934c 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopyDerivBounds.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopyDerivBounds.lean @@ -8,7 +8,6 @@ module public import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.Geometry import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.HomotopyDef import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Derivative norm bounds for the homotopy segments @@ -49,12 +48,12 @@ private lemma norm_deriv_arc_chord_le (α c : ℝ) (a b : ℂ) (hab : ‖b - a rw [h_combined.deriv] have h_exp_norm : ‖Complex.exp (((α : ℝ) + (t - c) * (Real.pi / 6)) * I)‖ = 1 := by rw [show (((α : ℝ) + (t - c) * (Real.pi / 6)) * I) = - (((α + (t - c) * (Real.pi / 6)) : ℝ) : ℂ) * I from by push_cast; ring, + (((α + (t - c) * (Real.pi / 6)) : ℝ) : ℂ) * I from by push_cast; ac_rfl, Complex.norm_exp_ofReal_mul_I] have harc_norm : ‖((Real.pi : ℝ) / 6) * I * Complex.exp (((α : ℝ) + (t - c) * (Real.pi / 6)) * I)‖ = Real.pi / 6 := by rw [norm_mul, norm_mul, h_exp_norm, mul_one, Complex.norm_I, mul_one, - show ((Real.pi : ℝ) / 6 : ℂ) = ((Real.pi / 6 : ℝ) : ℂ) from by push_cast; ring, + show ((Real.pi : ℝ) / 6 : ℂ) = ((Real.pi / 6 : ℝ) : ℂ) from by push_cast; ac_rfl, Complex.norm_real, Real.norm_eq_abs, abs_of_pos (by positivity)] calc ‖(1 - s) • (((Real.pi : ℝ) / 6) * I * Complex.exp (((α : ℝ) + (t - c) * (Real.pi / 6)) * I)) + s • (b - a)‖ diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopyDiff.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopyDiff.lean index 57dc014405..c14a9b9162 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopyDiff.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopyDiff.lean @@ -7,7 +7,6 @@ module public import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.Geometry import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Segment differentiability for the homotopy diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopySmooth.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopySmooth.lean index 6ea370720d..44d3e9d2ac 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopySmooth.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/BoundaryHomotopySmooth.lean @@ -8,7 +8,6 @@ module public import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.Geometry import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.HomotopyDef import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Non-differentiability at partition points and derivative continuity @@ -86,7 +85,8 @@ private lemma not_diffAt_at_one (s : ℝ) (hs : s ∈ Set.Icc (0 : ℝ) 1) : ((↑(1 : ℝ) : ℂ) - ↑(1 : ℝ)) * (↑(Real.pi / 6) : ℂ)) * I) = rho' := by rw [show ((↑(1 : ℝ) : ℂ) - ↑(1 : ℝ)) = 0 from by norm_num, zero_mul, add_zero, exp_pi_div_three_eq_rho'] - simp_all + simp_all only [mem_Icc, neg_sub, ofReal_div, ofReal_ofNat, ofReal_one, sub_self, zero_mul, + add_zero] have h_chord : HasDerivAt (fun t' : ℝ => chordSegment rho' iPoint (t' - 1)) (iPoint - rho') (1 : ℝ) := hasDerivAt_chordSegment_shift rho' iPoint 1 1 @@ -104,7 +104,7 @@ private lemma not_diffAt_at_one (s : ℝ) (hs : s ∈ Set.Icc (0 : ℝ) 1) : have h2 : iPoint - rho' = (-1/2 : ℂ) + (1 - ↑(Real.sqrt 3) / 2) * I := by simp only [iPoint, rho']; apply Complex.ext <;> (simp; try norm_num) rw [h1, h2] - simp only [Complex.real_smul]; push_cast; ring + simp only [Complex.real_smul]; push_cast; ac_rfl rw [h_deriv_eq] at h_combined refine (hasDerivAt_iff_tendsto_slope.mp h_combined |>.mono_left (nhdsWithin_mono (1 : ℝ) (fun y hy => ne_of_gt hy))).congr' ?_ @@ -209,7 +209,7 @@ private lemma not_diffAt_at_three (s : ℝ) (hs : s ∈ Set.Icc (0 : ℝ) 1) : have h2 : rho - iPoint = (-1/2 : ℂ) + (↑(Real.sqrt 3) / 2 - 1) * I := by simp only [rho, iPoint]; apply Complex.ext <;> simp rw [h1, h2] - simp only [Complex.real_smul]; push_cast; ring + simp only [Complex.real_smul]; push_cast; ac_rfl rw [h_deriv_eq] at h_combined refine (hasDerivAt_iff_tendsto_slope.mp h_combined |>.mono_left (nhdsWithin_mono (3 : ℝ) (fun y hy => ne_of_lt hy))).congr' ?_ @@ -358,7 +358,7 @@ private lemma not_diffAt_at_four (s : ℝ) (_hs : s ∈ Set.Icc (0 : ℝ) 1) : simp only [Complex.mul_I_im, Complex.one_im, Complex.sub_re, Complex.ofReal_re, Complex.div_ofNat_re] at h_im have h_H_pos : HHeight - Real.sqrt 3 / 2 > 0 := by simp only [HHeight]; norm_num - linarith + linarith only [h_im, h_H_pos] exact h_ne h_eq_right /-- The homotopy is NOT differentiable at t ∈ {1, 3, 4} diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/Geometry.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/Geometry.lean index b3de3a4c95..cd2ed025ce 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/Geometry.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/Geometry.lean @@ -128,12 +128,12 @@ def arc2 (t : ℝ) : ℂ := lemma arc1_on_unit_circle (t : ℝ) : ‖arc1 t‖ = 1 := by rw [arc1, show I * (↑θRho' + ↑t * (↑θI - ↑θRho')) = - ↑(θRho' + t * (θI - θRho')) * I by push_cast; ring] + ↑(θRho' + t * (θI - θRho')) * I by push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ lemma arc2_on_unit_circle (t : ℝ) : ‖arc2 t‖ = 1 := by rw [arc2, show I * (↑θI + ↑t * (↑θRho - ↑θI)) = - ↑(θI + t * (θRho - θI)) * I by push_cast; ring] + ↑(θI + t * (θRho - θI)) * I by push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ lemma arc1_in_closed_unit_ball (t : ℝ) (_ : t ∈ Icc 0 1) : @@ -268,7 +268,7 @@ lemma segment2_arc_on_unit_circle (t : ℝ) : conv_lhs => rw [show ((Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3)) * I : ℂ) = ↑(Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3)) * I by - push_cast; ring] + push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ lemma segment3_arc_on_unit_circle (t : ℝ) : @@ -277,7 +277,7 @@ lemma segment3_arc_on_unit_circle (t : ℝ) : conv_lhs => rw [show ((Real.pi / 2 + (t - 2) * (2 * Real.pi / 3 - Real.pi / 2)) * I : ℂ) = ↑(Real.pi / 2 + (t - 2) * (2 * Real.pi / 3 - Real.pi / 2)) * I by - push_cast; ring] + push_cast; ac_rfl] exact Complex.norm_exp_ofReal_mul_I _ lemma segment2_arc_in_closed_unit_ball (t : ℝ) : diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/HomotopyDef.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/HomotopyDef.lean index e3b8bcdc2b..dc4ade71be 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/HomotopyDef.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/HomotopyDef.lean @@ -8,7 +8,6 @@ module public import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.Geometry import LeanPool.LeanModularForms.ValenceFormula.TrigLemmas import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Homotopy infrastructure for FD boundary → polygon deformation @@ -105,7 +104,7 @@ lemma hasDerivAt_chordSegment_shift (a b : ℂ) (c t : ℝ) : have h2 : HasDerivAt (fun t' : ℝ => (t' - c) • b) b t := by have := h_shift.smul_const b simpa only [one_smul] using this - rw [show b - a = -a + b from by ring] + rw [show b - a = -a + b from by ac_rfl] exact h1.add h2 lemma exp_pi_div_three_eq_rho' : @@ -143,7 +142,7 @@ lemma H_match_at_t1 (p : ℝ × ℝ) (hp : p.1 = 1) : simp only [Complex.ofReal_one, sub_self, zero_mul, add_zero] simp only [hangle] - have hpi3 : (↑Real.pi / 3 : ℂ) = ↑(Real.pi / 3) := by push_cast; ring + have hpi3 : (↑Real.pi / 3 : ℂ) = ↑(Real.pi / 3) := by push_cast; ac_rfl rw [hpi3, exp_pi_div_three_eq_rho'] simp only [sub_self, rho'] simp only [Complex.real_smul, @@ -170,7 +169,7 @@ lemma H_match_at_t3 (p : ℝ × ℝ) (hp : p.1 = 3) : Complex.exp (2 * ↑Real.pi / 3 * I) = -1/2 + ↑(Real.sqrt 3) / 2 * I := by have h : (2 * ↑Real.pi / 3 * I : ℂ) = - ↑(2 * Real.pi / 3) * I := by push_cast; ring + ↑(2 * Real.pi / 3) * I := by push_cast; ac_rfl rw [h, exp_two_pi_div_three_eq_rho, rho] simp only [hexp]; ring diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheorem.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheorem.lean index ae023834f6..b5612a0866 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheorem.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheorem.lean @@ -14,7 +14,6 @@ import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.MainTheoremBound import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.MainTheoremDerivCont import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.WindingProof import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Main winding number theorem for the fundamental domain boundary diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheoremBound.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheoremBound.lean index b29e740e56..894ef21244 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheoremBound.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheoremBound.lean @@ -10,7 +10,6 @@ import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.BoundaryHomotopyDer import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.BoundaryHomotopySmooth import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.HomotopyDef import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Uniform derivative bound for the homotopy @@ -103,7 +102,8 @@ private lemma not_diffAt_at_two (s : ℝ) (hs0 : s ≠ 0) : congr 1 · congr 1; push_cast; ring_nf · rw [show (2 : ℝ) - 1 = 1 from by norm_num, show (2 : ℝ) - 2 = 0 from by norm_num] - simp [chordSegment] + simp only [sub_self, zero_smul, one_smul, zero_add, real_smul, chordSegment, sub_zero, + add_zero] have h_at_t'r : fdBoundaryToPolygonHomotopy (t', s) = g_right t' := by simp only [fdBoundaryToPolygonHomotopy, not_le.mpr (show (1 : ℝ) < t' by linarith only [ht', ht'.1]), not_le.mpr ht'.1, ite_false, @@ -151,12 +151,12 @@ private lemma deriv_bound_at_two_zero : have h_raw := hasDerivAt_arc_exp (Real.pi / 3) (Real.pi / 6) 1 2 rw [show ((↑(Real.pi / 3) : ℂ) + ((↑(2 : ℝ) : ℂ) - ↑(1 : ℝ)) * (↑(Real.pi / 6) : ℂ)) * I = ((Real.pi : ℝ) / 2 : ℂ) * I from by push_cast; ring] at h_raw - convert h_raw using 2 <;> push_cast <;> ring + convert h_raw using 2 <;> push_cast <;> ac_rfl rw [h_deriv.deriv] have h_exp_norm : ‖Complex.exp ((Real.pi / 2) * I)‖ = 1 := by simp_all only [exp_pi_div_two_mul_I, norm_I] rw [norm_mul, norm_mul, h_exp_norm, Complex.norm_I, mul_one, mul_one, - show (Real.pi / 6 : ℂ) = ((Real.pi / 6 : ℝ) : ℂ) from by push_cast; ring, Complex.norm_real, + show (Real.pi / 6 : ℂ) = ((Real.pi / 6 : ℝ) : ℂ) from by push_cast; ac_rfl, Complex.norm_real, Real.norm_eq_abs, abs_of_pos (by positivity : (0 : ℝ) < Real.pi / 6)] have := Real.pi_le_four; linarith only [this] diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheoremDerivCont.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheoremDerivCont.lean index dcb5585313..d3a22fcb5e 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheoremDerivCont.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/MainTheoremDerivCont.lean @@ -8,7 +8,6 @@ module public import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.Geometry import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.BoundaryHomotopySmooth import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Derivative continuity for the homotopy on partition pieces @@ -67,7 +66,7 @@ private lemma seg2_deriv_eq (s t : ℝ) (ht1 : 1 < t) (ht2 : t < 2) : have h2 : HasDerivAt (fun t' : ℝ => (t' - 1) • iPoint) iPoint t := by have := h_shift.smul_const iPoint simpa only [one_smul] using this - exact (h1.add h2).congr_deriv (by ring) + exact (h1.add h2).congr_deriv (by ac_rfl) exact ((h_arc.const_smul (1 - s)).add (h_chord.const_smul s)).deriv /-- On `(2, 3)`, the homotopy's `t`-derivative equals the arc/chord formula at `(t, s)`. -/ @@ -114,7 +113,7 @@ private lemma seg3_deriv_eq (s t : ℝ) (ht2 : 2 < t) (ht3 : t < 3) : have h2 : HasDerivAt (fun t' : ℝ => (t' - 2) • rho) rho t := by have := h_shift.smul_const rho simpa only [one_smul] using this - exact (h1.add h2).congr_deriv (by ring) + exact (h1.add h2).congr_deriv (by ac_rfl) exact ((h_arc.const_smul (1 - s)).add (h_chord.const_smul s)).deriv private lemma deriv_cont_seg1 (p₁ p₂ : ℝ) (_hp₁p₂ : p₁ < p₂) (h_seg1 : p₂ ≤ 1) : @@ -209,7 +208,8 @@ private lemma deriv_cont_seg4 (p₁ p₂ : ℝ) (_hp₁p₂ : p₁ < p₂) have h4 : HasDerivAt (fun t' : ℝ => (Real.sqrt 3 / 2 : ℂ) + ((↑t' : ℂ) - 3) * ((HHeight : ℂ) - Real.sqrt 3 / 2)) ((HHeight : ℂ) - Real.sqrt 3 / 2) q.1 := by - simp_all + simp_all only [ge_iff_le, mem_Ioo, mem_Icc, gt_iff_lt, hasDerivAt_sub_const_iff, + hasDerivAt_const_add_iff] have h6 := (hasDerivAt_const q.1 ((-1/2 : ℂ))).add (h4.mul_const I) simp only [zero_add] at h6; exact h6.deriv apply ContinuousOn.congr continuousOn_const hconst @@ -226,8 +226,8 @@ private lemma deriv_cont_seg5 (p₁ p₂ : ℝ) (_hp₁p₂ : p₁ < p₂) (h_se (fun t' : ℝ => ((↑t' : ℂ) - 9/2) + (HHeight : ℂ) * I) := by filter_upwards [eventually_gt_nhds ht_gt4] with t' ht4' simp only [fdBoundaryToPolygonHomotopy, - not_le.mpr (by linarith : 1 < t'), not_le.mpr (by linarith : 2 < t'), - not_le.mpr (by linarith : 3 < t'), not_le.mpr ht4', ite_false] + not_le.mpr (by linarith only [ht4'] : 1 < t'), not_le.mpr (by linarith : 2 < t'), + not_le.mpr (by linarith only [ht4'] : 3 < t'), not_le.mpr ht4', ite_false] rw [heq.deriv_eq] have hd : HasDerivAt (fun t' : ℝ => ((↑t' : ℂ) - 9/2) + (HHeight : ℂ) * I) 1 q.1 := (Complex.ofRealCLM.hasDerivAt.sub_const (9/2)).add_const ((HHeight : ℂ) * I) diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/PolygonProps.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/PolygonProps.lean index 1ae9c9e1af..9e3f688b7d 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/PolygonProps.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/PolygonProps.lean @@ -7,7 +7,6 @@ module public import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.Geometry import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Polygon properties: values, segment functions, derivatives, differentiability @@ -45,7 +44,7 @@ lemma fdPolygon_at_t3 : fdPolygon 3 = rho := by show ¬(3 : ℝ) ≤ 2 from by norm_num, show (3 : ℝ) ≤ 3 from le_refl 3, ↓reduceIte] simp only [chordSegment, rho, show (3 : ℝ) - 2 = 1 by ring, sub_self] - simp + simp only [zero_smul, smul_add, one_smul, zero_add] lemma fdPolygon_at_t4 : fdPolygon 4 = -1/2 + HHeight * I := by @@ -94,7 +93,8 @@ lemma fdPolygon_match_t1 : fdPolygonSeg1 1 = fdPolygonSeg2 1 := by simp only [fdPolygonSeg1, fdPolygonSeg2, chordSegment, HHeight, rho', sub_self] - simp + simp only [one_div, ofReal_add, ofReal_div, ofReal_ofNat, ofReal_one, add_sub_cancel_left, + mul_one, add_sub_cancel_right, sub_zero, smul_add, one_smul, zero_smul, add_zero] lemma fdPolygon_match_t2 : fdPolygonSeg2 2 = fdPolygonSeg3 2 := by @@ -107,7 +107,8 @@ lemma fdPolygon_match_t3 : fdPolygonSeg3 3 = fdPolygonSeg4 3 := by simp only [fdPolygonSeg3, fdPolygonSeg4, chordSegment, rho, HHeight, show (3 : ℝ) - 2 = 1 by ring, sub_self] - simp + simp only [zero_smul, smul_add, one_smul, zero_add, ofReal_ofNat, sub_self, ofReal_add, + ofReal_div, ofReal_one, add_sub_cancel_left, mul_one, add_zero] lemma fdPolygon_match_t4 : fdPolygonSeg4 4 = fdPolygonSeg5 4 := by diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/PolygonSlope.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/PolygonSlope.lean index 07df219bd6..23f96869b7 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/PolygonSlope.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/PolygonSlope.lean @@ -8,7 +8,6 @@ module public import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.Geometry import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.PolygonProps import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Polygon slope analysis and derivative bounds @@ -115,7 +114,8 @@ lemma slope_fdPolygon_seg5 (s t : ℝ) (hs : s > 4) (ht : t > 4) (hst : s ≠ t) erw [Complex.real_smul] have hne : (↑t : ℂ) - ↑s ≠ 0 := by simpa only [sub_ne_zero, ne_eq, Complex.ofReal_inj] using hst.symm - simp_all + simp_all only [gt_iff_lt, ne_eq, not_le, ofReal_inv, ofReal_sub, add_sub_add_right_eq_sub, + sub_sub_sub_cancel_right, not_false_eq_true, inv_mul_cancel₀] private lemma HHeight_sub_sqrt3_half : (↑HHeight - ↑(Real.sqrt 3) / 2 : ℂ) = 1 := by simp only [HHeight]; push_cast; ring @@ -241,7 +241,7 @@ lemma slope_fdPolygon_at_t3_right (s : ℝ) (hs3 : s > 3) (hs4 : s ≤ 4) : simp only [fdPolygon, show ¬((3 : ℝ) ≤ 1) from by norm_num, show ¬((3 : ℝ) ≤ 2) from by norm_num, ↓reduceIte, show (3 : ℝ) ≤ 3 from le_refl 3, chordSegment] - ring_nf; simp; simp only [rho]; ring + ring_nf; simp only [zero_smul, one_smul, zero_add, one_div]; simp only [rho]; ac_rfl have heqs : fdPolygon s = -1/2 + (Real.sqrt 3 / 2 + (s - 3) * (HHeight - Real.sqrt 3 / 2)) * I := by simp only [fdPolygon, not_le.mpr (lt_trans (by norm_num : (1 : ℝ) < 3) hs3), diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/RadialHomotopy.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/RadialHomotopy.lean index ad390ace43..80e2622949 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/RadialHomotopy.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/RadialHomotopy.lean @@ -12,7 +12,6 @@ import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.HomotopyDef import Mathlib.Analysis.Calculus.Deriv.Prod import Mathlib.Analysis.InnerProductSpace.Calculus import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Radial homotopy from polygon to unit circle @@ -129,7 +128,9 @@ lemma fdPolygon_ne_p_everywhere (p : ℂ) (hp_norm : ‖p‖ > 1) (hp_re : |p.re · push Not at ht4 simp only [fdPolygon, not_le.mpr ht1, not_le.mpr ht2, not_le.mpr ht3, not_le.mpr ht4, ↓reduceIte] at heq - have him : p.im = HHeight := by rw [← heq]; simp [Complex.add_im, Complex.mul_im] + have him : p.im = HHeight := by rw [← heq]; simp only [add_im, sub_im, ofReal_im, + div_ofNat_im, im_ofNat, zero_div, sub_self, mul_im, ofReal_re, I_im, mul_one, I_re, + mul_zero, add_zero, zero_add] linarith only [hp_im, him] /-- Radial homotopy is continuous. -/ @@ -383,7 +384,7 @@ lemma fdPolygon_right_deriv_norm_le (x : ℝ) : split_ifs with h1 h2 h3 h4 · simp only [fdPolygon_deriv_seg1] have h1 : (↑HHeight : ℂ) - ↑(Real.sqrt 3) / 2 = 1 := by simp only [HHeight]; push_cast; ring - rw [h1]; simp [Complex.norm_I] + rw [h1]; simp only [neg_mul, one_mul, norm_neg, norm_I, Nat.one_le_ofNat] · rw [fdPolygon_deriv_seg2] calc ‖iPoint - rho'‖ ≤ ‖iPoint‖ + ‖rho'‖ := norm_sub_le _ _ _ = 1 + 1 := by rw [i_point_norm, rho'_norm] @@ -394,7 +395,7 @@ lemma fdPolygon_right_deriv_norm_le (x : ℝ) : _ ≤ 3 := by norm_num · simp only [fdPolygon_deriv_seg4] have h1 : (↑HHeight : ℂ) - ↑(Real.sqrt 3) / 2 = 1 := by simp only [HHeight]; push_cast; ring - rw [h1]; simp [Complex.norm_I] + rw [h1]; simp only [one_mul, norm_I, Nat.one_le_ofNat] · rw [fdPolygon_deriv_seg5]; simp only [norm_one]; norm_num /-- fdPolygon has a right derivative at every point. -/ @@ -415,7 +416,9 @@ lemma fdPolygon_hasDerivWithinAt_Ici (x : ℝ) : simp only [fdPolygon, fdPolygonSeg2] split_ifs with h'₁ h'₂ h'₃ h'₄ · have : t = 1 := le_antisymm h'₁ (h1.trans ht_ge) - subst this; simp [chordSegment, rho', HHeight, iPoint] + subst this; simp only [one_div, HHeight, ofReal_add, ofReal_div, ofReal_ofNat, ofReal_one, + add_sub_cancel_left, mul_one, add_sub_cancel_right, chordSegment, sub_self, sub_zero, + rho', smul_add, one_smul, iPoint, zero_smul, add_zero] · rfl all_goals linarith only [ht_lt, h'₂] exact (fdPolygon_seg2_differentiable.differentiableAt.hasDerivAt.hasDerivWithinAt @@ -423,7 +426,9 @@ lemma fdPolygon_hasDerivWithinAt_Ici (x : ℝ) : (by simp only [fdPolygon, fdPolygonSeg2] split_ifs with h'₁ h'₂ h'₃ h'₄ · have : x = 1 := le_antisymm h'₁ h1; subst this - simp [chordSegment, rho', HHeight, iPoint] + simp only [one_div, HHeight, ofReal_add, ofReal_div, ofReal_ofNat, ofReal_one, + add_sub_cancel_left, mul_one, add_sub_cancel_right, chordSegment, sub_self, sub_zero, + rho', smul_add, one_smul, iPoint, zero_smul, add_zero] · rfl all_goals linarith only [h2, h'₂]) · push Not at h1 h2 @@ -434,7 +439,8 @@ lemma fdPolygon_hasDerivWithinAt_Ici (x : ℝ) : split_ifs with h'₁ h'₂ h'₃ h'₄ · linarith only [h2, ht_ge, h'₁, h2.trans ht_ge] · have : t = 2 := le_antisymm h'₂ (h2.trans ht_ge) - subst this; simp [chordSegment, rho, iPoint]; ring + subst this; simp only [chordSegment, real_smul, ofReal_sub, ofReal_one, ofReal_ofNat, + iPoint, sub_self, sub_zero, one_smul, rho, smul_add, zero_smul, add_zero]; ring · rfl all_goals linarith only [ht_lt, h'₃] exact (fdPolygon_seg3_differentiable.differentiableAt.hasDerivAt.hasDerivWithinAt @@ -443,7 +449,8 @@ lemma fdPolygon_hasDerivWithinAt_Ici (x : ℝ) : split_ifs with h'₁ h'₂ h'₃ h'₄ · linarith only [h2, h'₁] · have : x = 2 := le_antisymm h'₂ h2; subst this - simp [chordSegment, rho, iPoint]; ring + simp only [chordSegment, real_smul, ofReal_sub, ofReal_one, ofReal_ofNat, iPoint, + sub_self, sub_zero, one_smul, rho, smul_add, zero_smul, add_zero]; ring · rfl all_goals linarith only [h3, h'₃]) · push Not at h1 h2 h3 @@ -456,7 +463,9 @@ lemma fdPolygon_hasDerivWithinAt_Ici (x : ℝ) : · linarith only [h3, ht_ge, h'₂, h3.trans ht_ge] · have : t = 3 := le_antisymm h'₃ (h3.trans ht_ge) subst this - simp [chordSegment, rho, iPoint, HHeight]; ring + simp only [chordSegment, iPoint, real_smul, ofReal_sub, ofReal_one, ofReal_ofNat, rho, + smul_add, sub_self, HHeight, ofReal_add, ofReal_div, add_sub_cancel_left, mul_one, + add_zero]; ring · rfl all_goals linarith only [ht_lt, h'₄] exact (fdPolygon_seg4_differentiable.differentiableAt.hasDerivAt.hasDerivWithinAt @@ -466,7 +475,9 @@ lemma fdPolygon_hasDerivWithinAt_Ici (x : ℝ) : · linarith only [h2, h'₁] · linarith only [h3, h'₂] · have : x = 3 := le_antisymm h'₃ h3; subst this - simp [chordSegment, rho, iPoint, HHeight]; ring + simp only [chordSegment, iPoint, real_smul, ofReal_sub, ofReal_one, ofReal_ofNat, rho, + smul_add, sub_self, HHeight, ofReal_add, ofReal_div, add_sub_cancel_left, mul_one, + add_zero]; ring · rfl all_goals linarith only [h4, h'₄]) · push Not at h1 h2 h3 h4 @@ -479,7 +490,8 @@ lemma fdPolygon_hasDerivWithinAt_Ici (x : ℝ) : · linarith only [h4, hxt, h'₂] · linarith only [h4, hxt, h'₃] · have : t = 4 := le_antisymm h'₄ (h4.trans hxt) - subst this; simp [HHeight]; ring + subst this; simp only [ofReal_ofNat, HHeight, ofReal_add, ofReal_div, ofReal_one, + add_sub_cancel_left, mul_one]; ring · rfl exact (fdPolygon_seg5_differentiable.differentiableAt.hasDerivAt.hasDerivWithinAt ).congr_of_eventuallyEq heq @@ -489,7 +501,8 @@ lemma fdPolygon_hasDerivWithinAt_Ici (x : ℝ) : · linarith only [h4, h'₂] · linarith only [h4, h'₃] · have : x = 4 := le_antisymm h'₄ h4; subst this - simp [HHeight]; ring + simp only [ofReal_ofNat, HHeight, ofReal_add, ofReal_div, ofReal_one, + add_sub_cancel_left, mul_one]; ring · rfl) /-- fdPolygon is Lipschitz with constant 3. -/ @@ -530,7 +543,8 @@ lemma polygonToCircleRadial_deriv_bounded (p : ℂ) (hp_norm : ‖p‖ > 1) simp only [polygonToCircleRadial] set dir := fdPolygon t' - p with hdir by_cases hdir_ne : dir = 0 - · simp [hdir_ne] + · simp only [hdir_ne, norm_zero, mul_zero, zero_add, ofReal_zero, div_zero, smul_zero, + add_zero] · have hnorm_ne : (‖dir‖ : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (norm_ne_zero_iff.mpr hdir_ne) erw [RCLike.real_smul_eq_coe_mul, RCLike.real_smul_eq_coe_mul, @@ -576,7 +590,7 @@ lemma polygonToCircleRadial_deriv_bounded (p : ℂ) (hp_norm : ‖p‖ > 1) apply add_le_add_right apply mul_le_mul_of_nonneg_left · have h_nsub := norm_normalize_sub_le (half_pos hδ_pos) - ht'_delta (le_trans (by linarith : δ / 2 ≤ δ) (hδ_le t ht)) + ht'_delta (le_trans (by linarith only [hδ_pos] : δ / 2 ≤ δ) (hδ_le t ht)) rw [show fdPolygon t' - p - (fdPolygon t - p) = fdPolygon t' - fdPolygon t from by ring] at h_nsub calc ‖(fdPolygon t' - p) / ↑‖fdPolygon t' - p‖ - @@ -599,12 +613,12 @@ lemma polygonToCircleRadial_deriv_bounded (p : ℂ) (hp_norm : ‖p‖ > 1) _ = (1 + 4 / δ) * ‖fdPolygon t' - fdPolygon t‖ := by ring _ ≤ (3 + 4 / δ) * ‖fdPolygon t' - fdPolygon t‖ := by apply mul_le_mul_of_nonneg_right _ (norm_nonneg _) - linarith + linarith only [] _ ≤ (3 + 4 / δ) * (3 * |t' - t|) := by apply mul_le_mul_of_nonneg_left _ (by positivity) have h_lip := fdPolygon_norm_sub_le t' t rwa [norm_sub_rev, abs_sub_comm] at h_lip - _ = (3 + 4 / δ) * 3 * |t' - t| := by ring + _ = (3 + 4 / δ) * 3 * |t' - t| := by ac_rfl · simp only [deriv_zero_of_not_differentiableAt hd, norm_zero] positivity diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/WindingBase.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/WindingBase.lean index 3e624e26a7..a43830fc9c 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/WindingBase.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/WindingBase.lean @@ -8,7 +8,6 @@ module public import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.AngleAnalysis import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.HomotopyDef import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Winding number base lemmas @@ -245,22 +244,22 @@ lemma fdPolygon_avoids_line_to_ref (p : ℂ) (hp_norm : ‖p‖ > 1) nlinarith [Real.sq_sqrt (add_nonneg (sq_nonneg p.re) (sq_nonneg p.im)), sq_nonneg (Real.sqrt (p.re ^ 2 + p.im ^ 2) - 1)] intro s ⟨hs0, hs1⟩ t ⟨ht0, ht5⟩ heq - have h1s_cast : (1 : ℂ) - (s : ℂ) = ((1 - s : ℝ) : ℂ) := by push_cast; ring - have h1s_nn : 0 ≤ 1 - s := by linarith + have h1s_cast : (1 : ℂ) - (s : ℂ) = ((1 - s : ℝ) : ℂ) := by push_cast; ac_rfl + have h1s_nn : 0 ≤ 1 - s := by exact sub_nonneg.mpr hs1 have heq_re : (fdPolygon t).re = (1 - s) * p.re := by have := congr_arg Complex.re heq simp only [add_re, mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero, href_re, mul_zero, add_zero] at this rw [h1s_cast] at this simp only [ofReal_re, ofReal_im, zero_mul, sub_zero] at this - linarith + exact this have heq_im : (fdPolygon t).im = (1 - s) * p.im + s * refY₀ := by have := congr_arg Complex.im heq simp only [add_im, mul_im, ofReal_re, ofReal_im, zero_mul, add_zero, href_im] at this rw [h1s_cast] at this simp only [ofReal_re, ofReal_im, zero_mul, add_zero] at this - linarith + exact this by_cases ht1 : t ≤ 1 · have hfd_re : (fdPolygon t).re = 1/2 := by simp only [fdPolygon, ht1, ↓reduceIte, add_re, div_ofNat_re, one_re, mul_re, I_re, @@ -269,9 +268,9 @@ lemma fdPolygon_avoids_line_to_ref (p : ℂ) (hp_norm : ‖p‖ > 1) have h1 : |(1 - s) * p.re| ≤ |p.re| := by rw [abs_mul, abs_of_nonneg h1s_nn]; exact mul_le_of_le_one_left (abs_nonneg _) (by linarith) have h2 : |(1 - s) * p.re| < 1/2 := lt_of_le_of_lt h1 hp_re - have h3 : (1 - s) * p.re = 1/2 := by linarith + have h3 : (1 - s) * p.re = 1/2 := by linarith only [heq_re] have h4 : |(1 - s) * p.re| = 1/2 := by rw [h3]; norm_num - linarith + linarith only [hp_re, h1, h4] · push Not at ht1 by_cases ht2 : t ≤ 2 · exact (avoids_chord_rho'_to_i p hp_re hp_im_pos hp_sq s hs0 hs1 h1s_nn t @@ -289,11 +288,11 @@ lemma fdPolygon_avoids_line_to_ref (p : ℂ) (hp_norm : ‖p‖ > 1) rw [hfd_re] at heq_re have h1 : |(1 - s) * p.re| ≤ |p.re| := by rw [abs_mul, abs_of_nonneg h1s_nn] - exact mul_le_of_le_one_left (abs_nonneg _) (by linarith) + exact mul_le_of_le_one_left (abs_nonneg _) (by linarith only [hs0]) have h2 : |(1 - s) * p.re| < 1/2 := lt_of_le_of_lt h1 hp_re - have h3 : (1 - s) * p.re = -1/2 := by linarith + have h3 : (1 - s) * p.re = -1/2 := by linarith only [heq_re] have h4 : |(1 - s) * p.re| = 1/2 := by rw [h3]; norm_num - linarith + linarith only [hp_re, h1, h4] · push Not at ht4 have hfd_im : (fdPolygon t).im = HHeight := by simp only [fdPolygon, not_le.mpr ht1, not_le.mpr ht2, not_le.mpr ht3, @@ -306,7 +305,7 @@ lemma fdPolygon_avoids_line_to_ref (p : ℂ) (hp_norm : ‖p‖ > 1) rcases eq_or_lt_of_le hs1 with rfl | hs_lt1 · simp only [sub_self, zero_mul, zero_add, one_mul] at heq_im; linarith [ref_Y₀_lt_H] · have : (1 - s) * p.im < (1 - s) * HHeight := by - apply mul_lt_mul_of_pos_left hp_im; linarith + apply mul_lt_mul_of_pos_left hp_im; exact sub_pos.mpr hs_lt1 have : s * refY₀ < s * HHeight := by apply mul_lt_mul_of_pos_left ref_Y₀_lt_H; linarith have : (1 - s) * p.im + s * refY₀ < (1 - s) * HHeight + s * HHeight := by linarith have : (1 - s) * HHeight + s * HHeight = HHeight := by ring diff --git a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/WindingProof.lean b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/WindingProof.lean index 5d62b515b9..6ab0d4f17e 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/WindingProof.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/RectHomotopy/WindingProof.lean @@ -11,7 +11,6 @@ import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.HomotopyDef import LeanPool.LeanModularForms.ValenceFormula.RectHomotopy.WindingBase import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Winding number computation diff --git a/LeanPool/LeanModularForms/ValenceFormula/TextbookExistence.lean b/LeanPool/LeanModularForms/ValenceFormula/TextbookExistence.lean index 166654fc73..cf9b8549f9 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/TextbookExistence.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/TextbookExistence.lean @@ -113,7 +113,7 @@ private lemma case_right_vertical_via_tInv (q : NonEllOrbit) (p0 : ℍ) s₀_complete f hf p1 (vAdd_neg_one_mem_fd_of_right_vert p0 hp0_fd h_half) hp1_ord have hp1_re : (↑p1 : ℂ).re = -1/2 := by change (↑((-1 : ℝ) +ᵥ p0 : ℍ) : ℂ).re = -1/2 - rw [vAdd_neg_one_coe, sub_re, one_re]; linarith + rw [vAdd_neg_one_coe, sub_re, one_re]; linarith only [h_half] have hp1_norm : ‖(↑p1 : ℂ)‖ > 1 := by change ‖(↑((-1 : ℝ) +ᵥ p0 : ℍ) : ℂ)‖ > 1 rw [vAdd_neg_one_norm_eq_of_re_half p0 h_half]; exact h_gt diff --git a/LeanPool/LeanModularForms/ValenceFormula/TextbookForm.lean b/LeanPool/LeanModularForms/ValenceFormula/TextbookForm.lean index 867ae24241..6be70479fb 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/TextbookForm.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/TextbookForm.lean @@ -9,8 +9,6 @@ public import LeanPool.LeanModularForms.ValenceFormula.TextbookExistence import LeanPool.LeanModularForms.ValenceFormula.CoreIdentity import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.MeasureTheory.Covering.Besicovitch -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Textbook Orbit-Finsum Form of the Valence Formula @@ -49,14 +47,18 @@ private lemma repCanon_ne_elliptic (p : ℍ) (hp : p ∈ repCanon f hf) : · intro heq; rw [heq] at h2; linarith [h2.2, ellipticPointRho_norm] · intro heq; rw [heq] at h2 have : (ellipticPointRhoPlusOne' : ℂ).re = 1/2 := by - change (1/2 + (Real.sqrt 3 / 2) * I : ℂ).re = 1/2; simp [add_re, mul_re, I_re, I_im] + change (1/2 + (Real.sqrt 3 / 2) * I : ℂ).re = 1/2; simp only [one_div, add_re, inv_re, + re_ofNat, normSq_ofNat, div_self_mul_self', mul_re, div_ofNat_re, ofReal_re, I_re, + mul_zero, div_ofNat_im, ofReal_im, zero_div, I_im, mul_one, sub_self, add_zero] linarith [h2.1] · have h2 := (Finset.mem_filter.mp h).2; refine ⟨?_, h2.1, ?_⟩ · intro heq; rw [heq] at h2 have : (ellipticPointI' : ℂ).re = 0 := Complex.I_re; linarith [h2.2.2] · intro heq; rw [heq] at h2 have : (ellipticPointRhoPlusOne' : ℂ).re = 1/2 := by - change (1/2 + (Real.sqrt 3 / 2) * I : ℂ).re = 1/2; simp [add_re, mul_re, I_re, I_im] + change (1/2 + (Real.sqrt 3 / 2) * I : ℂ).re = 1/2; simp only [one_div, add_re, inv_re, + re_ofNat, normSq_ofNat, div_self_mul_self', mul_re, div_ofNat_re, ofReal_re, I_re, + mul_zero, div_ofNat_im, ofReal_im, zero_div, I_im, mul_one, sub_self, add_zero] linarith [h2.2.2] private lemma denom_at_I (g : SL(2, ℤ)) : @@ -66,7 +68,8 @@ private lemma denom_at_I (g : SL(2, ℤ)) : ↑((g : Matrix (Fin 2) (Fin 2) ℤ) 1 1 : ℤ) := by simp only [UpperHalfPlane.denom, Matrix.SpecialLinearGroup.coe_GL_coe_matrix] rw [Matrix.SpecialLinearGroup.map_apply_coe (Int.castRingHom ℝ) g] - simp [RingHom.mapMatrix_apply] + simp only [Fin.isValue, RingHom.mapMatrix_apply, Int.coe_castRingHom, Matrix.map_apply, + ofReal_intCast] private lemma normSq_denom_at_I (g : SL(2, ℤ)) : Complex.normSq (UpperHalfPlane.denom (Matrix.SpecialLinearGroup.toGL @@ -74,7 +77,8 @@ private lemma normSq_denom_at_I (g : SL(2, ℤ)) : ((g : Matrix (Fin 2) (Fin 2) ℤ) 1 0 : ℝ) ^ 2 + ((g : Matrix (Fin 2) (Fin 2) ℤ) 1 1 : ℝ) ^ 2 := by rw [denom_at_I, Complex.normSq_apply] - simp [add_re, mul_re, add_im, mul_im, Complex.I_re, Complex.I_im]; ring + simp only [Fin.isValue, add_re, mul_re, intCast_re, I_re, mul_zero, intCast_im, I_im, mul_one, + sub_self, zero_add, add_im, mul_im, add_zero]; ring private lemma sl2_det (g : SL(2, ℤ)) : (g : Matrix (Fin 2) (Fin 2) ℤ) 0 0 * (g : Matrix (Fin 2) (Fin 2) ℤ) 1 1 - @@ -146,19 +150,27 @@ private theorem fd'_orbit_i_eq_i (p : ℍ) (hp : p ∈ 𝒟) (horb : orb p = oi) (by linarith only [h_im, ellipticPointI'_im]) private lemma ellipticPointRho'_re : (ellipticPointRho' : ℍ).re = -1/2 := by - change (-1/2 + (Real.sqrt 3 / 2) * I : ℂ).re = -1/2; simp [add_re, mul_re, I_re, I_im] + change (-1/2 + (Real.sqrt 3 / 2) * I : ℂ).re = -1/2; simp only [add_re, div_ofNat_re, neg_re, + one_re, mul_re, ofReal_re, I_re, mul_zero, div_ofNat_im, ofReal_im, zero_div, I_im, mul_one, + sub_self, add_zero] private lemma ellipticPointRho'_im : (ellipticPointRho' : ℍ).im = Real.sqrt 3 / 2 := by - change (-1/2 + (Real.sqrt 3 / 2) * I : ℂ).im = Real.sqrt 3 / 2; simp [add_im, mul_im, I_re, I_im] + change (-1/2 + (Real.sqrt 3 / 2) * I : ℂ).im = Real.sqrt 3 / 2; simp only [add_im, div_ofNat_im, + neg_im, one_im, neg_zero, zero_div, mul_im, div_ofNat_re, ofReal_re, I_im, mul_one, ofReal_im, + I_re, mul_zero, add_zero, zero_add] private lemma ellipticPointRhoPlusOne'_re : (ellipticPointRhoPlusOne' : ℍ).re = 1/2 := by - change (1/2 + (Real.sqrt 3 / 2) * I : ℂ).re = 1/2; simp [add_re, mul_re, I_re, I_im] + change (1/2 + (Real.sqrt 3 / 2) * I : ℂ).re = 1/2; simp only [one_div, add_re, inv_re, re_ofNat, + normSq_ofNat, div_self_mul_self', mul_re, div_ofNat_re, ofReal_re, I_re, mul_zero, div_ofNat_im, + ofReal_im, zero_div, I_im, mul_one, sub_self, add_zero] private lemma ellipticPointRhoPlusOne'_im : (ellipticPointRhoPlusOne' : ℍ).im = Real.sqrt 3 / 2 := by - change (1/2 + (Real.sqrt 3 / 2) * I : ℂ).im = Real.sqrt 3 / 2; simp [add_im, mul_im, I_re, I_im] + change (1/2 + (Real.sqrt 3 / 2) * I : ℂ).im = Real.sqrt 3 / 2; simp only [one_div, add_im, inv_im, + im_ofNat, neg_zero, normSq_ofNat, zero_div, mul_im, div_ofNat_re, ofReal_re, I_im, mul_one, + div_ofNat_im, ofReal_im, I_re, mul_zero, add_zero, zero_add] private lemma denom_at_rho (g : SL(2, ℤ)) : UpperHalfPlane.denom (Matrix.SpecialLinearGroup.toGL @@ -168,7 +180,8 @@ private lemma denom_at_rho (g : SL(2, ℤ)) : ↑((g : Matrix (Fin 2) (Fin 2) ℤ) 1 1 : ℤ) := by simp only [UpperHalfPlane.denom, Matrix.SpecialLinearGroup.coe_GL_coe_matrix] rw [Matrix.SpecialLinearGroup.map_apply_coe (Int.castRingHom ℝ) g] - simp [RingHom.mapMatrix_apply, ellipticPointRho'] + simp only [Fin.isValue, RingHom.mapMatrix_apply, Int.coe_castRingHom, Matrix.map_apply, + ofReal_intCast, ellipticPointRho'] private lemma normSq_denom_at_rho (g : SL(2, ℤ)) : Complex.normSq (UpperHalfPlane.denom (Matrix.SpecialLinearGroup.toGL @@ -348,7 +361,9 @@ private lemma c_abs_le_one_of_smul_fd (g : SL(2, ℤ)) (p₁ p₂ : ℍ) by_contra h_gt; push Not at h_gt have h_c2 : c ^ 2 ≥ 4 := by nlinarith only [h_gt, sq_abs c] have h1 : (↑c : ℝ) ^ 2 * p₂.im ^ 2 ≤ p₂.im / p₁.im := by - rw [← h_nsq_eq]; convert p₂.c_mul_im_sq_le_normSq_denom g using 1; simp [c]; ring + rw [← h_nsq_eq]; convert p₂.c_mul_im_sq_le_normSq_denom g using 1; simp only [Fin.isValue, + Matrix.SpecialLinearGroup.coe_GL_coe_matrix, Matrix.SpecialLinearGroup.map_apply_coe, + RingHom.mapMatrix_apply, Int.coe_castRingHom, Matrix.map_apply, c]; ring have h2 : (↑c : ℝ) ^ 2 * p₂.im ^ 2 * p₁.im ≤ p₂.im := by have := mul_le_mul_of_nonneg_right h1 p₁.im_pos.le rwa [div_mul_cancel₀ _ (ne_of_gt p₁.im_pos)] at this @@ -359,7 +374,7 @@ private lemma c_abs_le_one_of_smul_fd (g : SL(2, ℤ)) (p₁ p₂ : ℍ) have h_prod : 4 * (p₂.im * p₁.im) ≤ 1 := by have h_c2_real : (↑c : ℝ) ^ 2 ≥ 4 := by exact_mod_cast h_c2 nlinarith only [h3, h_c2_real, - mul_nonneg (show (0 : ℝ) ≤ (↑c : ℝ) ^ 2 - 4 from by linarith) + mul_nonneg (show (0 : ℝ) ≤ (↑c : ℝ) ^ 2 - 4 from by exact sub_nonneg.mpr h_c2_real) (mul_nonneg p₂.im_pos.le p₁.im_pos.le)] have hp1_im : (1 : ℝ) / 2 < p₁.im := by rw [← UpperHalfPlane.coe_im]; exact fd_im_gt_half _ hp₁ have hp2_im : (1 : ℝ) / 2 < p₂.im := by rw [← UpperHalfPlane.coe_im]; exact fd_im_gt_half _ hp₂ diff --git a/LeanPool/LeanModularForms/ValenceFormula/TrigLemmas.lean b/LeanPool/LeanModularForms/ValenceFormula/TrigLemmas.lean index 8b6e3d876b..520d565193 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/TrigLemmas.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/TrigLemmas.lean @@ -9,7 +9,6 @@ public import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.CategoryTheory.Category.Init import Mathlib.Combinatorics.Matroid.Init import Mathlib.MeasureTheory.Integral.Bochner.Basic -import Mathlib.NumberTheory.ArithmeticFunction.Misc import Mathlib.Tactic.Positivity.Finset /-! diff --git a/LeanPool/LeanModularForms/ValenceFormula/WindingWeights.lean b/LeanPool/LeanModularForms/ValenceFormula/WindingWeights.lean index 221502d2a0..01334232a1 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/WindingWeights.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/WindingWeights.lean @@ -10,7 +10,6 @@ public import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Rho public import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.RhoPlusOne import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Winding Number Weights at Elliptic Points diff --git a/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/Common.lean b/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/Common.lean index 6ac6a45725..c532cbc4f6 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/Common.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/Common.lean @@ -12,7 +12,6 @@ import LeanPool.LeanModularForms.ValenceFormula.TrigLemmas import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Shared Infrastructure for Winding Weight Computations @@ -49,7 +48,7 @@ theorem fdBoundary_H_at_two_eq_I (H : ℝ) : rw [show (↑(Real.pi : ℝ) / 3 + (↑(2 : ℝ) - 1) * (↑(Real.pi : ℝ) / 2 - ↑(Real.pi : ℝ) / 3)) * I = ↑(Real.pi / 2) * I from by push_cast; ring, exp_real_angle_I, Real.cos_pi_div_two, Real.sin_pi_div_two] - push_cast; ring + push_cast; ac_rfl theorem fdBoundary_H_at_three_eq_rho (H : ℝ) : fdBoundaryH H 3 = ellipticPointRho := by @@ -61,7 +60,7 @@ theorem fdBoundary_H_at_three_eq_rho (H : ℝ) : ↑(2 * Real.pi / 3) * I from by push_cast; ring, exp_real_angle_I, cos_two_pi_div_three, sin_two_pi_div_three] simp only [ellipticPointRho, ellipticPointRho', UpperHalfPlane.coe_mk] - push_cast; ring + push_cast; ac_rfl theorem fdBoundary_H_seg0 (H : ℝ) {t : ℝ} (ht : t ≤ 1) : fdBoundaryH H t = 1/2 + (↑H - ↑t * (↑H - ↑(Real.sqrt 3) / 2)) * I := by @@ -247,11 +246,11 @@ lemma hasDerivAt_arc (s : ℂ) : intro t have hf : HasDerivAt (fun s : ℝ => Real.pi * (1 + s) / 6) (Real.pi / 6) t := ((hasDerivAt_id t).add_const (1 : ℝ) |>.const_mul (Real.pi / 6)).congr_of_eventuallyEq - (Eventually.of_forall fun s => show _ from by simp [id]; ring) |>.congr_deriv (by ring) + (Eventually.of_forall fun s => show _ from by simp only [id]; ring) |>.congr_deriv (by ac_rfl) have hci : HasDerivAt (fun s : ℝ => (↑(Real.pi * (1 + s) / 6) : ℂ) * I) ((↑(Real.pi / 6) : ℂ) * I) t := (hf.ofReal_comp.mul_const I).congr_deriv (by norm_num [smul_eq_mul]) - exact (hci.cexp.sub (hasDerivAt_const t s)).congr_deriv (by simp only [sub_zero]; ring) + exact (hci.cexp.sub (hasDerivAt_const t s)).congr_deriv (by simp only [sub_zero]; ac_rfl) /-- Continuity of the arc derivative. -/ lemma continuous_arc_deriv (_ : ℂ) : diff --git a/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/I.lean b/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/I.lean index 73ebd35faa..7f866048df 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/I.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/I.lean @@ -14,7 +14,6 @@ import LeanPool.LeanModularForms.ValenceFormula.TrigLemmas import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Winding Number Weight at i @@ -167,7 +166,7 @@ private lemma g_i_slitPlane_left {t : ℝ} (_ht0 : 0 ≤ t) (ht2 : t < 2) : · rw [fdBoundary_H_seg1 H (by linarith only [ht1]) (by linarith only [ht2])] set θ := Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3) with hθ_def rw [show (↑Real.pi / 3 + (↑t - 1) * (↑Real.pi / 2 - ↑Real.pi / 3)) * I = - (↑θ : ℂ) * I from by simp only [hθ_def]; push_cast; ring, exp_real_angle_I] + (↑θ : ℂ) * I from by simp only [hθ_def]; push_cast; ac_rfl, exp_real_angle_I] simp only [Complex.add_re, Complex.sub_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im, Complex.ofReal_im, mul_zero, sub_zero, add_zero, mul_one] @@ -335,7 +334,7 @@ private lemma log_neg_half_branch : have hm : (-1 : ℂ) / 2 = ↑((1 : ℝ)/2) * (-1 : ℂ) := by push_cast; ring rw [hm, Complex.log_ofReal_mul (by norm_num : (0 : ℝ) < 1/2) (by norm_num : (-1 : ℂ) ≠ 0), Complex.log_neg_one] - rw [show (1 : ℂ)/2 = ↑((1 : ℝ)/2) from by push_cast; ring, + rw [show (1 : ℂ)/2 = ↑((1 : ℝ)/2) from by push_cast; ac_rfl, ← Complex.ofReal_log (show (0 : ℝ) ≤ 1/2 from by norm_num)] ring @@ -346,7 +345,7 @@ private lemma fdBoundary_sub_I_at_one (H : ℝ) : rw [show Real.pi * (1 + 1) / 6 = Real.pi / 3 from by ring, show (↑(Real.pi / 3) : ℂ) * I = ↑(Real.pi / 3) * I from rfl, exp_real_angle_I, Real.cos_pi_div_three, Real.sin_pi_div_three] - push_cast; ring + push_cast; ac_rfl private lemma fdBoundary_sub_I_at_three (H : ℝ) : fdBoundaryH H 3 - I = exp (↑(Real.pi * (1 + (3 : ℝ)) / 6) * I) - I := by @@ -355,7 +354,7 @@ private lemma fdBoundary_sub_I_at_three (H : ℝ) : rw [show Real.pi * (1 + 3) / 6 = 2 * Real.pi / 3 from by ring] rw [show (↑(2 * Real.pi / 3) : ℂ) * I = ↑(2 * Real.pi / 3) * I from rfl, exp_real_angle_I, cos_two_pi_div_three, sin_two_pi_div_three] - push_cast; ring + push_cast; ac_rfl private lemma h2_at_three_im_neg (H : ℝ) : ((-1/2 + ↑(Real.sqrt 3 / 2 - 1 + ((3 : ℝ) - 3) * (H - Real.sqrt 3 / 2)) * I : ℂ)).im < 0 := by @@ -383,12 +382,12 @@ private lemma hasDerivAt_i_arc (t : ℝ) : (↑(Real.pi / 6) * I * exp (↑(Real.pi * (1 + t) / 6) * I)) t := by have hf : HasDerivAt (fun s : ℝ => Real.pi * (1 + s) / 6) (Real.pi / 6) t := ((hasDerivAt_id t).add_const (1 : ℝ) |>.const_mul (Real.pi / 6)).congr_of_eventuallyEq - (Eventually.of_forall fun s => show _ from by simp [id]; ring) - |>.congr_deriv (by ring) + (Eventually.of_forall fun s => show _ from by simp only [id]; ring) + |>.congr_deriv (by ac_rfl) have hci : HasDerivAt (fun s : ℝ => (↑(Real.pi * (1 + s) / 6) : ℂ) * I) ((↑(Real.pi / 6) : ℂ) * I) t := (hf.ofReal_comp.mul_const I).congr_deriv (by norm_num [smul_eq_mul]) - exact (hci.cexp.sub (hasDerivAt_const t I)).congr_deriv (by simp only [sub_zero]; ring) + exact (hci.cexp.sub (hasDerivAt_const t I)).congr_deriv (by simp only [sub_zero]; ac_rfl) private lemma hasDerivAt_i_seg3 (H : ℝ) (t : ℝ) : HasDerivAt @@ -398,10 +397,10 @@ private lemma hasDerivAt_i_seg3 (H : ℝ) (t : ℝ) : (H - Real.sqrt 3 / 2) t := ((hasDerivAt_id t).sub_const (3 : ℝ) |>.mul_const (H - Real.sqrt 3 / 2) |>.add_const (Real.sqrt 3 / 2 - 1)).congr_of_eventuallyEq - (Eventually.of_forall fun s => show _ from by simp [id]; ring) - |>.congr_deriv (by ring) + (Eventually.of_forall fun s => show _ from by simp only [id]; ac_rfl) + |>.congr_deriv (by ac_rfl) exact ((hasDerivAt_const t ((-1 : ℂ)/2)).add - (hf.ofReal_comp.mul_const I)).congr_deriv (by push_cast; ring) + (hf.ofReal_comp.mul_const I)).congr_deriv (by push_cast; ac_rfl) private lemma hasDerivAt_i_seg4 (H : ℝ) (t : ℝ) : HasDerivAt (fun s : ℝ => ↑(s - 9/2) + ↑(H - 1) * I) (1 : ℂ) t := by @@ -793,7 +792,7 @@ private lemma i_E_tendsto (H : ℝ) (_ : 1 < H) (threshold : ℝ) (hthresh_pos : have hpi_pos : 0 < Real.pi := Real.pi_pos rw [Metric.tendsto_nhdsWithin_nhds] intro r hr - refine ⟨min threshold (r/2), lt_min hthresh_pos (by linarith), ?_⟩ + refine ⟨min threshold (r/2), lt_min hthresh_pos (by linarith only [hr]), ?_⟩ intro ε hε_mem hε_dist simp only [Set.mem_Ioi] at hε_mem rw [Real.dist_eq, sub_zero, abs_of_pos hε_mem] at hε_dist @@ -803,7 +802,7 @@ private lemma i_E_tendsto (H : ℝ) (_ : 1 < H) (threshold : ℝ) (hthresh_pos : have hε_lt_2sin : ε < 2 * Real.sin (Real.pi / 12) := lt_of_lt_of_le hε_lt hthresh_le_2sin have hε_half_neg : -1 ≤ ε / 2 := by linarith only [hε_pos] have hε_half_le : ε / 2 ≤ 1 := by linarith [lt_of_lt_of_le hε_lt hthresh_le_one] - have hε_half_pos : 0 < ε / 2 := by linarith + have hε_half_pos : 0 < ε / 2 := by linarith only [hε_mem] have harcsin_pos : 0 < Real.arcsin (ε / 2) := Real.arcsin_pos.mpr hε_half_pos have hδ_pos : 0 < 12 / Real.pi * Real.arcsin (ε / 2) := mul_pos (div_pos (by norm_num) hpi_pos) harcsin_pos @@ -819,7 +818,7 @@ private lemma i_E_tendsto (H : ℝ) (_ : 1 < H) (threshold : ℝ) (hthresh_pos : i_angle_bound H hδ_pos hδ_lt_one (by rw [g_i_norm_left hδ_pos hδ_lt_one]; linarith) -- norms at crossing points equal ε have h_nL : ‖fdBoundaryH H (2 - 12 / Real.pi * Real.arcsin (ε / 2)) - I‖ = ε := by - rw [g_i_norm_left hδ_pos hδ_lt_one]; linarith + rw [g_i_norm_left hδ_pos hδ_lt_one]; linarith only [hsin_eq] have h_nR : ‖fdBoundaryH H (2 + 12 / Real.pi * Real.arcsin (ε / 2)) - I‖ = ε := by rw [g_i_norm_right hδ_pos hδ_lt_one] linarith [h_nL, g_i_norm_left (H := H) hδ_pos hδ_lt_one] @@ -839,7 +838,7 @@ private lemma i_E_tendsto (H : ℝ) (_ : 1 < H) (threshold : ℝ) (hthresh_pos : push_cast; ring rw [Complex.dist_eq, h_E_eq, norm_neg, norm_mul, Complex.norm_real, Complex.norm_I, mul_one, Real.norm_eq_abs, abs_of_pos (by positivity)] - linarith + linarith only [hε_lt_r2, h_angle_bnd] /-- The PV integral of `(γ-I)⁻¹ γ'` over `[0,5]` with ε-ball cutoff tends to `-iπ`. @@ -918,7 +917,7 @@ theorem gWN_fdBoundary_H_at_i (H : ℝ) (hH : 1 < H) : generalizedWindingNumber' (fdBoundaryH H) 0 5 I = -1/2 := by apply ContourIntegral.gWN_eq_neg_half_of_pv_tendsto convert pv_integral_at_i_tendsto H hH using 2 - · simp [sub_zero, gt_iff_lt] - · ring + · simp only [sub_zero, deriv_sub_const_fun, gt_iff_lt] + · ac_rfl end diff --git a/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/Rho.lean b/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/Rho.lean index bd65ec506b..39c3d0bed5 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/Rho.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/Rho.lean @@ -14,7 +14,6 @@ import LeanPool.LeanModularForms.ValenceFormula.TrigLemmas import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Winding Number Weight at ρ @@ -115,7 +114,7 @@ theorem fdBoundary_H_sub_rho_seg1_re (H : ℝ) {t : ℝ} (ht1 : 1 < t) (ht2 : t simp only [ellipticPointRho, ellipticPointRho', UpperHalfPlane.coe_mk] set θ : ℝ := Real.pi / 3 + (t - 1) * (Real.pi / 2 - Real.pi / 3) with hθ_def rw [show (↑Real.pi / 3 + (↑t - 1) * (↑Real.pi / 2 - ↑Real.pi / 3)) * I = - (↑θ : ℂ) * I from by simp only [hθ_def]; push_cast; ring, exp_real_angle_I] + (↑θ : ℂ) * I from by simp only [hθ_def]; push_cast; ac_rfl, exp_real_angle_I] simp only [Complex.add_re, Complex.sub_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im, Complex.ofReal_im, Complex.neg_re, Complex.one_re, Complex.div_ofNat_re, Complex.div_ofNat_im, zero_div] @@ -132,7 +131,7 @@ theorem fdBoundary_H_sub_rho_seg2_re (H : ℝ) {t : ℝ} (ht2 : 2 < t) (ht3 : t simp only [ellipticPointRho, ellipticPointRho', UpperHalfPlane.coe_mk] set θ : ℝ := Real.pi / 2 + (t - 2) * (2 * Real.pi / 3 - Real.pi / 2) with hθ_def rw [show (↑Real.pi / 2 + (↑t - 2) * (2 * ↑Real.pi / 3 - ↑Real.pi / 2)) * I = - (↑θ : ℂ) * I from by simp only [hθ_def]; push_cast; ring, exp_real_angle_I] + (↑θ : ℂ) * I from by simp only [hθ_def]; push_cast; ac_rfl, exp_real_angle_I] have hre : (↑(Real.cos θ) + ↑(Real.sin θ) * I - (-1 / 2 + ↑(Real.sqrt 3) / 2 * I)).re = Real.cos θ + 1 / 2 := by simp only [Complex.add_re, Complex.sub_re, Complex.ofReal_re, Complex.mul_re, @@ -743,7 +742,7 @@ private lemma pv_log_limit_at_rho (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : intro ε hε_pos hε_lt have hε_lt_gap : ε < H - Real.sqrt 3 / 2 := lt_of_lt_of_le hε_lt (min_le_left _ _) have hε_lt_2sin : ε < 2 * Real.sin (Real.pi / 12) := lt_of_lt_of_le hε_lt (min_le_right _ _) - refine ⟨by linarith, ?_, by linarith, Real.arcsin_pos.mpr (by linarith), ?_⟩ + refine ⟨by linarith only [hε_pos], ?_, by linarith, Real.arcsin_pos.mpr (by linarith), ?_⟩ · have hsin_le : Real.sin (Real.pi / 12) ≤ 1 := Real.sin_le_one _; linarith · exact arcsin_eps_div_two_lt_pi_12 hε_pos hε_lt_2sin have hδL_pos : ∀ ε : ℝ, 0 < ε → ε < threshold → 0 < δ_L ε := by @@ -810,7 +809,7 @@ private lemma pv_log_limit_at_rho (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : have : x < Real.pi / 12 := by nlinarith only [harcsin_lt, hδL_angle] linarith [Real.pi_le_four] nlinarith [Real.sin_gt_sub_cube hx_pos, sq_nonneg x, sq_nonneg (1 - x)] - linarith + linarith only [hε_lt_r, h_angle_bound] /-- The PV integral of `(γ-ρ)⁻¹ γ'` over `[0,5]` with ε-ball cutoff tends to `-iπ/3`. -/ theorem pv_integral_at_rho_tendsto (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : @@ -884,7 +883,7 @@ theorem gWN_fdBoundary_H_at_rho (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : generalizedWindingNumber' (fdBoundaryH H) 0 5 ellipticPointRho = -1/6 := by apply ContourIntegral.gWN_eq_neg_sixth_of_pv_tendsto convert pv_integral_at_rho_tendsto H hH using 2 - · simp [sub_zero, gt_iff_lt] + · simp only [sub_zero, deriv_sub_const_fun, gt_iff_lt] · ring end diff --git a/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/RhoPlusOne.lean b/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/RhoPlusOne.lean index c4f1094231..9050319c4f 100644 --- a/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/RhoPlusOne.lean +++ b/LeanPool/LeanModularForms/ValenceFormula/WindingWeights/RhoPlusOne.lean @@ -14,7 +14,6 @@ import LeanPool.LeanModularForms.ValenceFormula.TrigLemmas import LeanPool.LeanModularForms.ValenceFormula.WindingWeights.Common import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds import Mathlib.CategoryTheory.Category.Init -import Mathlib.NumberTheory.ArithmeticFunction.Misc /-! # Winding Number Weight at ρ+1 @@ -55,7 +54,7 @@ private lemma g_rho'_arc_value {t : ℝ} (ht1 : 1 < t) (ht3 : t < 3) : Complex.exp (↑(Real.pi * (1 + t) / 6) * I) - (↑(1/2 : ℝ) + ↑(Real.sqrt 3 / 2) * I) := by rw [fdBoundary_H_eq_arc ht1 ht3] simp only [ellipticPointRhoPlusOne, ellipticPointRhoPlusOne', UpperHalfPlane.coe_mk] - push_cast; ring + push_cast; ac_rfl private lemma g_rho'_seg3_value {t : ℝ} (ht3 : 3 < t) (ht4 : t ≤ 4) : fdBoundaryH H t - ellipticPointRhoPlusOne = @@ -158,7 +157,7 @@ private lemma g_rho'_ne_zero (hH : Real.sqrt 3 / 2 < H) have : Real.sqrt 3 / 2 < Real.sin (Real.pi * (1 + t) / 6) := sin_gt_sqrt3_div_2_of_mem (by nlinarith only [h1, Real.pi_pos]) (by nlinarith only [h3, Real.pi_pos]) - linarith + linarith only [this] rw [h_eq] at him_pos; simp only [Complex.zero_im, lt_irrefl] at him_pos · rcases eq_or_lt_of_le h3 with rfl | h3' · rw [fdBoundary_H_at_three_eq_rho] at h_eq @@ -179,7 +178,7 @@ private lemma g_rho'_ne_zero (hH : Real.sqrt 3 / 2 < H) H - Real.sqrt 3 / 2 := by simp [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.I_re, Complex.I_im, Complex.ofReal_re] - rw [h_eq] at him; simp only [Complex.zero_im] at him; linarith + rw [h_eq] at him; simp only [Complex.zero_im] at him; linarith only [hH, him] private lemma g_rho'_slitPlane (hH : Real.sqrt 3 / 2 < H) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 5) (hne1 : t ≠ 1) (hne3 : t ≠ 3) : @@ -359,20 +358,21 @@ private lemma hasDerivAt_rho'_arc (t : ℝ) : (↑(Real.pi / 6) * I * exp (↑(Real.pi * (1 + t) / 6) * I)) t := by have hf : HasDerivAt (fun s : ℝ => Real.pi * (1 + s) / 6) (Real.pi / 6) t := ((hasDerivAt_id t).add_const (1 : ℝ) |>.const_mul (Real.pi / 6)).congr_of_eventuallyEq - (Eventually.of_forall fun s => show _ from by simp [id]; ring) - |>.congr_deriv (by ring) + (Eventually.of_forall fun s => show _ from by simp only [id]; ring) + |>.congr_deriv (by ac_rfl) have hci : HasDerivAt (fun s : ℝ => (↑(Real.pi * (1 + s) / 6) : ℂ) * I) ((↑(Real.pi / 6) : ℂ) * I) t := (hf.ofReal_comp.mul_const I).congr_deriv (by norm_num [smul_eq_mul]) exact (hci.cexp.sub (hasDerivAt_const t (ellipticPointRhoPlusOne : ℂ))).congr_deriv - (by simp only [sub_zero]; ring) + (by simp only [sub_zero]; ac_rfl) private lemma hasDerivAt_rho'_seg3 (H : ℝ) (t : ℝ) : HasDerivAt (fun s : ℝ => -1 + ↑((s - 3) * (H - Real.sqrt 3 / 2)) * I) ((↑(H - Real.sqrt 3 / 2) : ℂ) * I) t := ((hasDerivAt_const t (-1 : ℂ)).add ((((hasDerivAt_id t).sub (hasDerivAt_const t 3)).mul_const - (H - Real.sqrt 3 / 2)).ofReal_comp.mul_const I)).congr_deriv (by simp [zero_add]) + (H - Real.sqrt 3 / 2)).ofReal_comp.mul_const I)).congr_deriv (by simp only [sub_zero, one_mul, + ofReal_sub, ofReal_div, ofReal_ofNat, zero_add]) private lemma hasDerivAt_rho'_seg4 (H : ℝ) (t : ℝ) : HasDerivAt (fun s : ℝ => ↑(s - 5) + ↑(H - Real.sqrt 3 / 2) * I) (1 : ℂ) t := by @@ -617,7 +617,7 @@ private lemma rho'_norm_gt_right_of_arc (H : ℝ) (hH : Real.sqrt 3 / 2 < H) · calc ε < 1 := hε_lt_one _ ≤ _ := g_rho'_norm_ge_one_seg3 (le_refl 3) (by norm_num) · rw [g_rho'_norm_arc_full (by linarith only [ht1, hδ_R_pos] : 1 < t) ht3', - ← h_norm_R, g_rho'_norm_arc hδ_R_pos (by linarith : δ_R < 2)] + ← h_norm_R, g_rho'_norm_arc hδ_R_pos (by linarith only [hδ_R_pos, hδ_R_lt_one] : δ_R < 2)] have hpi_pos := Real.pi_pos apply mul_lt_mul_of_pos_left _ (by norm_num : (0 : ℝ) < 2) exact Real.sin_lt_sin_of_lt_of_le_pi_div_two @@ -695,7 +695,7 @@ theorem pv_integral_at_rho_plus_one_tendsto (H : ℝ) (hH : Real.sqrt 3 / 2 < H) then (fdBoundaryH H t - ellipticPointRhoPlusOne)⁻¹ * deriv (fun s => fdBoundaryH H s - ellipticPointRhoPlusOne) t else 0) (𝓝[>] 0) (𝓝 (-(I * ↑Real.pi / 3))) := by - have hH_gap : 0 < H - Real.sqrt 3 / 2 := by linarith + have hH_gap : 0 < H - Real.sqrt 3 / 2 := by linarith only [hH] have hpi_pos : 0 < Real.pi := Real.pi_pos have hsin_pos : 0 < Real.sin (Real.pi / 12) := sin_pi_12_pos have h2sin_pos : 0 < 2 * Real.sin (Real.pi / 12) := by positivity @@ -738,7 +738,7 @@ theorem pv_integral_at_rho_plus_one_tendsto (H : ℝ) (hH : Real.sqrt 3 / 2 < H) have ht1 : t < 1 - ε / (H - Real.sqrt 3 / 2) := ht_mem.2 have ht_lt_one : t < 1 := by linarith [div_pos hε_pos hH_gap] rw [g_rho'_norm_seg0 hH ht0 ht_lt_one] - have h_key : ε / (H - Real.sqrt 3 / 2) < 1 - t := by linarith + have h_key : ε / (H - Real.sqrt 3 / 2) < 1 - t := by linarith only [ht1] calc ε = ε / (H - Real.sqrt 3 / 2) * (H - Real.sqrt 3 / 2) := (div_mul_cancel₀ ε (ne_of_gt hH_gap)).symm _ < (1 - t) * (H - Real.sqrt 3 / 2) := mul_lt_mul_of_pos_right h_key hH_gap @@ -747,7 +747,7 @@ theorem pv_integral_at_rho_plus_one_tendsto (H : ℝ) (hH : Real.sqrt 3 / 2 < H) have hε_lt_gap : ε < H - Real.sqrt 3 / 2 := lt_of_lt_of_le hε_lt (min_le_left _ _) have hε_lt_2sin : ε < 2 * Real.sin (Real.pi / 12) := lt_of_lt_of_le hε_lt (min_le_right _ _) - have hε_half_neg : (-1 : ℝ) ≤ ε / 2 := by linarith + have hε_half_neg : (-1 : ℝ) ≤ ε / 2 := by linarith only [hε_pos] have hε_half_le : ε / 2 ≤ 1 := by linarith [Real.sin_le_one (Real.pi / 12)] have hε_lt_one : ε < 1 := by linarith [sin_pi_12_lt_half] simp only [hδR_def] at ht_mem @@ -760,7 +760,7 @@ theorem pv_integral_at_rho_plus_one_tendsto (H : ℝ) (hH : Real.sqrt 3 / 2 < H) have h_norm_R : ‖fdBoundaryH H (1 + δ_right ε) - ellipticPointRhoPlusOne‖ = ε := by rw [g_rho'_norm_arc hδR_pos (by linarith : δ_right ε < 2), hδR_angle, Real.sin_arcsin hε_half_neg hε_half_le] - linarith + linarith only [] have h_ioo := rho'_norm_gt_right_of_arc H hH hε_lt_one hε_lt_gap hδR_pos hδR_lt_one h_norm_R rcases eq_or_lt_of_le ht_mem.2 with rfl | ht_lt5 @@ -778,12 +778,12 @@ theorem pv_integral_at_rho_plus_one_tendsto (H : ℝ) (hH : Real.sqrt 3 / 2 < H) have h_norm_L : ‖fdBoundaryH H (1 - δ_left ε) - ellipticPointRhoPlusOne‖ = ε := by rw [g_rho'_norm_seg0_at hH hδL_pos (le_of_lt hδL_lt_one)] field_simp - have : H * 2 - Real.sqrt 3 > 0 := by nlinarith + have : H * 2 - Real.sqrt 3 > 0 := by nlinarith only [hε_pos, hε_lt_gap] exact div_self (ne_of_gt this) have h_norm_R : ‖fdBoundaryH H (1 + δ_right ε) - ellipticPointRhoPlusOne‖ = ε := by rw [g_rho'_norm_arc hδR_pos (by linarith : δ_right ε < 2), hδR_angle, Real.sin_arcsin hε_half_neg hε_half_le] - linarith + linarith only [] exact not_lt.mp (norm_le_middle_rho_plus_one H hH hε_pos hδL_pos hδL_lt_one hδR_pos hδR_lt_one h_norm_L h_norm_R hH_gap t ht_mem.1 ht_mem.2) · -- h_ftc: FTC gives the two-piece integral equals E ε @@ -831,12 +831,12 @@ theorem pv_integral_at_rho_plus_one_tendsto (H : ℝ) (hH : Real.sqrt 3 / 2 < H) have h_norm_L : ‖fdBoundaryH H (1 - δ_left ε) - ellipticPointRhoPlusOne‖ = ε := by rw [g_rho'_norm_seg0_at hH hδL_pos (le_of_lt hδL_lt_one)] field_simp - have : H * 2 - Real.sqrt 3 > 0 := by nlinarith + have : H * 2 - Real.sqrt 3 > 0 := by nlinarith only [hε_mem, hε_lt_gap] exact div_self (ne_of_gt this) have h_norm_R : ‖fdBoundaryH H (1 + δ_right ε) - ellipticPointRhoPlusOne‖ = ε := by rw [g_rho'_norm_arc hδR_pos (by linarith : δ_right ε < 2), hδR_angle, Real.sin_arcsin hε_half_neg hε_half_le] - linarith + linarith only [] simp only [hE_def] rw [show dist (Complex.log (fdBoundaryH H (1 - δ_left ε) - ↑ellipticPointRhoPlusOne) - Complex.log (fdBoundaryH H (1 + δ_right ε) - ↑ellipticPointRhoPlusOne)) @@ -873,7 +873,7 @@ theorem gWN_fdBoundary_H_at_rho_plus_one (H : ℝ) (hH : Real.sqrt 3 / 2 < H) : generalizedWindingNumber' (fdBoundaryH H) 0 5 ellipticPointRhoPlusOne = -1/6 := by apply ContourIntegral.gWN_eq_neg_sixth_of_pv_tendsto convert pv_integral_at_rho_plus_one_tendsto H hH using 2 - · simp [sub_zero, gt_iff_lt] + · simp only [sub_zero, deriv_sub_const_fun, gt_iff_lt] · ring end